您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Az 1.0.0 的中断性变更Breaking changes for Az 1.0.0

本文档详述了从 AzureRM 6.x 到新 Az 模块(1.x 及更高版本)的变更。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.

有关如何开始从 AzureRM 迁移到 Az 的常规建议,请参阅开始从 AzureRM 迁移到 AzFor general advice on getting started with a migration from AzureRM to Az, see Start migration from AzureRM to Az.

重要

从 Az 1.0.0 到 Az 2.0.0 也存在中断性变更。There have been breaking changes between Az 1.0.0 and Az 2.0.0 as well. 按照此指南从 AzureRM 更新到 Az 以后,请参阅 Az 2.0.0 中断性变更,了解是否需要进行其他更改。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

此部分详述在重新设计 Az 模块过程中所做的常规中断性变更。This section details the general breaking changes that are part of the redesign of the Az module.

Cmdlet 名词前缀更改Cmdlet Noun Prefix Changes

在 AzureRM 模块中,cmdlet 使用了 AzureRMAzure 作为名词前缀。In the AzureRM module, cmdlets used either AzureRM or Azure as a noun prefix. Az 简化并规范化了 cmdlet 名称,使所有 cmdlet 都使用“Az”作为其 cmdlet 名词前缀。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

为了更简单地转换到这些新的 cmdlet 名称,Az 引入了两个新的 cmdlet:Enable-AzureRmAliasDisable-AzureRmAliasTo make the transition to these new cmdlet names simpler, Az introduces two new cmdlets, Enable-AzureRmAlias and Disable-AzureRmAlias. Enable-AzureRmAlias 为 AzureRM 中较旧的 cmdlet 名称创建别名,这些旧名映射到较新的 Az cmdlet 名称。Enable-AzureRmAlias creates aliases for the older cmdlet names in AzureRM that map to the newer Az cmdlet names. -Scope 参数与 Enable-AzureRmAlias 配合使用即可选择在何处启用别名。Using the -Scope argument with Enable-AzureRmAlias allows you to choose where aliases are enabled.

例如,AzureRM 中的以下脚本:For example, the following script in AzureRM:

#Requires -Modules AzureRM.Storage
Get-AzureRmStorageAccount | Get-AzureStorageContainer | Get-AzureStorageBlob

可以通过使用 Enable-AzureRmAlias 进行最少的更改来运行:Can be run with minimal changes using Enable-AzureRmAlias:

#Requires -Modules Az.Storage
Enable-AzureRmAlias -Scope Process
Get-AzureRmStorageAccount | Get-AzureStorageContainer | Get-AzureStorageBlob

运行 Enable-AzureRmAlias -Scope CurrentUser 将为你打开的所有 PowerShell 会话启用别名,因此在执行此 cmdlet 后,像这样的脚本根本不需要进行更改: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

若要获得有关别名 cmdlet 用法的完整详细信息,请查看 Enable-AzureRmAlias 参考For complete details on the usage of the alias cmdlets, see the Enable-AzureRmAlias reference.

当你做好禁用别名的准备以后,Disable-AzureRmAlias 会删除创建的别名。When you're ready to disable aliases, Disable-AzureRmAlias removes the created aliases. 若要获得完整的详细信息,请查看 Disable-AzureRmAlias 参考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

模块名称已从 AzureRM.* 更改为 Az.*,但以下模块除外:The module names have changed from AzureRM.* to Az.*, except for the following modules:

