I recently uninstalled the AzureRM PowerShell module to upgrade to the AZ module. In doing so I can no longer deploy using the generated PowerShell script of Resource Group projects in Visual Studio. In this post I will explain how to upgrade your scripts to use the new AZ module.
If you attempt to run the script as is, you will get the following error.
The term 'New-AzureRmResourceGroup' 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.
Below is a mapping of the old and new Cmdlet names as they appear in the Deploy-AzureResourceGroup.ps1:
Old Name
|
New Name
|
Publish-AzureRmVMDscConfiguration
|
Publish-AzVMDscConfiguration
|
Get-AzureRmContext
|
Get-AzContext
|
Get-AzureRmStorageAccount
|
Get-AzStorageAccount
|
New-AzureRmResourceGroup
|
New-AzResourceGroup
|
New-AzureRmStorageAccount
|
New-AzStorageAccount
|
New-AzureStorageContainer
|
New-AzStorageContainer
|
Set-AzureStorageBlobContent
|
Set-AzStorageBlobContent
|
New-AzureStorageContainerSASToken
|
New-AzStorageContainerSASToken
|
Test-AzureRmResourceGroupDeployment
|
Test-AzResourceGroupDeployment
|
New-AzureRmResourceGroupDeployment
|
New-AzResourceGroupDeployment
|
Notice it is not just a global find and replace of “AzureRM” to “Az”. Some of the Cmdlets use the noun “Azure” instead of “AzureRM” for example “New-AzureStorageContainer”.
You can make all the mentioned substitutions or simply use this GitHubGist instead