SOLVED

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

Copper Contributor

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

1 Reply
best response confirmed by MisabhMHasan (Copper Contributor)
Solution

@MisabhMHasan

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

 

https://docs.microsoft.com/en-us/powershell/module/az.resources/new-azroleassignment?view=azps-4.3.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 best response

Accepted Solutions
best response confirmed by MisabhMHasan (Copper Contributor)
Solution

@MisabhMHasan

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

 

https://docs.microsoft.com/en-us/powershell/module/az.resources/new-azroleassignment?view=azps-4.3.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

View solution in original post