Skip to content

Commit 1f321dc

Browse files
committed
Merge branch 'master' of github.com:Azure/azure-powershell into test-build-filter
2 parents 136f773 + 4ee16ff commit 1f321dc

File tree

411 files changed

+93297
-28281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

411 files changed

+93297
-28281
lines changed

documentation/development-docs/azure-powershell-developer-guide.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ The Azure PowerShell Developer Guide was created to help with the development an
3636
- [After Development](#after-development)
3737
- [Misc](#misc)
3838
- [Publish to PowerShell Gallery](#publish-to-powershell-gallery)
39-
- [AsJob Parameter](#asjob-parameter)
40-
- [Argument Completers](#argument-completers)
41-
- [Resource Group Completer](#resource-group-completers)
42-
- [Location Completer](#location-completer)
43-
- [Generic Argument Completer](#generic-argument-completer)
4439

4540
# Prerequisites
4641

@@ -313,4 +308,4 @@ Whenver you make updates to a project, please make sure to update the correspond
313308

314309
## Publish to PowerShell Gallery
315310

316-
To publish your module to the [official PowerShell gallery](http://www.powershellgallery.com/) or the test gallery site, contact the Azure PowerShell team
311+
To publish your module to the [official PowerShell gallery](http://www.powershellgallery.com/) or the test gallery site, contact the Azure PowerShell team
Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
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 the `Grant-AzHDInsightHttpServicesAccess` and `Revoke-AzHDInsightHttpServicesAccess` cmdlets. These are no longer necessary because HTTP access is always enabled on all HDInsight clusters.
255+
- Added a new `Set-AzHDInsightGatewayCredential` cmdlet. Use this cmdlet to change the gateway HTTP username and password (replaces `Grant-AzHDInsightHttpServicesAccess`).
256+
- Updated the `Get-AzHDInsightJobOutput` cmdlet to support granular role-based access to the storage key.
257+
- Users with HDInsight Cluster Operator, Contributor, or Owner roles will not be affected.
258+
- Users with only the Reader role will need to specify `DefaultStorageAccountKey` parameter explicitly.
259+
260+
For more information about these role-based access changes, see [aka.ms/hdi-config-update](http://aka.ms/hdi-config-update)
261+
262+
#### Before
263+
```powershell
264+
Grant-AzHDInsightHttpServicesAccess -ClusterName $cluster -HttpCredential $credential
265+
```
266+
#### After
267+
```powershell
268+
Set-AzHDInsightGatewayCredential -ClusterName $cluster -HttpCredential $credential
269+
```
270+
271+
### Users with only Reader role for cmdlet Get-AzHDInsightJobOutput
272+
273+
#### Before
274+
```powershell
275+
Get-AzHDInsightJobOutput -ClusterName $clusterName -JobId $jobId
276+
```
277+
#### After
278+
```powershell
279+
Get-AzHDInsightJobOutput -ClusterName $clusterName -JobId $jobId -DefaultStorageAccountKey $storageAccountKey
280+
```
281+
282+
### Az.Storage
283+
- 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.
284+
285+
#### Example 1: Add a message to a Queue (change CloudQueueMessage object namespace)
286+
Before:
287+
```powershell
288+
$queue = Get-AzStorageQueue –Name $queueName –Context $ctx
289+
$queueMessage = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)" -ArgumentList "This is message 1"
290+
$queue.CloudQueue.AddMessageAsync($QueueMessage)
291+
```
292+
After:
293+
```powershell
294+
$queue = Get-AzStorageQueue –Name $queueName –Context $ctx
295+
$queueMessage = New-Object -TypeName "Microsoft.Azure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)" -ArgumentList "This is message 1"
296+
$queue.CloudQueue.AddMessageAsync($QueueMessage)
297+
```
298+
299+
#### Example 2: Fetch Blob/File Attributes with AccessCondition (change AccessCondition object namespace)
300+
Before:
301+
```powershell
302+
$accessCondition= New-Object Microsoft.WindowsAzure.Storage.AccessCondition
303+
304+
$blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName
305+
$blob.ICloudBlob.FetchAttributes($accessCondition)
306+
307+
$file = Get-AzureStorageFile -ShareName $shareName -Path $filepath
308+
$file.FetchAttributes($accessCondition)
309+
```
310+
After:
311+
```powershell
312+
$accessCondition= New-Object Microsoft.Azure.Storage.AccessCondition
313+
314+
$blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName
315+
$blob.ICloudBlob.FetchAttributes($accessCondition)
316+
317+
$file = Get-AzureStorageFile -ShareName $shareName -Path $filepath
318+
$file.FetchAttributes($accessCondition)
319+
```
320+
321+
- 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.)
322+
- "StandardLRS" -> "Standard_LRS";
323+
- "StandardGRS" -> "Standard_GRS";
324+
- "StandardRAGRS" -> "Standard_RAGRS";
325+
- "StandardZRS" -> "Standard_ZRS";
326+
- "PremiumLRS" -> "Premium_LRS";
327+
328+
329+
330+
- 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'
331+
#### Example : Create a storage Account (Default Kind change)
332+
Before:
333+
```powershell
334+
PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus"
335+
336+
StorageAccountName ResourceGroupName Location SkuName Kind AccessTier CreationTime ProvisioningState EnableHttpsTrafficOnly
337+
------------------ ----------------- -------- ------- ---- ---------- ------------ ----------------- ----------------------
338+
accountname groupname westus StandardLRS Storage Hot 4/17/2018 10:34:32 AM Succeeded False
339+
```
340+
After:
341+
```powershell
342+
PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus"
343+
344+
StorageAccountName ResourceGroupName Location SkuName Kind AccessTier CreationTime ProvisioningState EnableHttpsTrafficOnly
345+
------------------ ----------------- -------- ------- ---- ---------- ------------ ----------------- ----------------------
346+
accountname groupname westus Standard_LRS StorageV2 Hot 4/17/2018 10:34:32 AM Succeeded False
347+
```
348+
349+
350+
351+

0 commit comments

Comments
 (0)