3

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?

Ohad Schneider
  • 36,600
  • 15
  • 168
  • 198
ZakiMa
  • 5,637
  • 1
  • 24
  • 48

2 Answers2

1

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
ZakiMa
  • 5,637
  • 1
  • 24
  • 48
Ohad Schneider
  • 36,600
  • 15
  • 168
  • 198
0

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!

ZakiMa
  • 5,637
  • 1
  • 24
  • 48
  • This is a wrong response, you don't have to move to Az if you are using the older modules. AzureRM has this as well, you can install it via: install-module AzureRm.ManagedServiceIdentity -Allowprerelease – Pixel Nov 06 '19 at 15:45
  • You're right. That's why I marked another answer as correct. I still provided what worked for me =) This is still a solution to original question. – ZakiMa Nov 06 '19 at 19:46