'New-ShardMapManager' is not recognized as the name of a cmdlet trying to access through powershell

479 views Asked by At

Steps I used: Login-AzureRmAccount -- I ran this cmdlet in Powershell in admin mode once logged I ran this below query

New-ShardMapManager -UserName 'user_name' -Password 'enterd password' -SqlServerName 'server_name.database.windows.net' -SqlDatabaseName 'Elastic_poc_db'

I am getting following error :

New-ShardMapManager : The term 'New-ShardMapManager' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-ShardMapManager:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I am Using Powershell 4 version

2

There are 2 answers

0
Kous Makous On

I ran into this problem much more recently than the above post, and the information in previous replies is out of date. My solution may contain anti-practices, but it worked for me.

  1. Add the elastic client NuGet Package to your PowerShell. The version I used is the current one as of this posting.

In a PowerShell prompt running as Administrator, run the following:

Install-Package -Name Microsoft.Azure.SqlDatabase.ElasticScale.Client -RequiredVersion 2.3.0 -SkipDependencies -Force -Source NuGet.org
  1. Copy files into your PowerShell modules folder structure.
  • Create a subfolder of your Documents\PowerShell\Modules folder. I used \ShardManagement.
  • Copy the DLL installed by Install-Package into the folder. Mine was here: C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.Azure.SqlDatabase.ElasticScale.Client.2.3.0\lib\net451\Microsoft.Azure.SqlDatabase.ElasticScale.Client.dll.
  • Copy the .psm1 file ShardManagement.psm1 from github in elastic-db-tools/Samples/PowerShell/ShardManagement at the GitHub Elastic DB Tools repo to the same modules folder.
  1. Import the module.

From the same PowerShell prompt you used in step 1, run this:

Import-Module ShardManagement

You should now be able to run New-ShardMapManager and its siblings in PowerShell.

0
Debra Dove On

New-ShardMapManager is not part of the Azure Resource Manager, it is a separate download which you can get from here: https://gallery.technet.microsoft.com/scriptcenter/Azure-SQL-DB-Elastic-731883db