Az 7.0.0 的移轉指南

Az.Accounts

內容和帳戶 Cmdlet

已變更下列 Cmdlet 的輸出:

  • Get-AzContext
  • Remove-AzContext
  • Rename-AzContext
  • Select-AzContext
  • Connect-AzAccount
  • Disconnect-AzAccount
  • Import-AzContext
  • Save-AzContext

已移除 ServicePrincipalSecretCertificatePassword in PSAzureRmAccount

之前

PS C:\> $cred = Get-Credential
PS C:\> Connect-AzAccount -ServicePrincipal -Tenant 54826b22-xxxx-xxxx-xxxx-xxxxxxxxxxxxx -Credential $cred
PS C:\> (Get-AzContext).Account.ExtendedProperties

Key                    Value
---                    -----
CertificatePath        C:\certificate.pfx
CertificatePassword    password****
Tenants                54826b22-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
ServicePrincipalSecret 7QK7Q********************************
Subscriptions          0b1f6471-xxxx-xxxx-xxxx-xxxxxxxxxxxxx

之後

PS C:\> $cred = Get-Credential
PS C:\> Connect-AzAccount -ServicePrincipal -Tenant 54826b22-xxxx-xxxx-xxxx-xxxxxxxxxxxxx -Credential $cred
PS C:\> (Get-AzContext).Account.ExtendedProperties

Key             Value
---             -----
CertificatePath C:\certificate.pfx
Tenants         54826b22-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
Subscriptions   0b1f6471-xxxx-xxxx-xxxx-xxxxxxxxxxxxx

Az.Aks

Get-AzAksVersion

輸出中的 屬性 Upgrades 已變更為 Upgrade

之前

PS C:\> (Get-AzAksVersion -location eastus).Upgrades

OrchestratorType OrchestratorVersion IsPreview
---------------- ------------------- ---------
Kubernetes       1.19.13
Kubernetes       1.20.7
Kubernetes       1.20.9
Kubernetes       1.20.7
Kubernetes       1.20.9
Kubernetes       1.20.9
Kubernetes       1.21.1
Kubernetes       1.21.2
Kubernetes       1.21.1
Kubernetes       1.21.2
Kubernetes       1.21.2
Kubernetes       1.22.1              True
Kubernetes       1.22.2              True
Kubernetes       1.22.1              True
Kubernetes       1.22.2              True
Kubernetes       1.22.2              True

之後

PS C:\> (Get-AzAksVersion -location eastus).Upgrade

OrchestratorType OrchestratorVersion IsPreview
---------------- ------------------- ---------
Kubernetes       1.19.13
Kubernetes       1.20.7
Kubernetes       1.20.9
Kubernetes       1.20.7
Kubernetes       1.20.9
Kubernetes       1.20.9
Kubernetes       1.21.1
Kubernetes       1.21.2
Kubernetes       1.21.1
Kubernetes       1.21.2
Kubernetes       1.21.2
Kubernetes       1.22.1              True
Kubernetes       1.22.2              True
Kubernetes       1.22.1              True
Kubernetes       1.22.2              True
Kubernetes       1.22.2              True

Az.ContainerInstance

New-AzContainerGroup

已移除參數 NetworkProfileId,新增 SubnetId 作為替代專案

之前

PS C:\>  $containerGroup = New-AzContainerGroup -ResourceGroupName test-rg -Name test-cg -Location eastus -Container $container -OsType Linux -NetworkProfileId "/subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"
PS C:\> $containerGroup.NetworkProfileId

/subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}

之後

PS C:\> $container = New-AzContainerInstanceObject -Name test-container -Image nginx
PS C:\> $containerGroup = New-AzContainerGroup -ResourceGroupName test-rg -Name test-cg -Location eastus -Container $container -OsType Linux -RestartPolicy "Never" -IpAddressType 'Private' -SubnetId @{"Id"="/subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}"; "Name"="subnet"}
PS C:\> $containerGroup.SubnetId | fl

Id :  /subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}
Name : subnet

Invoke-AzContainerInstanceCommand

在後端連接 websocket,以 Cmdlet 輸出方式顯示命令執行結果

之前

PS C:\> $websocket = Invoke-AzContainerInstanceCommand -ContainerGroupName test-cg -ContainerName test-container -ResourceGroupName test-rg -Command "echo hello" -TerminalSizeCol 12 -TerminalSizeRow 12
PS C:\> $websocket

Password                                           WebSocketUri
--------                                           ------------
****************** wss://bridge-linux-xx.eastus.management.azurecontainer.io/exec/caas-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/bridge-xxxxxxxxxxxxxxx?rows=12&cols=12api-version=2018-02-01-preview

User needs connect websocket using password to fetch command execution result

之後

