Bearbeiten

Freigeben über


Migration Guide for Az 2.0.0

This document describes the changes between the 1.0.0 and 2.0.0 versions of Az

Table of Contents

Module breaking changes

Az.Compute

  • Removed Managed Parameter from New-AzAvailabilitySet and Update-AzAvailabilitySet cmdlets in favor of using Sku = Aligned

    Before

    Update-AzAvailabilitySet -Managed
    

    After

    Update-AzAvailabilitySet -Sku Aligned
    
  • For consistency, removed Image parameter from 'ByName' and 'ByResourceId' parameter sets in Update-AzImage

    Before

    Note that the below code is functional, but the passed-in ImageName is not used, so removing this parameter has no functional impact.

    Update-AzImage -ResourceGroupName $Rg -ImageName $Name -Image $Image -Tag $tags
    
    Update-AzImage -ResourceId $Id -Image $Image -Tag $tags
    

    After

    Update-AzImage -ResourceGroupName $Rg -ImageName $Name -Tag $tags
    
    Update-AzImage -ResourceId $Id -Tag $tags
    
  • For consistency, removed Name parameter from 'ByObject' and 'ByResourceId' parameter sets in Restart-AzVM

    Before

    Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact.

    Restart-AzVM -InputObject $VM -Name $Name
    
    Restart-AzVM -ResourceId $Id -Name $Name
    

    After

    Restart-AzVM -InputObject $VM
    
    Restart-AzVM -ResourceId $Id
    
  • For consistency, removed Name parameter from 'ByObject' and 'ByResourceId' parameter sets in Start-AzVM

    Before

    Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact.

    Start-AzVM -InputObject $VM -Name $Name
    
    Start-AzVM -ResourceId $Id -Name $Name
    

    After

    Start-AzVM -InputObject $VM
    
    Start-AzVM -ResourceId $Id
    
  • For consistency, removed Name parameter from 'ByObject' and 'ByResourceId' parameter sets in Stop-AzVM

    Before

    Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact.

    Stop-AzVM -InputObject $VM -Name $Name
    
    Stop-AzVM -ResourceId $Id -Name $Name
    

    After

    Stop-AzVM -InputObject $VM
    
    Stop-AzVM -ResourceId $Id
    
  • For consistency, removed Name parameter from 'ByObject' and 'ByResourceId' parameter sets in Remove-AzVM

    Before

    Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact.

    Remove-AzVM -InputObject $VM -Name $Name
    
    Remove-AzVM -ResourceId $Id -Name $Name
    

    After

    Remove-AzVM -InputObject $VM
    
    Remove-AzVM -ResourceId $Id
    
  • For consistency, removed Name parameter from 'ByObject' and 'ByResourceId' parameter sets in Set-AzVM

    Before

    Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact.

    Set-AzVM -InputObject $VM -Name $Name ...
    
    Set-AzVM -ResourceId $Id -Name $Name ...
    

    After

    Set-AzVM -InputObject $VM ...
    
    Set-AzVM -ResourceId $Id ...
    
  • For consistency, removed Name parameter from 'ByObject' and 'ByResourceId' parameter sets in Save-AzVMImage

    Before

    Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact.

    Save-AzVMImage -InputObject $VM -Name $Name ...
    
    Save-AzVMImage -ResourceId $Id -Name $Name ...
    

    After

    Save-AzVMImage -InputObject $VM ...
    
    Save-AzVMImage -ResourceId $Id ...
    
  • Added ProtectionPolicy property to encapsulate ProtectFromScaleIn property in PSVirtualMachineScaleSetVM

    Before

    $vmss = Get-AzVMssVM ...
    $vmss.ProtectFromScaleIn = $true
    
    $vmss = Update-AzVMssVM ...
    $vmss.ProtectFromScaleIn = $true
    
    $vmss = Remove-AzVMssVMDataDisk ...
    $vmss.ProtectFromScaleIn = $true
    

    After

    $vmss = Get-AzVMssVM ...
    $vmss.ProtectionPolicy.ProtectFromScaleIn = $true
    
    $vmss = Update-AzVMssVM ...
    $vmss.ProtectionPolicy.ProtectFromScaleIn = $true
    
    $vmss = Remove-AzVMssVMDataDisk ...
    $vmss.ProtectionPolicy.ProtectFromScaleIn = $true
    
    
  • Added EncryptionSettingsCollection Property to enclose EncryptionSettings property in PSDisk

    Before

    $disk = New-AzDisk ... | Set-AzDiskDiskEncrytionKey ...
    $disk.EncryptionSettings
    
    $disk = New-AzDisk ... | Set-AzDiskKeyEncrytionKey ...
    $disk.EncryptionSettings
    
    $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateDiskEncryptionKey ...
    $update.EncryptionSettings
    
    $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateKeyEncryptionKey ...
    $update.EncryptionSettings
    

    After

    $disk = New-AzDisk ... | Set-AzDiskDiskEncrytionKey ...
    $disk.EncryptionSettingsCollection.EncryptionSettings
    
    $disk = New-AzDisk ... | Set-AzDiskKeyEncrytionKey ...
    $disk.EncryptionSettingsCollection.EncryptionSettings
    
    $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateDiskEncryptionKey ...
    $update.EncryptionSettingsCollection.EncryptionSettings
    
    $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateKeyEncryptionKey ...
    $update.EncryptionSettingsCollection.EncryptionSettings
    
  • Added EncryptionSettingsCollection Property to enclose EncryptionSettings property in PSSnapshot

    Before

    $snap = New-AzSnapshotConfig ... | Set-AzSnapshotDiskEncryptionKey ...
    $snap.EncryptionSettings
    
    $snap = New-AzSnapshotConfig ... | Set-AzSnapshotKeyEncryptionKey ...
    $snap.EncryptionSettings
    
    $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateDiskEncryptionKey ...
    $update.EncryptionSettings
    
    $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateKeyEncryptionKey ...
    $update.EncryptionSettings
    

    After

    $snap = New-AzSnapshotConfig ... | Set-AzSnapshotDiskEncryptionKey ...
    $snap.EncryptionSettingsCollection.EncryptionSettings
    
    $snap = New-AzSnapshotConfig ... | Set-AzSnapshotKeyEncryptionKey ...
    $snap.EncryptionSettingsCollection.EncryptionSettings
    
    $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateDiskEncryptionKey ...
    $update.EncryptionSettingsCollection.EncryptionSettings
    
    $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateKeyEncryptionKey ...
    $update.EncryptionSettingsCollection.EncryptionSettings
    
  • Removed VirtualMachineProfile property from PSVirtualMachineScaleSet

    Before

    $vmss = New-AzVMSSConfig ...
    $vmss.VirtualMachineProfile.AdditionalCapabilities.UltraSSDEnabled = $true
    

    After

    $vmss = New-AzVMSSConfig ...
    $vmss.AdditionalCapabilities.UltraSSDEnabled = $true
    
  • Cmdlet Set-AzVMBootDiagnostic removed alias to Set-AzVMBootDiagnostics

    Before

    Using deprecated alias

    Set-AzVMBootDiagnostics
    

    After

    Set-AzVMBootDIagnostic
    
  • Cmdlet Export-AzLogAnalyticThrottledRequest removed alias to Export-AzLogAnalyticThrottledRequests

    Before

    Using deprectaed alias

    Export-AzLogAnalyticThrottledRequests
    

    After

    Export-AzLogAnalyticThrottledRequest
    

