Redigera

Dela via


Migration Guide for Az 6.0.0

This document describes the changes between the 5.0.0 and 6.0.0 versions of Az.

Supported versions of PowerShell

Due to CVE-2021-26701 Az 6 is only supported on the following platforms:

  • PowerShell 7.1: version 7.1.3 or above
  • PowerShell 7.0: version 7.0.6 or above
  • Windows PowerShell 5.1

For further details, refer to the Azure PowerShell support lifecycle

Az.Accounts

Connect-AzAccount

Removed obsolete parameters ManagedServiceHostName, ManagedServicePort and ManagedServiceSecret.

Before

Connect-AzAccount -Identity -ManagedServiceSecret $secret

After

#To use customized MSI endpoint, please set environment variable MSI_ENDPOINT, e.g. "http://localhost:50342/oauth2/token"; to use customized MSI secret, please set environment variable MSI_SECRET.
Connect-AzAccount -Identity

Az.ContainerInstance

New-AzContainerGroup

No longer supports the parameter Image, RegistryCredential, AzureFileVolumeShareName, AzureFileVolumeAccountCredential, AzureFileVolumeMountPath, IdentityId, AssignIdentity, OsType, Cpu, MemoryInGB, IpAddressType, DnsNameLabel, Port, Command, EnvironmentVariable, RegistryServerDomain and no alias was found for the original parameter name.

Before

PS C:\> New-AzContainerGroup -ResourceGroupName demo -Name mycontainer -Image nginx -OsType Linux -IpAddressType Public -Port @(8000)

ResourceGroupName        : demo
Id                       : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name                     : mycontainer
Type                     : Microsoft.ContainerInstance/containerGroups
Location                 : westus
Tags                     :
ProvisioningState        : Creating
Containers               : {mycontainer}
ImageRegistryCredentials :
RestartPolicy            :
IpAddress                : 13.88.10.240
Ports                    : {8000}
OsType                   : Linux
Volumes                  :
State                    : Running
Events                   : {}

After

PS C:\> $port1 = New-AzContainerInstancePortObject -Port 8000 -Protocol TCP
PS C:\> $port2 = New-AzContainerInstancePortObject -Port 8001 -Protocol TCP
PS C:\> $container = New-AzContainerInstanceObject -Name test-container -Image nginx -RequestCpu 1 -RequestMemoryInGb 1.5 -Port @($port1, $port2)
PS C:\> $containerGroup = New-AzContainerGroup -ResourceGroupName test-rg -Name test-cg -Location eastus -Container $container -OsType Linux -RestartPolicy "Never" -IpAddressType Public

Location Name    Type
-------- ----    ----
eastus   test-cg Microsoft.ContainerInstance/containerGroups

Remove-AzContainerGroup

The cmdlet 'Remove-AzContainerGroup' no longer supports the parameter 'ResourceId' and no alias was found for the original parameter name.

Before

PS C:\> Find-AzResource -ResourceGroupEquals MyResourceGroup -ResourceNameEquals MyContainer | Remove-AzContainerGroup

After

PS C:\> Remove-AzContainerGroup -Name test-cg -ResourceGroupName test-rg

Location Name    Type
-------- ----    ----
eastus   test-cg Microsoft.ContainerInstance/containerGroups

Get-AzContainerGroup

The cmdlet 'Get-AzContainerGroup' no longer supports the parameter 'ResourceId' and no alias was found for the original parameter name.

Before

PS C:\> Find-AzResource -ResourceGroupEquals demo -ResourceNameEquals mycontainer | Get-AzContainerGroup

ResourceGroupName        : demo
Id                       : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name                     : mycontainer
Type                     : Microsoft.ContainerInstance/containerGroups
Location                 : westus
Tags                     :
ProvisioningState        : Succeeded
Containers               : {mycontainer}
ImageRegistryCredentials :
RestartPolicy            :
IpAddress                : 13.88.10.240
Ports                    : {8000}
OsType                   : Linux
Volumes                  :
State                    : Running
Events                   : {}

After

PS C:\> Get-AzContainerGroup

Location Name           Type
-------- ----           ----
eastus   bez-cg1         Microsoft.ContainerInstance/containerGroups
eastus   bez-cg2        Microsoft.ContainerInstance/containerGroups

Get-AzContainerInstanceLog

The cmdlet 'Get-AzContainerInstanceLog' no longer supports the parameter 'ResourceId' and no alias was found for the original parameter name. The cmdlet 'Get-AzContainerInstanceLog' no longer supports the parameter 'Name' and no alias was found for the original parameter name.

Before

PS C:\> Get-AzContainerGroup -ResourceGroupName demo -Name mycontainer | Get-AzContainerInstanceLog