AzureRM 模块AzureRM module Az 模块Az module
Azure.存储Azure.Storage Az.StorageAz.Storage
Azure.AnalysisServicesAzure.AnalysisServices Az.AnalysisServicesAz.AnalysisServices
AzureRM.ProfileAzureRM.Profile Az.AccountsAz.Accounts
AzureRM.InsightsAzureRM.Insights Az.MonitorAz.Monitor
AzureRM.DataFactoriesAzureRM.DataFactories Az.DataFactoryAz.DataFactory
AzureRM.DataFactoryV2AzureRM.DataFactoryV2 Az.DataFactoryAz.DataFactory
AzureRM.RecoveryServices.BackupAzureRM.RecoveryServices.Backup Az.RecoveryServicesAz.RecoveryServices
AzureRM.RecoveryServices.SiteRecoveryAzureRM.RecoveryServices.SiteRecovery Az.RecoveryServicesAz.RecoveryServices
AzureRM.TagsAzureRM.Tags Az.ResourcesAz.Resources
AzureRM.MachineLearningComputeAzureRM.MachineLearningCompute Az.MachineLearningAz.MachineLearning
AzureRM.UsageAggregatesAzureRM.UsageAggregates Az.BillingAz.Billing
AzureRM.ConsumptionAzureRM.Consumption Az.BillingAz.Billing

模块名称更改意味着使用 #RequiresImport-Module 来加载特定模块的任何脚本都需要更改为使用新模块。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. 对于其中的 cmdlet 后缀尚未更改的模块,这意味着,虽然模块名称已更改,但指示操作空间的后缀尚未更改。 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.

迁移 #Requires 和 Import-Module 语句Migrating #Requires and Import-Module Statements

使用 #RequiresImport-Module 来声明对 AzureRM 模块的依赖关系的脚本必须更新为使用新的模块名称。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

对于 Import-ModuleFor Import-Module:

Import-Module -Name AzureRM.Compute

应当更改为:Should be changed to:

Import-Module -Name Az.Compute

迁移完全限定的 Cmdlet 调用Migrating Fully-Qualified Cmdlet Invocations

使用模块限定的 cmdlet 调用的脚本,例如:Scripts that use module-qualified cmdlet invocations, such as:

AzureRM.Compute\Get-AzureRmVM

必须更改为使用新的模块和 cmdlet 名称:Must be changed to use the new module and cmdlet names:

Az.Compute\Get-AzVM

迁移模块清单依赖关系Migrating module manifest dependencies

通过模块清单 (.psd1) 文件表示对 AzureRM 模块的依赖关系的模块需要更新其 RequiredModules 部分中的模块名称: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 和 .NET 4.7.2Windows PowerShell 5.1 and .NET 4.7.2

将 Az 与 Windows 版 PowerShell 5.1 配合使用需要安装 .NET Framework 4.7.2。Using Az with PowerShell 5.1 for Windows requires the installation of .NET Framework 4.7.2. 使用 PowerShell Core 6.x 或更高版本不需要 .NET Framework。Using PowerShell Core 6.x or later does not require .NET Framework.

暂时删除了使用 PSCredential 的用户登录Temporary removal of User login using PSCredential

由于 .NET Standard 的身份验证流发生更改,我们暂时删除了通过 PSCredential 进行的用户登录。Due to changes in the authentication flow for .NET Standard, we are temporarily removing user login via PSCredential. 将在 2019 年 1 月 15 日的 Windows 版 PowerShell 5.1 中重新引入此功能。This capability will be re-introduced in the 1/15/2019 release for PowerShell 5.1 for Windows. 此 GitHub 问题中详细讨论了这方面的内容。This is discussed in detail in this GitHub issue.

默认设备代码登录替换了 Web 浏览器提示Default device code login instead of web browser prompt

由于 .NET Standard 的身份验证流发生更改,我们在交互式登录期间使用设备登录作为默认登录流。Due to changes in the authentication flow for .NET Standard, we are using device login as the default login flow during interactive login. 将在 2019 年 1 月 15 日的 Windows 版 PowerShell 5.1 中重新引入基于 Web 浏览器的登录作为默认登录流。Web browser based login will be re-introduced for PowerShell 5.1 for Windows as the default in the 1/15/2019 release. 到那时,用户将能够使用一个 Switch 参数来选择设备登录。At that time, users will be able to choose device login using a Switch parameter.

模块中断性变更Module breaking changes

此部分详述单个模块和 cmdlet 的具体中断性变更。This section details specific breaking changes for individual modules and cmdlets.