PS C:\> Invoke-AzContainerInstanceCommand -ContainerGroupName test-cg -ContainerName test-container -ResourceGroupName test-rg -Command "echo hello"

hello

Az.Functions

Update-AzFunctionApp, Update-AzFunctionAppPlan

Update-AzFunctionApp 將會提示確認。 您可以藉由指定 -Force來略過此行為。

之前

Update-AzFunctionApp -Name MyUniqueFunctionAppName -ResourceGroupName MyResourceGroupName -PlanName NewPlanName

之後

Update-AzFunctionApp -Name MyUniqueFunctionAppName -ResourceGroupName MyResourceGroupName -PlanName NewPlanName -Force

New-AzFunctionApp

如果在 FunctionsVersion 執行 New-AzFunctionApp Cmdlet 時未指定 參數,則預設 Functions 版本會設定為 4

There is no change to the usage.

Remove-AzFunctionApp

如果這是 App Service 方案中的最後一個應用程式,則不會刪除方案。 在此版本之前,也會刪除應用程式方案。

There is no change to the usage.

Az.HDInsight

New-AzHDInsightCluster

將參數 「OSType」 的類型從 Microsoft.Azure.Management.HDInsight.Models.OSType 變更為 System.string

There is no change to the usage.

New-AzHDInsightCluster, New-AzHDInsightClusterConfig

將參數 「ClusterTier」 的類型從 Microsoft.Azure.Management.HDInsight.Models.ClusterTier 變更為 System.string

There is no change to the usage.

Set-AzHDInsightClusterDiskEncryptionKey, Set- AzHDInsightClusterSize

輸出類型已從 'Microsoft.Azure.Management.HDInsight.Models.Cluster' 變更為 'Microsoft.Azure.Commands.HDInsight.Models.AzureHDInsightCluster'。

All properties remain the same, so there is no change to the usage.

Cluster cmdlets

属性 'AssignedIdentity' 的類型已從 'Microsoft.Azure.Management.HDInsight.Models.ClusterIdentity' 變更為 'Microsoft.Azure.Commands.HDInsight.Models.AzureHDInsightClusterIdentity'。

All properties remain the same, so there is no change to the usage.

Get-AzHDInsightProperties

輸出 'property VmSizes' 的泛型類型已從 System.Collections.Generic.IDictionary2[System.String,Microsoft.Azure.Commands.HDInsight.Models.Management.AzureHDInsightVmSizesCapability] 變更為 System.Collections.Generic.IList1[System.String]

之前

PS C:\> $result = Get-AzHDInsightProperty -Location "South Central us"
PS C:\> $availableVmSizes = $result.VmSizes['iaas'].AvailableVmSizes

之後

PS C:\> $result = Get-AzHDInsightProperty -Location "South Central us"
PS C:\> $availableVmSizes = $result.VmSizes

Az.KeyVault

New-AzKeyVaultRoleDefinition, Get-AzKeyVaultRoleDefinition

模型中的下列屬性 PSKeyVaultPermission 會重新命名:

  • AllowedActions ->Actions
  • DeniedActions ->NotActions
  • AllowedDataActions ->DataActions
  • DeniedDataActions ->NotDataActions

之前

PS C:\> $backupRole = Get-AzKeyVaultRoleDefinition -HsmName myHsm -RoleDefinitionName "Managed HSM Backup User"

PS C:\> $backupRole.Permissions

AllowedActions DeniedActions AllowedDataActions DeniedDataActions
-------------- ------------- ------------------ -----------------
0 action(s)    0 action(s)   3 action(s)        0 action(s)

PS C:\> $backupRole.Permissions.AllowedDataActions

Microsoft.KeyVault/managedHsm/backup/start/action
Microsoft.KeyVault/managedHsm/backup/status/action
Microsoft.KeyVault/managedHsm/keys/backup/action

之後

PS C:\> $backupRole = Get-AzKeyVaultRoleDefinition -HsmName myHsm -RoleDefinitionName "Managed HSM Backup User"

PS C:\> $backupRole.Permissions

Actions     NotActions  DataActions NotDataActions
-------     ----------  ----------- --------------
0 action(s) 0 action(s) 3 action(s) 0 action(s)

PS C:\> $backupRole.Permissions.DataActions

Microsoft.KeyVault/managedHsm/backup/start/action
Microsoft.KeyVault/managedHsm/backup/status/action
Microsoft.KeyVault/managedHsm/keys/backup/action

Az.ManagedServices

New-AzManagedServicesDefinition

-DisplayName 移除 參數。

之前

PS C:\> New-AzManagedServicesDefinition -DisplayName "MyTestDefinition" -ManagedByTenantId 72f9acbf-86f1-41af-91ab-2d7ef011db47 -RoleDefinitionId acdd72a7-3385-48ef-bd42-f606fba81ae7 -PrincipalId 714160ec-87d5-42bb-8b17-287c0dd7417d

