Breaking changes for Az 1.0.0
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.
For general advice on getting started with a migration from AzureRM to Az, see Start migration from AzureRM to Az.
Important
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.
Table of Contents
- General breaking changes
- Module breaking changes
- Az.ApiManagement (previously AzureRM.ApiManagement)
- Az.Billing (previously AzureRM.Billing, AzureRM.Consumption, and AzureRM.UsageAggregates)
- Az.CognitiveServices (previously AzureRM.CognitiveServices)
- Az.Compute (previously AzureRM.Compute)
- Az.DataFactory (previously AzureRM.DataFactories and AzureRM.DataFactoryV2)
- Az.DataLakeAnalytics (previously AzureRM.DataLakeAnalytics)
- Az.DataLakeStore (previously AzureRM.DataLakeStore)
- Az.KeyVault (previously AzureRM.KeyVault)
- Az.Media (previously AzureRM.Media)
- Az.Monitor (previously AzureRM.Insights)
- Az.Network (previously AzureRM.Network)
- Az.OperationalInsights (previously AzureRM.OperationalInsights)
- Az.RecoveryServices (previously AzureRM.RecoveryServices, AzureRM.RecoveryServices.Backup, and AzureRM.RecoveryServices.SiteRecovery)
- Az.Resources (previously AzureRM.Resources)
- Az.ServiceFabric (previously AzureRM.ServiceFabric)
- Az.Sql (previously AzureRM.Sql)
- Az.Storage (previously Azure.Storage and AzureRM.Storage)
- Az.Websites (previously AzureRM.Websites)
General breaking 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:
Get-AzureRMVM
Get-AzureKeyVaultSecret
Has changed to:
Get-AzVM
Get-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.
For example, the following script in AzureRM:
#Requires -Modules AzureRM.Storage
Get-AzureRmStorageAccount | Get-AzureStorageContainer | Get-AzureStorageBlob
Can be run with minimal changes using Enable-AzureRmAlias
:
#Requires -Modules Az.Storage
Enable-AzureRmAlias -Scope Process
Get-AzureRmStorageAccount | Get-AzureStorageContainer | Get-AzureStorageBlob
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:
Get-AzureRmStorageAccount | Get-AzureStorageContainer | Get-AzureStorageBlob
For complete details on the usage of the alias cmdlets, see the Enable-AzureRmAlias reference.
When you're ready to disable aliases, Disable-AzureRmAlias
removes the created aliases. For complete details,
see the Disable-AzureRmAlias reference.
Important
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:
#Requires -Module AzureRM.Compute
Should be changed to:
#Requires -Module Az.Compute
For Import-Module
:
Import-Module -Name AzureRM.Compute
Should be changed to:
Import-Module -Name Az.Compute
Migrating Fully-Qualified Cmdlet Invocations
Scripts that use module-qualified cmdlet invocations, such as:
AzureRM.Compute\Get-AzureRmVM
Must be changed to use the new module and cmdlet names:
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:
RequiredModules = @(@{ModuleName="AzureRM.Profile"; ModuleVersion="5.8.2"})
Must be changed to:
RequiredModules = @(@{ModuleName="Az.Profile"; ModuleVersion="1.0.0"})
Removed modules
The following modules have been removed:
AzureRM.Backup
AzureRM.Compute.ManagedService
AzureRM.Scheduler
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.
Az.ApiManagement (previously AzureRM.ApiManagement)
- Removed the following cmdlets:
- New-AzureRmApiManagementHostnameConfiguration
- Set-AzureRmApiManagementHostnames
- Update-AzureRmApiManagementDeployment
- Import-AzureRmApiManagementHostnameCertificate
- Use Set-AzApiManagement cmdlet to set these properties instead
- Removed the following properties:
- Removed property
PortalHostnameConfiguration
,ProxyHostnameConfiguration
,ManagementHostnameConfiguration
andScmHostnameConfiguration
of typePsApiManagementHostnameConfiguration
fromPsApiManagementContext
. Instead usePortalCustomHostnameConfiguration
,ProxyCustomHostnameConfiguration
,ManagementCustomHostnameConfiguration
andScmCustomHostnameConfiguration
of typePsApiManagementCustomHostNameConfiguration
. - Removed property
StaticIPs
from PsApiManagementContext. The property has been split intoPublicIPAddresses
andPrivateIPAddresses
. - Removed required property
Location
from New-AzureApiManagementVirtualNetwork cmdlet.
- Removed property
Az.Billing (previously AzureRM.Billing, AzureRM.Consumption, and AzureRM.UsageAggregates)
- The
InvoiceName
parameter was removed from theGet-AzConsumptionUsageDetail
cmdlet. Scripts will need to use other identity parameters for the invoice.
Az.CognitiveServices (previously AzureRM.CognitiveServices)
- Removed
GetSkusWithAccountParamSetName
parameter set fromGet-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 fromIdentity
property inPSVirtualMachine
andPSVirtualMachineScaleSet
objects Scripts should no longer use the value of this field to make processing decisions.- The type of
InstanceView
property ofPSVirtualMachineScaleSetVM
object is changed fromVirtualMachineInstanceView
toVirtualMachineScaleSetVMInstanceView
AutoOSUpgradePolicy
andAutomaticOSUpgrade
properties are removed fromUpgradePolicy
property- The type of
Sku
property inPSSnapshotUpdate
object is changed fromDiskSku
toSnapshotSku
VmScaleSetVMParameterSet
is removed fromAdd-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 theNew-AzDataFactoryEncryptValue
cmdlet - Removed
New-AzDataFactoryGatewayKey
cmdlet - Removed
LinkedServiceName
parameter fromGet-AzDataFactoryV2ActivityRun
cmdlet Scripts should no longer use the value of this field to make processing decisions.
Az.DataLakeAnalytics (previously AzureRM.DataLakeAnalytics)
- Removed deprecated cmdlets:
New-AzDataLakeAnalyticsCatalogSecret
,Remove-AzDataLakeAnalyticsCatalogSecret
, andSet-AzDataLakeAnalyticsCatalogSecret
Az.DataLakeStore (previously AzureRM.DataLakeStore)
The following cmdlets have had the
Encoding
parameter changed from the typeFileSystemCmdletProviderEncoding
toSystem.Text.Encoding
. This change removes the encoding valuesString
andOem
. All the other prior encoding values remain.- New-AzureRmDataLakeStoreItem
- Add-AzureRmDataLakeStoreItemContent
- Get-AzureRmDataLakeStoreItemContent
Removed deprecated
Tags
property alias fromNew-AzDataLakeStoreAccount
andSet-AzDataLakeStoreAccount
cmdletsScripts using
New-AzureRMDataLakeStoreAccount -Tags @{TagName="TagValue"}
Should be changed to
New-AzDataLakeStoreAccount -Tag @{TagName="TagValue"}
Removed deprecated properties
Identity
,EncryptionState
,EncryptionProvisioningState
,EncryptionConfig
,FirewallState
,FirewallRules
,VirtualNetworkRules
,TrustedIdProviderState
,TrustedIdProviders
,DefaultGroup
,NewTier
,CurrentTier
,FirewallAllowAzureIps
fromPSDataLakeStoreAccountBasic
object. Any script that uses thePSDatalakeStoreAccount
returned fromGet-AzDataLakeStoreAccount
should not reference these properties.
Az.KeyVault (previously AzureRM.KeyVault)
- The
PurgeDisabled
property was removed from thePSKeyVaultKeyAttributes
,PSKeyVaultKeyIdentityItem
, andPSKeyVaultSecretAttributes
objects Scripts should no longer reference thePurgeDisabled
property to make processing decisions.
Az.Media (previously AzureRM.Media)
Remove deprecated
Tags
property alias fromNew-AzMediaService
cmdlet Scripts usingNew-AzureRMMediaService -Tags @{TagName="TagValue"}
Should be changed to
New-AzMediaService -Tag @{TagName="TagValue"}
Az.Monitor (previously AzureRM.Insights)
Removed plural names
Categories
andTimegrains
parameter in favor of singular parameter names fromSet-AzDiagnosticSetting
cmdlet Scripts usingSet-AzureRmDiagnosticSetting -Timegrains PT1M -Categories Category1, Category2
Should be changed to
Set-AzDiagnosticSetting -Timegrain PT1M -Category Category1, Category2
Az.Network (previously AzureRM.Network)
- Removed deprecated
ResourceId
parameter fromGet-AzServiceEndpointPolicyDefinition
cmdlet - Removed deprecated
EnableVmProtection
property fromPSVirtualNetwork
object - Removed deprecated
Set-AzVirtualNetworkGatewayVpnClientConfig
cmdlet
Scripts should no longer make processing decisions based on the values fo these fields.
Az.OperationalInsights (previously AzureRM.OperationalInsights)
Default parameter set for
Get-AzOperationalInsightsDataSource
is removed, andByWorkspaceNameByKind
has become the default parameter setScripts that listed data sources using
Get-AzureRmOperationalInsightsDataSource
Should be changed to specify a Kind
Get-AzOperationalInsightsDataSource -Kind AzureActivityLog
Az.RecoveryServices (previously AzureRM.RecoveryServices, AzureRM.RecoveryServices.Backup, and AzureRM.RecoveryServices.SiteRecovery)
- Removed
Encryption
parameter fromNew/Set-AzRecoveryServicesAsrPolicy
cmdlet TargetStorageAccountName
parameter is now mandatory for managed disk restores inRestore-AzRecoveryServicesBackupItem
cmdlet- Removed
StorageAccountName
andStorageAccountResourceGroupName
parameters inRestore-AzRecoveryServicesBackupItem
cmdlet - Removed
Name
parameter inGet-AzRecoveryServicesBackupContainer
cmdlet
Az.Resources (previously AzureRM.Resources)
Removed
Sku
parameter fromNew/Set-AzPolicyAssignment
cmdletRemoved
Password
parameter fromNew-AzADServicePrincipal
andNew-AzADSpCredential
cmdlet Passwords are automatically generated, scripts that provided the password:New-AzAdSpCredential -ObjectId 00001111-aaaa-2222-bbbb-3333cccc4444 -Password $secPassword
Should be changed to retrieve the password from the output:
$credential = New-AzAdSpCredential -ObjectId 00001111-aaaa-2222-bbbb-3333cccc4444 $secPassword = $credential.Secret
Az.ServiceFabric (previously AzureRM.ServiceFabric)
- The following cmdlet return types have been changed:
- The property
ServiceTypeHealthPolicies
of typeApplicationHealthPolicy
has been removed. - The property
ApplicationHealthPolicies
of typeClusterUpgradeDeltaHealthPolicy
has been removed. - The property
OverrideUserUpgradePolicy
of typeClusterUpgradePolicy
has been removed. - These changes affect the following cmdlets:
- Add-AzServiceFabricClientCertificate
- Add-AzServiceFabricClusterCertificate
- Add-AzServiceFabricNode
- Add-AzServiceFabricNodeType
- Get-AzServiceFabricCluster
- Remove-AzServiceFabricClientCertificate
- Remove-AzServiceFabricClusterCertificate
- Remove-AzServiceFabricNode
- Remove-AzServiceFabricNodeType
- Remove-AzServiceFabricSetting
- Set-AzServiceFabricSetting
- Set-AzServiceFabricUpgradeType
- Update-AzServiceFabricDurability
- Update-AzServiceFabricReliability
- The property
Az.Sql (previously AzureRM.Sql)
- Removed
State
andResourceId
parameters fromSet-AzSqlDatabaseBackupLongTermRetentionPolicy
cmdlet - Removed deprecated cmdlets:
Get/Set-AzSqlServerBackupLongTermRetentionVault
,Get/Start/Stop-AzSqlServerUpgrade
,Get/Set-AzSqlDatabaseAuditingPolicy
,Get/Set-AzSqlServerAuditingPolicy
,Remove-AzSqlDatabaseAuditing
,Remove-AzSqlServerAuditing
- Removed deprecated parameter
Current
fromGet-AzSqlDatabaseBackupLongTermRetentionPolicy
cmdlet - Removed deprecated parameter
DatabaseName
fromGet-AzSqlServerServiceObjective
cmdlet - Removed deprecated parameter
PrivilegedLogin
fromSet-AzSqlDatabaseDataMaskingPolicy
cmdlet
Az.Storage (previously Azure.Storage and AzureRM.Storage)
- To support creating an Oauth storage context with only the storage account name, the default parameter set has been changed to
OAuthParameterSet
- Example:
$ctx = New-AzureStorageContext -StorageAccountName $accountName
- Example:
- The
Location
parameter has become mandatory in theGet-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:
Blob Snapshot
AzureRM:
$b = Get-AzureStorageBlob -Container $containerName -Blob $blobName -Context $ctx
$b.ICloudBlob.Snapshot()
Az:
$b = Get-AzStorageBlob -Container $containerName -Blob $blobName -Context $ctx
$task = $b.ICloudBlob.SnapshotAsync()
$task.Wait()
$snapshot = $task.Result
Share Snapshot
AzureRM:
$Share = Get-AzureStorageShare -Name $containerName -Context $ctx
$snapshot = $Share.Snapshot()
Az:
$Share = Get-AzStorageShare -Name $containerName -Context $ctx
$task = $Share.SnapshotAsync()
$task.Wait()
$snapshot = $task.Result
Undelete soft-deleted blob
AzureRM:
$b = Get-AzureStorageBlob -Container $containerName -Blob $blobName -IncludeDeleted -Context $ctx
$b.ICloudBlob.Undelete()
Az:
$b = Get-AzStorageBlob -Container $containerName -Blob $blobName -IncludeDeleted -Context $ctx
$task = $b.ICloudBlob.UndeleteAsync()
$task.Wait()
Set Blob Tier
AzureRM:
$blockBlob = Get-AzureStorageBlob -Container $containerName -Blob $blockBlobName -Context $ctx
$blockBlob.ICloudBlob.SetStandardBlobTier("hot")
$pageBlob = Get-AzureStorageBlob -Container $containerName -Blob $pageBlobName -Context $ctx
$pageBlob.ICloudBlob.SetPremiumBlobTier("P4")
Az:
$blockBlob = Get-AzStorageBlob -Container $containerName -Blob $blockBlobName -Context $ctx
$task = $blockBlob.ICloudBlob.SetStandardBlobTierAsync("hot")
$task.Wait()
$pageBlob = Get-AzStorageBlob -Container $containerName -Blob $pageBlobName -Context $ctx
$task = $pageBlob.ICloudBlob.SetPremiumBlobTierAsync("P4")
$task.Wait()
Az.Websites (previously AzureRM.Websites)
- Removed deprecated properties from the
PSAppServicePlan
,PSCertificate
,PSCloningInfo
, andPSSite
objects