SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-1508936%22%20slang%3D%22en-US%22%3EThe%20term%20'New-AzRoleAssignment'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1508936%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20getting%20error%20the%20following%20when%20running%20the%20PowerShell%20command%2C%20'New-AzRoleAssignment%20...'%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EThe%20term%20'New-AzRoleAssignment'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%2C%20function%2C%20script%20file%2C%20or%20operable%20program.%20Check%20the%20spelling%20of%20the%20%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3Ename%2C%20or%20if%20a%20path%20was%20included%2C%20verify%20that%20the%20path%20is%20correct%20and%20try%20again.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20PowerShell%20ISE%20and%20I%20found%20out%20that%20the%20command%20is%20not%20listed%2C%20when%20I%20typed%20'New-'.%20Is%20this%20to%20do%20with%20the%20version%20of%20PowerShell%2C%20that%20I%20have%20on%20my%20machine%3F%20Which%20version%2C%20should%20I%20be%20at%2C%20if%20it%20is%20the%20case.%20Please%20see%20the%20attached%20screenshot%20that%2C%20displays%20PowerShell%20version%20option.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20in%20case%20for%20clarity%20the%20following%20is%20the%20PowerShell%20version%20information%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPSVersion%3A%205.1.18362.752%3CBR%20%2F%3EPSEdition%3A%20Desktop%3CBR%20%2F%3EPSCompatibleVersions%3A%20%7B1.0%2C%202.0%2C%203.0%2C%204.0...%7D%3CBR%20%2F%3EBuildVersion%3A%2010.0.18362.752%3CBR%20%2F%3ECLRVersion%3A%204.0.30319.42000%3CBR%20%2F%3EWSManStackVersion%3A%203.0%3CBR%20%2F%3EPSRemotingProtocolVersion%3A%202.3%3CBR%20%2F%3ESerializationVersion%3A%201.1.0.1%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlternatively%2C%20is%20there%20any%20other%20way%20to%20delegate%20access%20in%20Windows%20Virtual%20Desktop%20or%20it%20can%20only%20be%20done%20through%20PowerShell%20cmdlets%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKind%20regards%2C%3C%2FP%3E%3CP%3EMisbah%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1547301%22%20slang%3D%22en-US%22%3ERe%3A%20The%20term%20'New-AzRoleAssignment'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1547301%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722346%22%20target%3D%22_blank%22%3E%40MisabhMHasan%3C%2FA%3E%3C%2FP%3E%3CP%3EFound%20out%20from%20support%20that%2C%20'New-AzRoleAssignment'%20PowerShell%20cmdlet%20required%20to%20have%20'Az.Resources'%20module.%20Refer%20to%20the%20following%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fdocs.microsoft.com%252Fen-us%252Fpowershell%252Fmodule%252Faz.resources%252Fnew-azroleassignment%253Fview%253Dazps-4.3.0%26amp%3Bdata%3D02%257C01%257Cv-manbla%2540microsoft.com%257C967c908c21564800729108d8273728dc%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637302465153796699%26amp%3Bsdata%3Dsl7rODEDg6OleRn38WShVY6X2G2ViJ8nSusQ5Eh3hXE%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.resources%2Fnew-azroleassignment%3Fview%3Dazps-4.3.0%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInstall%20Az.Resources%20module%20using%20the%20following%20cmdlet%3A%3C%2FP%3E%3CP%3E%3CEM%3EInstall-Module%20-Name%20Az.Resources%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImport%20Az.Resources%20module%20using%20the%20following%20cmdlet%3A%3C%2FP%3E%3CP%3E%3CEM%3EImport-Module%20-Name%20Az.Resources%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKind%20regards%2C%3C%2FP%3E%3CP%3EMisbah%3C%2FP%3E%3C%2FLINGO-BODY%3E
New 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 (New 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