Az.ApiManagement(以前的 AzureRM.ApiManagement)Az.ApiManagement (previously AzureRM.ApiManagement)

  • 删除了以下 cmdlet:Removed the following cmdlets:
    • New-AzureRmApiManagementHostnameConfigurationNew-AzureRmApiManagementHostnameConfiguration
    • Set-AzureRmApiManagementHostnamesSet-AzureRmApiManagementHostnames
    • Update-AzureRmApiManagementDeploymentUpdate-AzureRmApiManagementDeployment
    • Import-AzureRmApiManagementHostnameCertificateImport-AzureRmApiManagementHostnameCertificate
    • 请改用 Set-AzApiManagement cmdlet 来设置这些属性Use Set-AzApiManagement cmdlet to set these properties instead
  • 删除了以下属性:Removed the following properties:
    • PsApiManagementContext 中删除了 PsApiManagementHostnameConfiguration 类型的属性 PortalHostnameConfigurationProxyHostnameConfigurationManagementHostnameConfigurationScmHostnameConfigurationRemoved property PortalHostnameConfiguration, ProxyHostnameConfiguration, ManagementHostnameConfiguration and ScmHostnameConfiguration of type PsApiManagementHostnameConfiguration from PsApiManagementContext. 请改用 PsApiManagementCustomHostNameConfiguration 类型的 PortalCustomHostnameConfigurationProxyCustomHostnameConfigurationManagementCustomHostnameConfigurationScmCustomHostnameConfigurationInstead use PortalCustomHostnameConfiguration, ProxyCustomHostnameConfiguration, ManagementCustomHostnameConfiguration and ScmCustomHostnameConfiguration of type PsApiManagementCustomHostNameConfiguration.
    • 从 PsApiManagementContext 中删除了属性 StaticIPsRemoved property StaticIPs from PsApiManagementContext. 此属性已拆分为 PublicIPAddressesPrivateIPAddressesThe property has been split into PublicIPAddresses and PrivateIPAddresses.
    • 从 New-AzureApiManagementVirtualNetwork cmdlet 中删除了必需属性 LocationRemoved required property Location from New-AzureApiManagementVirtualNetwork cmdlet.

Az.Billing(以前的 AzureRM.Billing、AzureRM.Consumption 和 AzureRM.UsageAggregates)Az.Billing (previously AzureRM.Billing, AzureRM.Consumption, and AzureRM.UsageAggregates)

  • Get-AzConsumptionUsageDetail cmdlet 中删除了 InvoiceName 参数。The InvoiceName parameter was removed from the Get-AzConsumptionUsageDetail cmdlet. 脚本将需要为发票使用其他标识参数。Scripts will need to use other identity parameters for the invoice.

Az.CognitiveServices(以前的 AzureRM.CognitiveServices)Az.CognitiveServices (previously AzureRM.CognitiveServices)

  • Get-AzCognitiveServicesAccountSkus cmdlet 中删除了 GetSkusWithAccountParamSetName 参数集。Removed GetSkusWithAccountParamSetName parameter set from Get-AzCognitiveServicesAccountSkus cmdlet. 必须通过帐户类型和位置来获取 SKU,而非使用资源组名称和帐户名称。You must get Skus by Account Type and Location, instead of using ResourceGroupName and Account Name.

Az.Compute(以前的 AzureRM.Compute)Az.Compute (previously AzureRM.Compute)

  • PSVirtualMachinePSVirtualMachineScaleSet 对象中的 Identity 属性中删除了 IdentityIds。脚本不应当再使用此字段的值来做出处理决策。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.
  • PSVirtualMachineScaleSetVM 对象的 InstanceView 属性的类型已从 VirtualMachineInstanceView 更改为 VirtualMachineScaleSetVMInstanceViewThe type of InstanceView property of PSVirtualMachineScaleSetVM object is changed from VirtualMachineInstanceView to VirtualMachineScaleSetVMInstanceView
  • UpgradePolicy 属性中删除了 AutoOSUpgradePolicyAutomaticOSUpgrade 属性AutoOSUpgradePolicy and AutomaticOSUpgrade properties are removed from UpgradePolicy property
  • PSSnapshotUpdate 对象中的 Sku 属性的类型已从 DiskSku 更改为 SnapshotSkuThe type of Sku property in PSSnapshotUpdate object is changed from DiskSku to SnapshotSku
  • Add-AzVMDataDisk cmdlet 中删除了 VmScaleSetVMParameterSet,不再能够单独将数据磁盘添加到规模集 VM。VmScaleSetVMParameterSet is removed from Add-AzVMDataDisk cmdlet, you cna no longer add a data disk individually to a ScaleSet VM.

