This document provides detailed information on the changes between AzureRM 6.x and the new Az
module, version 1.x and later. The table of contents will help guide you through a full migration
path, including module-specific changes that may affect your scripts.
There have been breaking changes between Az 1.0.0 and Az 2.0.0 as well. After following this guide
for updating from AzureRM to Az, see the Az 2.0.0 breaking changes to find out
if you need to make additional changes.
This section details the general breaking changes that are part of the redesign of the Az module.
Cmdlet Noun Prefix Changes
In the AzureRM module, cmdlets used either AzureRM or Azure as a noun prefix. Az simplifies and normalizes cmdlet names, so that all cmdlets use 'Az' as their cmdlet noun prefix. For example:
Azure PowerShell
Get-AzureRMVMGet-AzureKeyVaultSecret
Has changed to:
Azure PowerShell
Get-AzVMGet-AzKeyVaultSecret
To make the transition to these new cmdlet names simpler, Az introduces two new cmdlets, Enable-AzureRmAlias and Disable-AzureRmAlias. Enable-AzureRmAlias creates aliases for the older cmdlet names in AzureRM that map to the newer Az cmdlet names. Using the -Scope argument with Enable-AzureRmAlias allows you to choose where aliases are enabled.
Running Enable-AzureRmAlias -Scope CurrentUser will enable the aliases for all PowerShell sessions you open, so that after executing this cmdlet, a script like this would not need to be changed at all:
When you're ready to disable aliases, Disable-AzureRmAlias removes the created aliases. For complete details,
see the Disable-AzureRmAlias reference.
Важно!
When disabling aliases, make sure that they are disabled for all scopes which had aliases enabled.
Module Name Changes
The module names have changed from AzureRM.* to Az.*, except for the following modules:
AzureRM module
Az module
Azure.Storage
Az.Storage
Azure.AnalysisServices
Az.AnalysisServices
AzureRM.Profile
Az.Accounts
AzureRM.Insights
Az.Monitor
AzureRM.DataFactories
Az.DataFactory
AzureRM.DataFactoryV2
Az.DataFactory
AzureRM.RecoveryServices.Backup
Az.RecoveryServices
AzureRM.RecoveryServices.SiteRecovery
Az.RecoveryServices
AzureRM.Tags
Az.Resources
AzureRM.MachineLearningCompute
Az.MachineLearning
AzureRM.UsageAggregates
Az.Billing
AzureRM.Consumption
Az.Billing
The changes in module names mean that any script that uses #Requires or Import-Module to load specific modules will need to be changed to use the new module instead. For modules where the cmdlet suffix has not changed,
this means that although the module name has changed, the suffix indicating the operation space has not.
Migrating #Requires and Import-Module Statements
Scripts that use #Requires or Import-Module to declare a dependency on AzureRM modules must be updated to use the new module names. For example:
Azure PowerShell
#Requires -Module AzureRM.Compute
Should be changed to:
Azure PowerShell
#Requires -Module Az.Compute
For Import-Module:
Azure PowerShell
Import-Module -Name AzureRM.Compute
Should be changed to:
Azure PowerShell
Import-Module -Name Az.Compute
Migrating Fully-Qualified Cmdlet Invocations
Scripts that use module-qualified cmdlet invocations, such as:
Azure PowerShell
AzureRM.Compute\Get-AzureRmVM
Must be changed to use the new module and cmdlet names:
Azure PowerShell
Az.Compute\Get-AzVM
Migrating module manifest dependencies
Modules that express dependencies on AzureRM modules through a module manifest (.psd1) file will need to updated the module names in their RequiredModules section:
The tools for these services are no longer actively supported. Customers are encouraged to move to alternative services as soon as it is convenient.
Windows PowerShell 5.1 and .NET 4.7.2
Using Az with PowerShell 5.1 for Windows requires the installation of .NET Framework 4.7.2. Using PowerShell
Core 6.x or later does not require .NET Framework.
Temporary removal of User login using PSCredential
Due to changes in the authentication flow for .NET Standard, we are temporarily removing user login via PSCredential. This capability will be re-introduced in the 1/15/2019 release for PowerShell 5.1 for Windows. This is discussed in detail in this GitHub issue.
Default device code login instead of web browser prompt
Due to changes in the authentication flow for .NET Standard, we are using device login as the default login flow during interactive login. Web browser based login will be re-introduced for PowerShell 5.1 for Windows as the default in the 1/15/2019 release. At that time, users will be able to choose device login using a Switch parameter.
Module breaking changes
This section details specific breaking changes for individual modules and cmdlets.
Use Set-AzApiManagement cmdlet to set these properties instead
Removed the following properties:
Removed property PortalHostnameConfiguration, ProxyHostnameConfiguration, ManagementHostnameConfiguration and ScmHostnameConfiguration of type PsApiManagementHostnameConfiguration from PsApiManagementContext. Instead use PortalCustomHostnameConfiguration, ProxyCustomHostnameConfiguration, ManagementCustomHostnameConfiguration and ScmCustomHostnameConfiguration of type PsApiManagementCustomHostNameConfiguration.
Removed property StaticIPs from PsApiManagementContext. The property has been split into PublicIPAddresses and PrivateIPAddresses.
Removed required property Location from New-AzureApiManagementVirtualNetwork cmdlet.
Az.Billing (previously AzureRM.Billing, AzureRM.Consumption, and AzureRM.UsageAggregates)
The InvoiceName parameter was removed from the Get-AzConsumptionUsageDetail cmdlet. Scripts will need to use other identity parameters for the invoice.
Removed GetSkusWithAccountParamSetName parameter set from Get-AzCognitiveServicesAccountSkus cmdlet. You must get Skus by Account Type and Location, instead of using ResourceGroupName and Account Name.
Az.Compute (previously AzureRM.Compute)
IdentityIds are removed from Identity property in PSVirtualMachine and PSVirtualMachineScaleSet objects
Scripts should no longer use the value of this field to make processing decisions.
The type of InstanceView property of PSVirtualMachineScaleSetVM object is changed from VirtualMachineInstanceView to VirtualMachineScaleSetVMInstanceView
AutoOSUpgradePolicy and AutomaticOSUpgrade properties are removed from UpgradePolicy property
The type of Sku property in PSSnapshotUpdate object is changed from DiskSku to SnapshotSku
VmScaleSetVMParameterSet is removed from Add-AzVMDataDisk cmdlet, you can no longer add a data disk individually to a ScaleSet VM.
Az.DataFactory (previously AzureRM.DataFactories and AzureRM.DataFactoryV2)
The GatewayName parameter has become mandatory in the New-AzDataFactoryEncryptValue cmdlet
Removed New-AzDataFactoryGatewayKey cmdlet
Removed LinkedServiceName parameter from Get-AzDataFactoryV2ActivityRun cmdlet
Scripts should no longer use the value of this field to make processing decisions.
The following cmdlets have had the Encoding parameter changed from the type FileSystemCmdletProviderEncoding to System.Text.Encoding. This change removes the encoding values String and Oem. All the other prior encoding values remain.
New-AzureRmDataLakeStoreItem
Add-AzureRmDataLakeStoreItemContent
Get-AzureRmDataLakeStoreItemContent
Removed deprecated Tags property alias from New-AzDataLakeStoreAccount and Set-AzDataLakeStoreAccount cmdlets
Removed deprecated properties Identity, EncryptionState, EncryptionProvisioningState, EncryptionConfig, FirewallState, FirewallRules, VirtualNetworkRules, TrustedIdProviderState, TrustedIdProviders, DefaultGroup, NewTier, CurrentTier, FirewallAllowAzureIps from PSDataLakeStoreAccountBasic object. Any script that
uses the PSDatalakeStoreAccount returned from Get-AzDataLakeStoreAccount should not reference these properties.
Az.KeyVault (previously AzureRM.KeyVault)
The PurgeDisabled property was removed from the PSKeyVaultKeyAttributes, PSKeyVaultKeyIdentityItem, and PSKeyVaultSecretAttributes objects
Scripts should no longer reference the PurgeDisabled property to make processing decisions.
Az.Media (previously AzureRM.Media)
Remove deprecated Tags property alias from New-AzMediaService cmdlet
Scripts using
Az.RecoveryServices (previously AzureRM.RecoveryServices, AzureRM.RecoveryServices.Backup, and AzureRM.RecoveryServices.SiteRecovery)
Removed Encryption parameter from New/Set-AzRecoveryServicesAsrPolicy cmdlet
TargetStorageAccountName parameter is now mandatory for managed disk restores in Restore-AzRecoveryServicesBackupItem cmdlet
Removed StorageAccountName and StorageAccountResourceGroupName parameters in Restore-AzRecoveryServicesBackupItem cmdlet
Removed Nameparameter in Get-AzRecoveryServicesBackupContainer cmdlet
Az.Resources (previously AzureRM.Resources)
Removed Sku parameter from New/Set-AzPolicyAssignment cmdlet
Removed Password parameter from New-AzADServicePrincipal and New-AzADSpCredential cmdlet
Passwords are automatically generated, scripts that provided the password:
The Location parameter has become mandatory in the Get-AzStorageUsage cmdlet
The Storage API methods now use the Task-based Asynchronous Pattern (TAP), instead of synchronous API calls. The following examples demonstrate the new asynchronous commands:
Removed deprecated properties from the PSAppServicePlan, PSCertificate, PSCloningInfo, and PSSite objects
Совместная работа с нами на GitHub
Источник этого содержимого можно найти на GitHub, где также можно создавать и просматривать проблемы и запросы на вытягивание. Дополнительные сведения см. в нашем руководстве для участников.
Отзыв о Azure PowerShell
Azure PowerShell — это проект с открытым исходным кодом. Выберите ссылку, чтобы оставить отзыв:
Azure HPC — это специально разработанная облачная возможность для рабочей нагрузки HPC и ИИ, использующая современные отраслевые процессоры и обмен данными по сети InfiniBand для обеспечения максимальной производительности, масштабируемости и ценности приложений. Azure HPC позволяет реализовывать инновации, повышать продуктивность и развивать гибкость бизнеса за счет высокодоступного набора технологий HPC и ИИ с возможностью их динамического распределения в соответствии с изменением коммерческих и техническ
Общие сведения о выходе из модуля AzureRM PowerShell, включая шаги и средства для переноса скриптов Azure PowerShell из AzureRM в модуль Az PowerShell.