Log line 1.
Log line 2.
Log line 3.
Log line 4.

After

PS C:\> Get-AzContainerInstanceLog -ContainerGroupName test-cg -ContainerName test-container -ResourceGroupName test-rg

Az.DesktopVirtualization

New-AzWvdHostPool

The cmdlet 'New-AzWvdHostPool' no longer supports the parameter 'SsoContext' and no alias was found for the original parameter name.

Expand-AzWvdMsixImage

The cmdlet 'Expand-AzWvdMsixImage' no longer supports the type 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201102Preview.IMsixImageUri' for parameter 'MsixImageUri'.

Before

$MsixImageUri = [Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201102Preview.IMsixImageUri]::New()
Get-AzWvdDesktop -ResourceGroupName ResourceGroupName -ApplicationGroupName ApplicationGroupName -Name DesktopName | Expand-AzWvdMsixImage -MsixImageUri $MsixImageUri

After

$MsixImageUri = [Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20210201Preview.IMsixImageUri]::New()
Get-AzWvdDesktop -ResourceGroupName ResourceGroupName -ApplicationGroupName ApplicationGroupName -Name DesktopName | Expand-AzWvdMsixImage -MsixImageUri $MsixImageUri

New-AzWvdMsixPackage

The element type for parameter 'PackageApplication' has been changed from 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201102Preview.IMsixPackageApplications' to 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20210201Preview.IMsixPackageApplications'. The element type for parameter 'PackageDependency' has been changed from 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201102Preview.IMsixPackageDependencies' to 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20210201Preview.IMsixPackageDependencies'.

Before

PS C:\> $apps = @([Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201102Preview.IMsixPackageApplications]::New())
PS C:\> $deps = @([Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201102Preview.IMsixPackageDependencies]::New())
PS C:\> New-AzWvdMsixPackage -FullName PackageFullName `
							-HostPoolName HostPoolName `
							-ResourceGroupName ResourceGroupName `
							-SubscriptionId SubscriptionId `
							-DisplayName displayname `
							-ImagePath imageURI `
							-IsActive:$false `
							-IsRegularRegistration:$false `
							-LastUpdated datelastupdated `
							-PackageApplication $apps `
							-PackageDependency $deps `
							-PackageFamilyName packagefamilyname `
							-PackageName packagename `
							-PackageRelativePath packagerelativepath `
							-Version packageversion `

After

PS C:\> $apps = @([Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20210201Preview.IMsixPackageApplications]::New())
PS C:\> $deps = @([Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20210201Preview.IMsixPackageDependencies]::New())
PS C:\> New-AzWvdMsixPackage -FullName PackageFullName `
							-HostPoolName HostPoolName `
							-ResourceGroupName ResourceGroupName `
							-SubscriptionId SubscriptionId `
							-DisplayName displayname `
							-ImagePath imageURI `
							-IsActive:$false `
							-IsRegularRegistration:$false `
							-LastUpdated datelastupdated `
							-PackageApplication $apps `
							-PackageDependency $deps `
							-PackageFamilyName packagefamilyname `
							-PackageName packagename `
							-PackageRelativePath packagerelativepath `
							-Version packageversion `

Update-AzWvdHostPool

The cmdlet 'Update-AzWvdHostPool' no longer supports the parameter 'SsoContext' and no alias was found for the original parameter name.

Az.StreamAnalytics

Get-AzStreamAnalyticsDefaultFunctionDefinition

The cmdlet 'Get-AzStreamAnalyticsDefaultFunctionDefinition' no longer supports the parameter 'File' and no alias was found for the original parameter name.

Before

Get-AzStreamAnalyticsDefaultFunctionDefinition -ResourceGroupName "StreamAnalytics-Default-West-US" -JobName "StreamJob22" -File "C:\RetrieveDefaultDefinitionRequest.json" -Name "ScoreTweet"

After

Get-AzStreamAnalyticsDefaultFunctionDefinition -ResourceGroupName azure-rg-test -JobName sajob-01-pwsh -Name mlsfunction-01 -BindingType Microsoft.MachineLearningServices -Endpoint "http://875da830-4d5f-44f1-b221-718a5f26a21d.eastus.azurecontainer.io/score"-UdfType Scalar
Input is specified in flattened parameters instead from the input file.

New-AzStreamAnalyticsJob

The cmdlet 'New-AzStreamAnalyticsJob' no longer supports the parameter 'File' and no alias was found for the original parameter name.

Before

New-AzStreamAnalyticsJob -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:\JobDefinition.json"

After