Az.DataFactory(以前的 AzureRM.DataFactories 和 AzureRM.DataFactoryV2)Az.DataFactory (previously AzureRM.DataFactories and AzureRM.DataFactoryV2)

  • GatewayName 参数在 New-AzDataFactoryEncryptValue cmdlet 中已成为必需参数The GatewayName parameter has become mandatory in the New-AzDataFactoryEncryptValue cmdlet
  • 删除了 New-AzDataFactoryGatewayKey cmdletRemoved New-AzDataFactoryGatewayKey cmdlet
  • Get-AzDataFactoryV2ActivityRun cmdlet 中删除了 LinkedServiceName 参数。脚本不应当再使用此字段的值来做出处理决策。Removed LinkedServiceName parameter from Get-AzDataFactoryV2ActivityRun cmdlet Scripts should no longer use the value of this field to make processing decisions.

Az.DataLakeAnalytics(以前的 AzureRM.DataLakeAnalytics)Az.DataLakeAnalytics (previously AzureRM.DataLakeAnalytics)

  • 删除了弃用的 cmdlet:New-AzDataLakeAnalyticsCatalogSecretRemove-AzDataLakeAnalyticsCatalogSecretSet-AzDataLakeAnalyticsCatalogSecretRemoved deprecated cmdlets: New-AzDataLakeAnalyticsCatalogSecret, Remove-AzDataLakeAnalyticsCatalogSecret, and Set-AzDataLakeAnalyticsCatalogSecret

Az.DataLakeStore(以前的 AzureRM.DataLakeStore)Az.DataLakeStore (previously AzureRM.DataLakeStore)

  • 以下 cmdlet 已将 Encoding 参数的类型从 FileSystemCmdletProviderEncoding 更改为 System.Text.EncodingThe following cmdlets have had the Encoding parameter changed from the type FileSystemCmdletProviderEncoding to System.Text.Encoding. 此更改删除了编码值 StringOemThis change removes the encoding values String and Oem. 以前的所有其他编码值保留未变。All the other prior encoding values remain.

    • New-AzureRmDataLakeStoreItemNew-AzureRmDataLakeStoreItem
    • Add-AzureRmDataLakeStoreItemContentAdd-AzureRmDataLakeStoreItemContent
    • Get-AzureRmDataLakeStoreItemContentGet-AzureRmDataLakeStoreItemContent
  • New-AzDataLakeStoreAccountSet-AzDataLakeStoreAccount cmdlet 中删除了弃用的 Tags 属性别名Removed deprecated Tags property alias from New-AzDataLakeStoreAccount and Set-AzDataLakeStoreAccount cmdlets

    使用以下内容的脚本Scripts using

    New-AzureRMDataLakeStoreAccount -Tags @{TagName="TagValue"}
    

    应当更改为Should be changed to

    New-AzDataLakeStoreAccount -Tag @{TagName="TagValue"}
    
  • PSDataLakeStoreAccountBasic 对象中删除了弃用的属性 IdentityEncryptionStateEncryptionProvisioningStateEncryptionConfigFirewallStateFirewallRulesVirtualNetworkRulesTrustedIdProviderStateTrustedIdProvidersDefaultGroupNewTierCurrentTierFirewallAllowAzureIpsRemoved deprecated properties Identity, EncryptionState, EncryptionProvisioningState, EncryptionConfig, FirewallState, FirewallRules, VirtualNetworkRules, TrustedIdProviderState, TrustedIdProviders, DefaultGroup, NewTier, CurrentTier, FirewallAllowAzureIps from PSDataLakeStoreAccountBasic object. 使用从 Get-AzDataLakeStoreAccount 返回的 PSDatalakeStoreAccount 的任何脚本都不应当引用这些属性。Any script that uses the PSDatalakeStoreAccount returned from Get-AzDataLakeStoreAccount should not reference these properties.