Az.HDInsight

  • Removed the Grant-AzHDInsightHttpServicesAccess and Revoke-AzHDInsightHttpServicesAccess cmdlets. These are no longer necessary because HTTP access is always enabled on all HDInsight clusters.
  • Added a new Set-AzHDInsightGatewayCredential cmdlet. Use this cmdlet to change the gateway HTTP username and password (replaces Grant-AzHDInsightHttpServicesAccess).
  • Updated the Get-AzHDInsightJobOutput cmdlet to support granular role-based access to the storage key.
    • Users with HDInsight Cluster Operator, Contributor, or Owner roles will not be affected.
    • Users with only the Reader role will need to specify DefaultStorageAccountKey parameter explicitly.

For more information about these role-based access changes, see aka.ms/hdi-config-update

Before

Grant-AzHDInsightHttpServicesAccess -ClusterName $cluster -HttpCredential $credential

After

Set-AzHDInsightGatewayCredential -ClusterName $cluster -HttpCredential $credential

Users with only Reader role for cmdlet Get-AzHDInsightJobOutput

Before

Get-AzHDInsightJobOutput  -ClusterName $clusterName -JobId $jobId

After

Get-AzHDInsightJobOutput  -ClusterName $clusterName -JobId $jobId -DefaultStorageAccountKey $storageAccountKey

