|
| 1 | +# Migration Guide for Az 2.0.0 |
| 2 | + |
| 3 | +This document describes the changes between the 1.0.0 and 2.0.0 versions of Az |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | +- [Module breaking changes](#module-breaking-changes) |
| 7 | + - [Az.Compute](#azcompute) |
| 8 | + - [Az.HDInsight](#azhdinsight) |
| 9 | + - [Az.Storage](#azstorage) |
| 10 | + |
| 11 | +## Module breaking changes |
| 12 | + |
| 13 | +### Az.Compute |
| 14 | +- Removed `Managed` Parameter from `New-AzAvailabilitySet` and `Update-AzAvailabilitySet` cmdlets in favor of using ```Sku = Aligned``` |
| 15 | + #### Before |
| 16 | + ```powershell |
| 17 | + Update-AzAvailabilitySet -Managed |
| 18 | + ``` |
| 19 | + #### After |
| 20 | + ```powershell |
| 21 | + Update-AzAvailabilitySet -Sku Aligned |
| 22 | + ``` |
| 23 | +- For consistency, removed `Image` parameter from 'ByName' and 'ByResourceId' parameter sets in `Update-AzImage` |
| 24 | + |
| 25 | + #### Before |
| 26 | + Note that the below code is functional, but the passed-in ImageName is not used, so removing this parameter has no functional impact. |
| 27 | + ```powershell |
| 28 | + Update-AzImage -ResourceGroupName $Rg -ImageName $Name -Image $Image -Tag $tags |
| 29 | +
|
| 30 | + Update-AzImage -ResourceId $Id -Image $Image -Tag $tags |
| 31 | + ``` |
| 32 | + |
| 33 | + #### After |
| 34 | + ```powershell |
| 35 | + Update-AzImage -ResourceGroupName $Rg -ImageName $Name -Tag $tags |
| 36 | +
|
| 37 | + Update-AzImage -ResourceId $Id -Tag $tags |
| 38 | + ``` |
| 39 | +- For consistency, removed `Name` parameter from 'ByObject' and 'ByResourceId' parameter sets in `Restart-AzVM` |
| 40 | + |
| 41 | + #### Before |
| 42 | + Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact. |
| 43 | + ```powershell |
| 44 | + Restart-AzVM -InputObject $VM -Name $Name |
| 45 | +
|
| 46 | + Restart-AzVM -ResourceId $Id -Name $Name |
| 47 | + ``` |
| 48 | + |
| 49 | + #### After |
| 50 | + ```powershell |
| 51 | + Restart-AzVM -InputObject $VM |
| 52 | +
|
| 53 | + Restart-AzVM -ResourceId $Id |
| 54 | + ``` |
| 55 | + |
| 56 | +- For consistency, removed `Name` parameter from 'ByObject' and 'ByResourceId' parameter sets in `Start-AzVM` |
| 57 | + |
| 58 | + #### Before |
| 59 | + Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact. |
| 60 | + ```powershell |
| 61 | + Start-AzVM -InputObject $VM -Name $Name |
| 62 | +
|
| 63 | + Start-AzVM -ResourceId $Id -Name $Name |
| 64 | + ``` |
| 65 | + |
| 66 | + #### After |
| 67 | + ```powershell |
| 68 | + Start-AzVM -InputObject $VM |
| 69 | +
|
| 70 | + Start-AzVM -ResourceId $Id |
| 71 | + ``` |
| 72 | + |
| 73 | +- For consistency, removed `Name` parameter from 'ByObject' and 'ByResourceId' parameter sets in `Stop-AzVM` |
| 74 | + |
| 75 | + #### Before |
| 76 | + Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact. |
| 77 | + ```powershell |
| 78 | + Stop-AzVM -InputObject $VM -Name $Name |
| 79 | +
|
| 80 | + Stop-AzVM -ResourceId $Id -Name $Name |
| 81 | + ``` |
| 82 | + |
| 83 | + #### After |
| 84 | + ```powershell |
| 85 | + Stop-AzVM -InputObject $VM |
| 86 | +
|
| 87 | + Stop-AzVM -ResourceId $Id |
| 88 | + ``` |
| 89 | +- For consistency, removed `Name` parameter from 'ByObject' and 'ByResourceId' parameter sets in `Remove-AzVM` |
| 90 | + |
| 91 | + #### Before |
| 92 | + Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact. |
| 93 | + ```powershell |
| 94 | + Remove-AzVM -InputObject $VM -Name $Name |
| 95 | +
|
| 96 | + Remove-AzVM -ResourceId $Id -Name $Name |
| 97 | + ``` |
| 98 | + |
| 99 | + #### After |
| 100 | + ```powershell |
| 101 | + Remove-AzVM -InputObject $VM |
| 102 | +
|
| 103 | + Remove-AzVM -ResourceId $Id |
| 104 | + ``` |
| 105 | + |
| 106 | +- For consistency, removed `Name` parameter from 'ByObject' and 'ByResourceId' parameter sets in `Set-AzVM` |
| 107 | + |
| 108 | + #### Before |
| 109 | + Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact. |
| 110 | + ```powershell |
| 111 | + Set-AzVM -InputObject $VM -Name $Name ... |
| 112 | +
|
| 113 | + Set-AzVM -ResourceId $Id -Name $Name ... |
| 114 | + ``` |
| 115 | + |
| 116 | + #### After |
| 117 | + ```powershell |
| 118 | + Set-AzVM -InputObject $VM ... |
| 119 | +
|
| 120 | + Set-AzVM -ResourceId $Id ... |
| 121 | + ``` |
| 122 | + |
| 123 | +- For consistency, removed `Name` parameter from 'ByObject' and 'ByResourceId' parameter sets in `Save-AzVMImage` |
| 124 | + |
| 125 | + #### Before |
| 126 | + Note that the below code is functional, but the passed-in Name is not used, so removing this parameter has no functional impact. |
| 127 | + ```powershell |
| 128 | + Save-AzVMImage -InputObject $VM -Name $Name ... |
| 129 | +
|
| 130 | + Save-AzVMImage -ResourceId $Id -Name $Name ... |
| 131 | + ``` |
| 132 | + #### After |
| 133 | + ```powershell |
| 134 | + Save-AzVMImage -InputObject $VM ... |
| 135 | +
|
| 136 | + Save-AzVMImage -ResourceId $Id ... |
| 137 | + ``` |
| 138 | + |
| 139 | +- Added ProtectionPolicy property to encapsulate `ProtectFromScaleIn` property in `PSVirtualMachineScaleSetVM` |
| 140 | + #### Before |
| 141 | + ```powershell |
| 142 | + $vmss = Get-AzVMssVM ... |
| 143 | + $vmss.ProtectFromScaleIn = $true |
| 144 | +
|
| 145 | + $vmss = Update-AzVMssVM ... |
| 146 | + $vmss.ProtectFromScaleIn = $true |
| 147 | +
|
| 148 | + $vmss = Remove-AzVMssVMDataDisk ... |
| 149 | + $vmss.ProtectFromScaleIn = $true |
| 150 | + ``` |
| 151 | + #### After |
| 152 | + ```powershell |
| 153 | + $vmss = Get-AzVMssVM ... |
| 154 | + $vmss.ProtectionPolicy.ProtectFromScaleIn = $true |
| 155 | +
|
| 156 | + $vmss = Update-AzVMssVM ... |
| 157 | + $vmss.ProtectionPolicy.ProtectFromScaleIn = $true |
| 158 | +
|
| 159 | + $vmss = Remove-AzVMssVMDataDisk ... |
| 160 | + $vmss.ProtectionPolicy.ProtectFromScaleIn = $true |
| 161 | +
|
| 162 | + ``` |
| 163 | +- Added ```EncryptionSettingsCollection``` Property to enclose `EncryptionSettings` property in `PSDisk` |
| 164 | + #### Before |
| 165 | + ```powershell |
| 166 | + $disk = New-AzDisk ... | Set-AzDiskDiskEncrytionKey ... |
| 167 | + $disk.EncryptionSettings |
| 168 | +
|
| 169 | + $disk = New-AzDisk ... | Set-AzDiskKeyEncrytionKey ... |
| 170 | + $disk.EncryptionSettings |
| 171 | +
|
| 172 | + $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateDiskEncryptionKey ... |
| 173 | + $update.EncryptionSettings |
| 174 | +
|
| 175 | + $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateKeyEncryptionKey ... |
| 176 | + $update.EncryptionSettings |
| 177 | + ``` |
| 178 | + #### After |
| 179 | + ```powershell |
| 180 | + $disk = New-AzDisk ... | Set-AzDiskDiskEncrytionKey ... |
| 181 | + $disk.EncryptionSettingsCollection.EncryptionSettings |
| 182 | +
|
| 183 | + $disk = New-AzDisk ... | Set-AzDiskKeyEncrytionKey ... |
| 184 | + $disk.EncryptionSettingsCollection.EncryptionSettings |
| 185 | +
|
| 186 | + $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateDiskEncryptionKey ... |
| 187 | + $update.EncryptionSettingsCollection.EncryptionSettings |
| 188 | +
|
| 189 | + $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateKeyEncryptionKey ... |
| 190 | + $update.EncryptionSettingsCollection.EncryptionSettings |
| 191 | + ``` |
| 192 | +- Added ```EncryptionSettingsCollection``` Property to enclose `EncryptionSettings` property in `PSSnapshot` |
| 193 | + #### Before |
| 194 | + ```powershell |
| 195 | + $snap = New-AzSnapshotConfig ... | Set-AzSnapshotDiskEncryptionKey ... |
| 196 | + $snap.EncryptionSettings |
| 197 | +
|
| 198 | + $snap = New-AzSnapshotConfig ... | Set-AzSnapshotKeyEncryptionKey ... |
| 199 | + $snap.EncryptionSettings |
| 200 | +
|
| 201 | + $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateDiskEncryptionKey ... |
| 202 | + $update.EncryptionSettings |
| 203 | +
|
| 204 | + $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateKeyEncryptionKey ... |
| 205 | + $update.EncryptionSettings |
| 206 | + ``` |
| 207 | + #### After |
| 208 | + ```powershell |
| 209 | + $snap = New-AzSnapshotConfig ... | Set-AzSnapshotDiskEncryptionKey ... |
| 210 | + $snap.EncryptionSettingsCollection.EncryptionSettings |
| 211 | +
|
| 212 | + $snap = New-AzSnapshotConfig ... | Set-AzSnapshotKeyEncryptionKey ... |
| 213 | + $snap.EncryptionSettingsCollection.EncryptionSettings |
| 214 | +
|
| 215 | + $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateDiskEncryptionKey ... |
| 216 | + $update.EncryptionSettingsCollection.EncryptionSettings |
| 217 | +
|
| 218 | + $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateKeyEncryptionKey ... |
| 219 | + $update.EncryptionSettingsCollection.EncryptionSettings |
| 220 | + ``` |
| 221 | +- Removed `VirtualMachineProfile` property from `PSVirtualMachineScaleSet` |
| 222 | + #### Before |
| 223 | + ```powershell |
| 224 | + $vmss = New-AzVMSSConfig ... |
| 225 | + $vmss.VirtualMachineProfile.AdditionalCapabilities.UltraSSDEnabled = $true |
| 226 | + ``` |
| 227 | + #### After |
| 228 | + ```powershell |
| 229 | + $vmss = New-AzVMSSConfig ... |
| 230 | + $vmss.AdditionalCapabilities.UltraSSDEnabled = $true |
| 231 | + ``` |
| 232 | +- Cmdlet `Set-AzVMBootDiagnostic` removed alias to `Set-AzVMBootDiagnostics` |
| 233 | + #### Before |
| 234 | + Using deprecated alias |
| 235 | + ```powershell |
| 236 | + Set-AzVMBootDiagnostics |
| 237 | + ``` |
| 238 | + #### After |
| 239 | + ```powershell |
| 240 | + Set-AzVMBootDIagnostic |
| 241 | + ``` |
| 242 | +- Cmdlet `Export-AzLogAnalyticThrottledRequest` removed alias to `Export-AzLogAnalyticThrottledRequests` |
| 243 | + #### Before |
| 244 | + Using deprectaed alias |
| 245 | + ```powershell |
| 246 | + Export-AzLogAnalyticThrottledRequests |
| 247 | + ``` |
| 248 | + #### After |
| 249 | + ```powershell |
| 250 | + Export-AzLogAnalyticThrottledRequest |
| 251 | + ``` |
| 252 | + |
| 253 | +### Az.HDInsight |
| 254 | +- Removed cmdlet `Grant-AzHDInsightHttpServicesAccess` and replaced with `Set-AzHDInsightGatewayCredential` |
| 255 | + #### Before |
| 256 | + ```powershell |
| 257 | + Grant-AzHDInsightHttpServicesAccess ... |
| 258 | + ``` |
| 259 | + #### After |
| 260 | + ```powershell |
| 261 | + Set-AzHDInsightGatewayCredential ... |
| 262 | + ``` |
| 263 | +- Removed cmdlet `Revoke-AzHDInsightHttpServicesAccess` |
| 264 | + |
| 265 | +### Az.Storage |
| 266 | +- 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. |
| 267 | + |
| 268 | + #### Example 1: Add a message to a Queue (change CloudQueueMessage object namespace) |
| 269 | + Before: |
| 270 | + ```powershell |
| 271 | + $queue = Get-AzStorageQueue –Name $queueName –Context $ctx |
| 272 | + $queueMessage = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)" -ArgumentList "This is message 1" |
| 273 | + $queue.CloudQueue.AddMessageAsync($QueueMessage) |
| 274 | + ``` |
| 275 | + After: |
| 276 | + ```powershell |
| 277 | + $queue = Get-AzStorageQueue –Name $queueName –Context $ctx |
| 278 | + $queueMessage = New-Object -TypeName "Microsoft.Azure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)" -ArgumentList "This is message 1" |
| 279 | + $queue.CloudQueue.AddMessageAsync($QueueMessage) |
| 280 | + ``` |
| 281 | + |
| 282 | + #### Example 2: Fetch Blob/File Attributes with AccessCondition (change AccessCondition object namespace) |
| 283 | + Before: |
| 284 | + ```powershell |
| 285 | + $accessCondition= New-Object Microsoft.WindowsAzure.Storage.AccessCondition |
| 286 | +
|
| 287 | + $blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName |
| 288 | + $blob.ICloudBlob.FetchAttributes($accessCondition) |
| 289 | +
|
| 290 | + $file = Get-AzureStorageFile -ShareName $shareName -Path $filepath |
| 291 | + $file.FetchAttributes($accessCondition) |
| 292 | + ``` |
| 293 | + After: |
| 294 | + ```powershell |
| 295 | + $accessCondition= New-Object Microsoft.Azure.Storage.AccessCondition |
| 296 | +
|
| 297 | + $blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName |
| 298 | + $blob.ICloudBlob.FetchAttributes($accessCondition) |
| 299 | +
|
| 300 | + $file = Get-AzureStorageFile -ShareName $shareName -Path $filepath |
| 301 | + $file.FetchAttributes($accessCondition) |
| 302 | + ``` |
| 303 | + |
| 304 | +- 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.) |
| 305 | + - "StandardLRS" -> "Standard_LRS"; |
| 306 | + - "StandardGRS" -> "Standard_GRS"; |
| 307 | + - "StandardRAGRS" -> "Standard_RAGRS"; |
| 308 | + - "StandardZRS" -> "Standard_ZRS"; |
| 309 | + - "PremiumLRS" -> "Premium_LRS"; |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | +- 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' |
| 314 | + #### Example : Create a storage Account (Default Kind change) |
| 315 | + Before: |
| 316 | + ```powershell |
| 317 | + PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus" |
| 318 | +
|
| 319 | + StorageAccountName ResourceGroupName Location SkuName Kind AccessTier CreationTime ProvisioningState EnableHttpsTrafficOnly |
| 320 | + ------------------ ----------------- -------- ------- ---- ---------- ------------ ----------------- ---------------------- |
| 321 | + accountname groupname westus StandardLRS Storage Hot 4/17/2018 10:34:32 AM Succeeded False |
| 322 | + ``` |
| 323 | + After: |
| 324 | + ```powershell |
| 325 | + PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus" |
| 326 | +
|
| 327 | + StorageAccountName ResourceGroupName Location SkuName Kind AccessTier CreationTime ProvisioningState EnableHttpsTrafficOnly |
| 328 | + ------------------ ----------------- -------- ------- ---- ---------- ------------ ----------------- ---------------------- |
| 329 | + accountname groupname westus Standard_LRS StorageV2 Hot 4/17/2018 10:34:32 AM Succeeded False |
| 330 | + ``` |
| 331 | + |
| 332 | + |
| 333 | + |
| 334 | + |
0 commit comments