Az.KeyVault(以前的 AzureRM.KeyVault)Az.KeyVault (previously AzureRM.KeyVault)

  • PSKeyVaultKeyAttributesPSKeyVaultKeyIdentityItemPSKeyVaultSecretAttributes 对象中删除了 PurgeDisabled 属性。脚本不再应该引用 PurgeDisabled 属性来做出处理决策。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(以前的 AzureRM.Media)Az.Media (previously AzureRM.Media)

  • New-AzMediaService cmdlet 中删除了弃用的 Tags 属性别名。使用以下内容的脚本Remove deprecated Tags property alias from New-AzMediaService cmdlet Scripts using

    New-AzureRMMediaService -Tags @{TagName="TagValue"}
    

    应当更改为Should be changed to

    New-AzMediaService -Tag @{TagName="TagValue"}
    

Az.Monitor(以前的 AzureRM.Insights)Az.Monitor (previously AzureRM.Insights)

  • Set-AzDiagnosticSetting cmdlet 中删除了复数名称 CategoriesTimegrains 参数并将其替换为单数参数名称。使用以下内容的脚本Removed plural names Categories and Timegrains parameter in favor of singular parameter names from Set-AzDiagnosticSetting cmdlet Scripts using

    Set-AzureRmDiagnosticSetting -Timegrains PT1M -Categories Category1, Category2
    

    应当更改为Should be changed to

    Set-AzDiagnosticSetting -Timegrain PT1M -Category Category1, Category2
    

Az.Network(以前的 AzureRM.Network)Az.Network (previously AzureRM.Network)

  • Get-AzServiceEndpointPolicyDefinition cmdlet 中删除了弃用的 ResourceId 参数Removed deprecated ResourceId parameter from Get-AzServiceEndpointPolicyDefinition cmdlet
  • PSVirtualNetwork 对象中删除了弃用的 EnableVmProtection 属性Removed deprecated EnableVmProtection property from PSVirtualNetwork object
  • 删除了弃用的 Set-AzVirtualNetworkGatewayVpnClientConfig cmdletRemoved deprecated Set-AzVirtualNetworkGatewayVpnClientConfig cmdlet

脚本不应当再根据这些字段的值做出处理决策。Scripts should no longer make processing decisions based on the values fo these fields.

Az.OperationalInsights(以前的 AzureRM.OperationalInsights)Az.OperationalInsights (previously AzureRM.OperationalInsights)

  • 删除了 Get-AzOperationalInsightsDataSource 的默认参数集,ByWorkspaceNameByKind 已成为默认参数集Default parameter set for Get-AzOperationalInsightsDataSource is removed, and ByWorkspaceNameByKind has become the default parameter set

    使用以下内容列出了数据源的脚本Scripts that listed data sources using

    Get-AzureRmOperationalInsightsDataSource
    

    应当更改为指定一个种类Should be changed to specify a Kind

    Get-AzOperationalInsightsDataSource -Kind AzureActivityLog
    