之後

PS C:\> $permantAuth = New-AzManagedServicesAuthorizationObject -PrincipalId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -RoleDefinitionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -PrincipalIdDisplayName "Test user" -DelegatedRoleDefinitionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
PS C:\> New-AzManagedServicesDefinition -Name xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -RegistrationDefinitionName "Test definition" -ManagedByTenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -Authorization $permantAuth -Description "Test definition desc" -Scope "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Az.Monitor

Get-AzLog

屬性 'EventName'、'Category'、'ResourceProviderName'、'OperationName'、'Status'、'SubStatus 已從 Microsoft.Azure.Management.Monitor.Models.LocalizableString 變更為 System.String

之前

PS C:\> $log = Get-AzLog -MaxRecord 1
PS C:\> $eventName = $log.EventName.LocalizedValue
PS C:\> $category = $log.Category.LocalizedValue
PS C:\> $resourceProviderName = $log.ResourceProviderName.LocalizedValue
PS C:\> $operationName = $log.OperationName.LocalizedValue
PS C:\> $status = $log.Status.LocalizedValue
PS C:\> $subStatus = $log.SubStatus.LocalizedValue

之後

PS C:\> $log = Get-AzLog -MaxRecord 1
PS C:\> $eventName = $log.EventName
PS C:\> $category = $log.Category
PS C:\> $resourceProviderName = $log.ResourceProviderName
PS C:\> $operationName = $log.OperationName
PS C:\> $status = $log.Status
PS C:\> $subStatus = $log.SubStatus

Get-AzMetric,Get-AzMetricDefinition

屬性 『Unit』 的類型已變更為 System.String

There is no change to the usage.

New-AzMetricAlertRuleV2Criteria

屬性 『TimeAggregation』 的類型已變更為 System.String

There is no change to the usage.

Az.OperationalInsights

Get-AzOperationalInsightsCluster

將預設參數集設為 「list」。

之前

There is no default parameter set.

之後

Default parameter set is now "list", when providing resource group name - return all clusters for the given resource group.

Update-AzOperationalInsightsCluster

將 「UpdateByNameParameterSet」 設為預設參數集。

之前

There is no default parameter set.

之後

Default parameter set is now "UpdateByNameParameterSet".

Az.RecoveryServices

Get-AzRecoveryServicesBackupContainer

將BackupManagementType從MARS變更為 MAB。 功能保持不變,這是為了跨 Cmdlet 帶來一致性。

之前

$containers = Get-AzRecoveryServicesBackupContainer -ContainerType Windows -BackupManagementType MARS -VaultId $vault.ID

之後

$cont = Get-AzRecoveryServicesBackupContainer -ContainerType Windows -BackupManagementType MAB -VaultId $vault.ID

Get-AzRecoveryServicesBackupItem

將BackupManagementType從MARS變更為 MAB。 功能維持不變,這是為了跨 Cmdlet 帶來一致性

之前

Get-AzRecoveryServicesBackupItem -BackupManagementType MARS -VaultId $vault.ID -WorkloadType FileFolder

之後

Get-AzRecoveryServicesBackupItem -BackupManagementType MAB -VaultId $vault.ID -WorkloadType FileFolder

Get-AzRecoveryServicesBackupJob

將BackupManagementType從MARS變更為 MAB。 功能維持不變,這是為了跨 Cmdlet 帶來一致性

之前

Get-AzRecoveryServicesBackupJob -BackupManagementType MARS -VaultId $vault.ID

之後

Get-AzRecoveryServicesBackupJob -BackupManagementType MAB -VaultId $vault.ID

Az.Resources

AzAD cmdlets

請參閱 Active Directory Cmdlet 的移轉指南

PolicyAssignment cmdlets

類型為 'Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyAssignment' 的屬性 'Identity' 類型已從 'System.Management.Automation.PSObject' 變更為 'Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyIdentity'。

之前

PS C:\> $v = Get-AzPolicyAssignment -Id $someId
PS C:\> Write-Host $v.type, $v.principalId, $v.tenantId

之後

PS C:\> $v = Get-AzPolicyAssignment -Id $someId
PS C:\> Write-Host $v.IdentityType, $v.PrincipalId, $v.TenantId, $v.UserAssignedIdentities

Az.Storage

Get-AzRmStorageShare

參數 「Name」 已從參數集 「ShareResourceId」 中移除,因為可以從資源標識碼推斷名稱。

之前

$StorageShare = Get-AzRmStorageShare -ResourceId "/subscriptions/..." -Name "MyStorageShare"

之後

$StorageShare = Get-AzRmStorageShare -ResourceId "/subscriptions/..."