Az.Storage

  • Namespaces for types returned from Blob, Queue, and File cmdlets have changed their namespace from Microsoft.WindowsAzure.Storage to Microsoft.Azure.Storage. While this is not technically a breaking change according to the breaking change policy, it may require some changes in code that uses the methods from the Storage .Net SDK to interact with the objects returned from these cmdlets.

    Example 1: Add a message to a Queue (change CloudQueueMessage object namespace)

    Before:

    $queue = Get-AzStorageQueue –Name $queueName –Context $ctx
    $queueMessage = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)" -ArgumentList "This is message 1"
    $queue.CloudQueue.AddMessageAsync($QueueMessage)
    

    After:

    $queue = Get-AzStorageQueue –Name $queueName –Context $ctx
    $queueMessage = New-Object -TypeName "Microsoft.Azure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)"  -ArgumentList "This is message 1"
    $queue.CloudQueue.AddMessageAsync($QueueMessage)
    

    Example 2: Fetch Blob/File Attributes with AccessCondition (change AccessCondition object namespace)

    Before:

    $accessCondition= New-Object Microsoft.WindowsAzure.Storage.AccessCondition
    
    $blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName
    $blob.ICloudBlob.FetchAttributes($accessCondition)
    
    $file = Get-AzureStorageFile -ShareName $shareName -Path $filepath
    $file.FetchAttributes($accessCondition)
    

    After:

    $accessCondition= New-Object Microsoft.Azure.Storage.AccessCondition
    
    $blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName
    $blob.ICloudBlob.FetchAttributes($accessCondition)
    
    $file = Get-AzureStorageFile -ShareName $shareName -Path $filepath
    $file.FetchAttributes($accessCondition)
    
  • While not technically a breaking change, you will notice output differences in the Sku.Name property of Storage Accounts returned from New/Get/Set-AzStorageAccount changes are as follows. (After the change, output and input SkuName are aligned.)

    • "StandardLRS" -> "Standard_LRS";
    • "StandardGRS" -> "Standard_GRS";
    • "StandardRAGRS" -> "Standard_RAGRS";
    • "StandardZRS" -> "Standard_ZRS";
    • "PremiumLRS" -> "Premium_LRS";
  • The default service behavior when creating a storage account withous specifying a Kind has changed. In previous versions, when a storage account was created with no Kind specified, the Storage account Kind of Storage was used, in the new version StorageV2 is the default Kind value. If you need to create a V1 Storage account with Kind 'Storage', add parameter '-Kind Storage'

    Example : Create a storage Account (Default Kind change)

    Before:

    PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus"
    
    StorageAccountName ResourceGroupName Location SkuName     Kind      AccessTier CreationTime          ProvisioningState EnableHttpsTrafficOnly
    ------------------ ----------------- -------- -------     ----      ---------- ------------          ----------------- ----------------------
    accountname        groupname         westus   StandardLRS Storage   Hot        4/17/2018 10:34:32 AM Succeeded         False
    

    After:

    PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus"
    
    StorageAccountName ResourceGroupName Location SkuName      Kind      AccessTier CreationTime          ProvisioningState EnableHttpsTrafficOnly
    ------------------ ----------------- -------- -------      ----      ----------  ------------          ----------------- ----------------------
    accountname        groupname         westus   Standard_LRS StorageV2 Hot        4/17/2018 10:34:32 AM Succeeded         False