New-AzStreamAnalyticsJob -ResourceGroupName azure-rg-test -Name sajob-02-pwsh -Location westcentralus -SkuName Standard
Input is specified in flattened parameters instead from the input file.

New-AzStreamAnalyticsTransformation

The cmdlet 'New-AzStreamAnalyticsTransformation' no longer supports the parameter 'File' and no alias was found for the original parameter name.

Before

New-AzStreamAnalyticsTransformation -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:\Transformation.json" -JobName "StreamingJob" -Name "StreamingJobTransform"

After

New-AzStreamAnalyticsTransformation -ResourceGroupName azure-rg-test -JobName sajob-01-pwsh -Name tranf-01 -StreamingUnit 6 -Query "Select Id, Name from input-01"
Input is specified in flattened parameters instead from the input file.

Az.RecoveryServices

Set-AzRecoveryServicesBackupProperty

Removed Set-AzRecoveryServicesBackupProperties plural alias, use Set-AzRecoveryServicesBackupProperty cmdlet name going forward

Get-AzRecoveryServicesBackupJobDetail

Removed Get-AzRecoveryServicesBackupJobDetails plural alias, use Get-AzRecoveryServicesBackupJobDetail cmdlet name going forward

Before

$jobDetails = Get-AzRecoveryServicesBackupJobDetails -VaultId $vault.ID -Job $job
$jobDetails2 = Get-AzRecoveryServicesBackupJobDetails -VaultId $vault.ID -JobId $job.JobId

After

$jobDetails = Get-AzRecoveryServicesBackupJobDetail -VaultId $vault.ID -Job $job
$jobDetails2 = Get-AzRecoveryServicesBackupJobDetail -VaultId $vault.ID -JobId $job.JobId

Az.Storage

Remove-AzRmStorageShare

The cmdlet 'Remove-AzRmStorageShare' can remove share with snapshots by default before; but after the change remove share with snapshots will fail by default, need add parameter "-Include Snapshots" to make remove success.

Before

Remove-AzRmStorageShare -ResourceGroupName $resourceGroupName -StorageAccountName $accountName -Name $shareName

After

Remove-AzRmStorageShare -ResourceGroupName $resourceGroupName -StorageAccountName $accountName -Name $shareName -Force -Include Snapshots

Az.ServiceFabric

Add-AzServiceFabricClusterCertificate

this cmdlet has been removed completely. please follow instructions here to add cluster certificates.

Get-AzServiceFabricManagedClusterService

Change PSManagedService model to avoid using the properties parameter directly from sdk. Now all the properties are in the first level of the object. And remove deprecated parameters InstanceCloseDelayDuration, DropSourceReplicaOnMove and ServiceDnsName

Before

$service = Get-AzServiceFabricManagedClusterService -ResourceId $resourceId
$statelessService.Properties.ProvisioningState

After

$service = Get-AzServiceFabricManagedClusterService -ResourceId $resourceId
$statelessService.ProvisioningState

New-AzServiceFabricManagedCluster

Remove deprecated parameter ReverseProxyEndpointPort.

New-AzServiceFabricManagedClusterService

Change PSManagedService model to avoid using the properties parameter directly from sdk. Now all the properties are in the first level of the object. And remove deprecated parameters InstanceCloseDelayDuration, DropSourceReplicaOnMove and ServiceDnsName

Before

$service = New-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $serviceName -Type $serviceTypeName -Stateless -InstanceCount -1 -PartitionSchemaSingleton
$statelessService.Properties.ProvisioningState

After

$service = New-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $serviceName -Type $serviceTypeName -Stateless -InstanceCount -1 -PartitionSchemaSingleton
$statelessService.ProvisioningState

Remove-AzServiceFabricClusterCertificate

this cmdlet has been removed completely. please follow instructions here to add cluster certificates.

Remove-AzServiceFabricManagedClusterService

Change PSManagedService model to avoid using the properties parameter directly from sdk. Now all the properties are in the first level of the object.

Set-AzServiceFabricManagedCluster

Remove deprecated parameter ReverseProxyEndpointPort.

Set-AzServiceFabricManagedClusterService

Change PSManagedService model to avoid using the properties parameter directly from sdk. Now all the properties are in the first level of the object. And remove deprecated parameters InstanceCloseDelayDuration, DropSourceReplicaOnMove and ServiceDnsName

Before

$service = Get-AzServiceFabricManagedClusterService -ResourceId $resourceId
$statelessService.Properties.MinInstanceCount = 3
service | Set-AzServiceFabricManagedClusterService

After

$service = Get-AzServiceFabricManagedClusterService -ResourceId $resourceId
$statelessService.MinInstanceCount = 3
service | Set-AzServiceFabricManagedClusterService