Az.RecoveryServices(以前的 AzureRM.RecoveryServices、AzureRM.RecoveryServices.Backup 和 AzureRM.RecoveryServices.SiteRecovery)Az.RecoveryServices (previously AzureRM.RecoveryServices, AzureRM.RecoveryServices.Backup, and AzureRM.RecoveryServices.SiteRecovery)

  • New/Set-AzRecoveryServicesAsrPolicy cmdlet 中删除了 Encryption 参数Removed Encryption parameter from New/Set-AzRecoveryServicesAsrPolicy cmdlet
  • 通过 Restore-AzRecoveryServicesBackupItem cmdlet 执行托管磁盘还原时,现在必须提供 TargetStorageAccountName 参数TargetStorageAccountName parameter is now mandatory for managed disk restores in Restore-AzRecoveryServicesBackupItem cmdlet
  • 删除了 Restore-AzRecoveryServicesBackupItem cmdlet 中的 StorageAccountNameStorageAccountResourceGroupName 参数Removed StorageAccountName and StorageAccountResourceGroupName parameters in Restore-AzRecoveryServicesBackupItem cmdlet
  • 删除了 Get-AzRecoveryServicesBackupContainer cmdlet 中的 Name 参数Removed Nameparameter in Get-AzRecoveryServicesBackupContainer cmdlet

Az.Resources(以前的 AzureRM.Resources)Az.Resources (previously AzureRM.Resources)

  • New/Set-AzPolicyAssignment cmdlet 中删除了 Sku 参数Removed Sku parameter from New/Set-AzPolicyAssignment cmdlet

  • New-AzADServicePrincipalNew-AzADSpCredential cmdlet 中删除了 Password 参数。密码将自动生成,提供了密码的脚本:Removed Password parameter from New-AzADServicePrincipal and New-AzADSpCredential cmdlet Passwords are automatically generated, scripts that provided the password:

    New-AzAdSpCredential -ObjectId 1f99cf81-0146-4f4e-beae-2007d0668476 -Password $secPassword
    

    应当更改为从输出中检索密码:Should be changed to retrieve the password from the output:

    $credential = New-AzAdSpCredential -ObjectId 1f99cf81-0146-4f4e-beae-2007d0668476
    $secPassword = $credential.Secret
    

Az.ServiceFabric(以前的 AzureRM.ServiceFabric)Az.ServiceFabric (previously AzureRM.ServiceFabric)

  • 以下 cmdlet 返回类型已更改:The following cmdlet return types have been changed:
    • ApplicationHealthPolicy 类型的属性 ServiceTypeHealthPolicies 已删除。The property ServiceTypeHealthPolicies of type ApplicationHealthPolicy has been removed.
    • ClusterUpgradeDeltaHealthPolicy 类型的属性 ApplicationHealthPolicies 已删除。The property ApplicationHealthPolicies of type ClusterUpgradeDeltaHealthPolicy has been removed.
    • ClusterUpgradePolicy 类型的属性 OverrideUserUpgradePolicy 已删除。The property OverrideUserUpgradePolicy of type ClusterUpgradePolicy has been removed.
    • 这些更改影响以下 cmdlet:These changes affect the following cmdlets:
      • Add-AzServiceFabricClientCertificateAdd-AzServiceFabricClientCertificate
      • Add-AzServiceFabricClusterCertificateAdd-AzServiceFabricClusterCertificate
      • Add-AzServiceFabricNodeAdd-AzServiceFabricNode
      • Add-AzServiceFabricNodeTypeAdd-AzServiceFabricNodeType
      • Get-AzServiceFabricClusterGet-AzServiceFabricCluster
      • Remove-AzServiceFabricClientCertificateRemove-AzServiceFabricClientCertificate
      • Remove-AzServiceFabricClusterCertificateRemove-AzServiceFabricClusterCertificate
      • Remove-AzServiceFabricNodeRemove-AzServiceFabricNode
      • Remove-AzServiceFabricNodeTypeRemove-AzServiceFabricNodeType
      • Remove-AzServiceFabricSettingRemove-AzServiceFabricSetting
      • Set-AzServiceFabricSettingSet-AzServiceFabricSetting
      • Set-AzServiceFabricUpgradeTypeSet-AzServiceFabricUpgradeType
      • Update-AzServiceFabricDurabilityUpdate-AzServiceFabricDurability
      • Update-AzServiceFabricReliabilityUpdate-AzServiceFabricReliability

