Forum Discussion

MisabhMHasan's avatar
MisabhMHasan
Copper Contributor
Jul 08, 2020
Solved

The term 'New-AzRoleAssignment' is not recognized as the name of a cmdlet

Hello,

 

I am getting error the following when running the PowerShell command, 'New-AzRoleAssignment ...':

 

The term 'New-AzRoleAssignment' 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.

 

I am PowerShell ISE and I found out that the command is not listed, when I typed 'New-'. Is this to do with the version of PowerShell, that I have on my machine? Which version, should I be at, if it is the case. Please see the attached screenshot that, displays PowerShell version option.

 

Just in case for clarity the following is the PowerShell version information:

 

PSVersion: 5.1.18362.752
PSEdition: Desktop
PSCompatibleVersions: {1.0, 2.0, 3.0, 4.0...}
BuildVersion: 10.0.18362.752
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1

 

Alternatively, is there any other way to delegate access in Windows Virtual Desktop or it can only be done through PowerShell cmdlets?

 

Kind regards,

Misbah

  • MisabhMHasan

    Found out from support that, 'New-AzRoleAssignment' PowerShell cmdlet required to have 'Az.Resources' module. Refer to the following:

     

    https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.resources%2Fnew-azroleassignment%3Fview%3Dazps-4.3.0&data=02%7C01%7Cv-manbla%40microsoft.com%7C967c908c21564800729108d8273728dc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637302465153796699&sdata=sl7rODEDg6OleRn38WShVY6X2G2ViJ8nSusQ5Eh3hXE%3D&reserved=0

     

    Install Az.Resources module using the following cmdlet:

    Install-Module -Name Az.Resources

     

    Import Az.Resources module using the following cmdlet:

    Import-Module -Name Az.Resources

     

    Kind regards,

    Misbah

1 Reply

  • MisabhMHasan's avatar
    MisabhMHasan
    Copper Contributor

    MisabhMHasan

    Found out from support that, 'New-AzRoleAssignment' PowerShell cmdlet required to have 'Az.Resources' module. Refer to the following:

     

    https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.resources%2Fnew-azroleassignment%3Fview%3Dazps-4.3.0&data=02%7C01%7Cv-manbla%40microsoft.com%7C967c908c21564800729108d8273728dc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637302465153796699&sdata=sl7rODEDg6OleRn38WShVY6X2G2ViJ8nSusQ5Eh3hXE%3D&reserved=0

     

    Install Az.Resources module using the following cmdlet:

    Install-Module -Name Az.Resources

     

    Import Az.Resources module using the following cmdlet:

    Import-Module -Name Az.Resources

     

    Kind regards,

    Misbah

Resources