ZakiMa
ZakiMa

Reputation: 6281

The term 'New-AzureRmUserAssignedIdentity' is not recognized as the name

I'm trying to create user assigned identity, the documentation says that 6.13 should include this function: https://learn.microsoft.com/en-us/powershell/module/azurerm.managedserviceidentity/new-azurermuserassignedidentity?view=azurermps-6.13.0

I uninstalled old versions of Azure RM and installed the latest:

PS C:\Users\user> Get-Module AzureRM -ListAvailable | Select-Object -Property Name,Version,Path

Name    Version Path
----    ------- ----
AzureRM 6.13.1  C:\Program Files\WindowsPowerShell\Modules\AzureRM\6.13.1\AzureRM.psd1

But when I try to use it I get the following error:

PS C:\Users\zakima> New-AzureRmUserAssignedIdentity -ResourceGroupName PSRG -Name ID1
New-AzureRmUserAssignedIdentity : The term 'New-AzureRmUserAssignedIdentity' 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
+ New-AzureRmUserAssignedIdentity -ResourceGroupName PSRG -Name ID1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-AzureRmUserAssignedIdentity:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Am I missing some config setting?

Upvotes: 3

Views: 3316

Answers (2)

Ohad Schneider
Ohad Schneider

Reputation: 38162

The New-AzureRmUserAssignedIdentity Cmdlet resides in the AzureRM.ManagedServiceIdentity module. This module in turn can be found in the PowerShell Gallery and can be installed via:

Install-Module -Name "AzureRM.ManagedServiceIdentity" -AllowPrerelease

Note that the AllowPrerelease flag for Install-Module might not be available for your installed PowerShellGet version, so you might need to update it before the above would work:

Install-Module "PowerShellGet" –Repository "PSGallery" –Force

Upvotes: 1

ZakiMa
ZakiMa

Reputation: 6281

The problem is that UserAssignedIdentity is still in preview and apparently is not included in AzureRM package.

The following steps made it work for me:

  1. Move to Az package (note - you need uninstall AzureRM first!). It still doesn't include New-AzUserAssignedIdentity.

  2. Install Az.ManagedServiceIdentity directly by running this command:

    Install-Module -Name Az.ManagedServiceIdentity

  3. Enjoy!

Upvotes: 0

Related Questions