Az.Sql(以前的 AzureRM.Sql)Az.Sql (previously AzureRM.Sql)

  • Set-AzSqlDatabaseBackupLongTermRetentionPolicy cmdlet 中删除了 StateResourceId 参数Removed State and ResourceId parameters from Set-AzSqlDatabaseBackupLongTermRetentionPolicy cmdlet
  • 删除了弃用的 cmdlet:Get/Set-AzSqlServerBackupLongTermRetentionVaultGet/Start/Stop-AzSqlServerUpgradeGet/Set-AzSqlDatabaseAuditingPolicyGet/Set-AzSqlServerAuditingPolicyRemove-AzSqlDatabaseAuditingRemove-AzSqlServerAuditingRemoved deprecated cmdlets: Get/Set-AzSqlServerBackupLongTermRetentionVault, Get/Start/Stop-AzSqlServerUpgrade, Get/Set-AzSqlDatabaseAuditingPolicy, Get/Set-AzSqlServerAuditingPolicy, Remove-AzSqlDatabaseAuditing, Remove-AzSqlServerAuditing
  • Get-AzSqlDatabaseBackupLongTermRetentionPolicy cmdlet 中删除了弃用的参数 CurrentRemoved deprecated parameter Current from Get-AzSqlDatabaseBackupLongTermRetentionPolicy cmdlet
  • Get-AzSqlServerServiceObjective cmdlet 中删除了弃用的参数 DatabaseNameRemoved deprecated parameter DatabaseName from Get-AzSqlServerServiceObjective cmdlet
  • Set-AzSqlDatabaseDataMaskingPolicy cmdlet 中删除了弃用的参数 PrivilegedLoginRemoved deprecated parameter PrivilegedLogin from Set-AzSqlDatabaseDataMaskingPolicy cmdlet

Az.Storage(以前的 Azure.Storage 和 AzureRM.Storage)Az.Storage (previously Azure.Storage and AzureRM.Storage)

  • 为了支持仅使用存储帐户名称创建 Oauth 存储上下文,默认参数集已更改为 OAuthParameterSetTo support creating an Oauth storage context with only the storage account name, the default parameter set has been changed to OAuthParameterSet
    • 示例: $ctx = New-AzureStorageContext -StorageAccountName $accountNameExample: $ctx = New-AzureStorageContext -StorageAccountName $accountName
  • Location 参数在 Get-AzStorageUsage cmdlet 中已成为必需参数The Location parameter has become mandatory in the Get-AzStorageUsage cmdlet
  • 存储 API 方法现在使用基于任务的异步模式 (TAP),而非使用同步 API 调用。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 快照Blob Snapshot

AzureRM:AzureRM:

$b = Get-AzureStorageBlob -Container $containerName -Blob $blobName -Context $ctx
$b.ICloudBlob.Snapshot()

Az:Az:

$b = Get-AzStorageBlob -Container $containerName -Blob $blobName -Context $ctx
$task = $b.ICloudBlob.SnapshotAsync()
$task.Wait()
$snapshot = $task.Result

共享快照Share Snapshot

AzureRM:AzureRM:

$Share = Get-AzureStorageShare -Name $containerName -Context $ctx
$snapshot = $Share.Snapshot()

Az:Az:

$Share = Get-AzStorageShare -Name $containerName -Context $ctx
$task = $Share.SnapshotAsync()
$task.Wait()
$snapshot = $task.Result

撤消删除软删除的 BlobUndelete soft-deleted blob

AzureRM:AzureRM:

$b = Get-AzureStorageBlob -Container $containerName -Blob $blobName -IncludeDeleted -Context $ctx
$b.ICloudBlob.Undelete()

Az:Az:

$b = Get-AzStorageBlob -Container $containerName -Blob $blobName -IncludeDeleted -Context $ctx
$task = $b.ICloudBlob.UndeleteAsync()
$task.Wait()

设置 Blob 层Set Blob Tier

AzureRM: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: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(以前的 AzureRM.Websites)Az.Websites (previously AzureRM.Websites)

  • PSAppServicePlanPSCertificatePSCloningInfoPSSite 对象中删除了弃用的属性Removed deprecated properties from the PSAppServicePlan, PSCertificate, PSCloningInfo, and PSSite objects