Skip to content

Commit a4802c2

Browse files
authored
Merge pull request Azure#4722 from viananth/mig-guide
Add migration guide for Stack AzureRm 1.2.11
2 parents fa69d0b + 6eb325e commit a4802c2

File tree

1 file changed

+251
-0
lines changed

1 file changed

+251
-0
lines changed
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
# Table of Contents
2+
1. [Removal of Force parameters](#removal-of-force-parameters)
3+
2. [Change of Tag parameters](#change-of-tag-parameters)
4+
3. [Breaking Changes to Profile Cmdlets](#breaking-changes-to-profile-cmdlets)
5+
6+
## Removal of Force parameters
7+
8+
This release, we removed all Obsolete `Force` parameters from cmdlets and the corresponding warnings that the parameter would be removed in a future release.
9+
10+
The following cmdlets are affected by this change:
11+
12+
**Profile**
13+
- Remove-AzureRmEnvironment
14+
15+
**Resources**
16+
- Register-AzureRmProviderFeature
17+
- Register-AzureRmResourceProvider
18+
- Remove-AzureRmADServicePrincipal
19+
- Remove-AzureRmPolicyAssignment
20+
- Remove-AzureRmResourceGroupDeployment
21+
- Remove-AzureRmRoleAssignment
22+
- Stop-AzureRmResourceGroupDeployment
23+
- Unregister-AzureRmResourceProvider
24+
25+
**Tag**
26+
- Remove-AzureRmTag
27+
28+
<br>
29+
30+
If you have a script that uses any of the above cmdlets, the breaking change can be fixed by simply removing the `Force` parameter.
31+
32+
```powershell
33+
# Old
34+
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location -Force
35+
36+
# New
37+
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
38+
```
39+
40+
<br>
41+
42+
## Change of Tag parameters
43+
44+
This release, the `Tags` parameter name was changed to `Tag`, and the type was changed from `Hashtable[]` to `Hashtable`, changing the format of the key-value pairings.
45+
46+
Previously, each entry in the `Hashtable[]` represented a single key-value pairing:
47+
48+
```powershell
49+
$tags = @{ Name = "test1"; Value = "testval1" }, @{ Name = "test2", Value = "testval2" }
50+
$tags[0].Name # Key for the first entry, "test1"
51+
$tags[0].Value # Value for the first entry, "testval1"
52+
$tags[1].Name # Key for the second entry, "test2"
53+
$tags[1].Value # Value for the second entry, "testval2"
54+
```
55+
56+
Now, `Name` and `Value` are no longer necessary, allowing for key-value pairings to be created by assigning `Key = "Value"` in the `Hashtable`:
57+
58+
```powershell
59+
$tag = @{ test1 = "testval1"; test2 = "testval2" }
60+
$tag["test1"] # Gets the value associated with the key "test1"
61+
$tag["test2"] # Gets the value associated with the key "test2"
62+
```
63+
64+
The following cmdlets are affected by this change:
65+
66+
67+
**Compute**
68+
- New-AzureRmVM
69+
- Update-AzureRmVM
70+
71+
**Dns**
72+
- New-AzureRmDnsZone
73+
- Set-AzureRmDnsZone
74+
75+
**KeyVault**
76+
- Get-AzureRmKeyVault
77+
- New-AzureRmKeyVault
78+
79+
**Network**
80+
- New-AzureRmApplicationGateway
81+
- New-AzureRmExpressRouteCircuit
82+
- New-AzureRmLoadBalancer
83+
- New-AzureRmLocalNetworkGateway
84+
- New-AzureRmNetworkInterface
85+
- New-AzureRmNetworkSecurityGroup
86+
- New-AzureRmPublicIpAddress
87+
- New-AzureRmRouteTable
88+
- New-AzureRmVirtualNetwork
89+
- New-AzureRmVirtualNetworkGateway
90+
- New-AzureRmVirtualNetworkGatewayConnection
91+
- New-AzureRmVirtualNetworkPeering
92+
93+
**Resources**
94+
- Find-AzureRmResource
95+
- Find-AzureRmResourceGroup
96+
- New-AzureRmResource
97+
- New-AzureRmResourceGroup
98+
- Set-AzureRmResource
99+
- Set-AzureRmResourceGroup
100+
101+
**Storage**
102+
- New-AzureRmStorageAccount
103+
- Set-AzureRmStorageAccount
104+
105+
106+
<br>
107+
108+
If you have a script that uses any of the above cmdlets, the breaking change can be fixed by changing the `Tags` parameter to `Tag`, as well as changing the `Tag` to the new format.
109+
110+
```powershell
111+
# Old
112+
New-AzureRmResourceGroup -Name $resourceGroupName -Location -location -Tags @{ Name = "testtag"; Value = "testval" }
113+
114+
# New
115+
New-AzureRmResourceGroup -Name $resourceGroupName -Location -location -Tag @{ testtag = "testval" }
116+
```
117+
118+
<br>
119+
120+
## Breaking Changes to Profile Cmdlets
121+
122+
The following cmdlets and cmdlet output types were changed in this release.
123+
124+
### Add-AzureRmAccount breaking changes
125+
126+
- ```EnvironmentName``` parameter has been removed and replaced with ```Environment```, the ```Environment``` now takes a string and not an ```AzureEnvironment``` object
127+
128+
```powershell
129+
# Old
130+
Add-AzureRmAccount -EnvironmentName AzureStack
131+
132+
# New
133+
Add-AzureRmAccount -Environment AzureStack
134+
```
135+
136+
### Select-AzureRmProfile was renamed to Import-AzureRmContext
137+
138+
```Select-AzureRmProfile``` was renamed to ```Import-AzureRmContext```
139+
140+
```powershell
141+
# Old
142+
Select-AzureRmProfile -Path c:\mydir\myprofile.json
143+
144+
# New
145+
Import-AzureRmContext -Path c:\mydir\myprofile.json
146+
```
147+
148+
### Save-AzureRmProfile was renamed to Save-AzureRmContext
149+
150+
```Save-AzureRmProfile``` was renamed to ```Save-AzureRmContext```
151+
152+
```powershell
153+
# Old
154+
Save-AzureRmProfile -Path c:\mydir\myprofile.json
155+
156+
# New
157+
Save-AzureRmContext -Path c:\mydir\myprofile.json
158+
```
159+
### Breaking Changes to output PSAzureContext Type
160+
161+
- The ```TokenCache``` property changed to a type that implements ```IAzureTokenCache``` instead of a ```byte[]```
162+
163+
```powershell
164+
# Old
165+
$bytes = (Get-AzureRmContext).TokenCache
166+
$bytes = (Set-AzureRmContext -SubscriptionId xxx-xxx-xxx-xxx).TokenCache
167+
$bytes = (Add-AzureRmAccount).Context.TokenCache
168+
169+
# New
170+
$bytes = (Get-AzureRmContext).TokenCache.CacheData
171+
$bytes = (Set-AzureRmContext -SubscriptionId xxx-xxx-xxx-xxx).TokenCache.CacheData
172+
$bytes = (Add-AzureRmAccount).Context.TokenCache.CacheData
173+
```
174+
175+
### Breaking Changes to the output PSAzureAccount Type
176+
177+
- The ```AccountType``` property was changed to ```Type```
178+
179+
```powershell
180+
# Old
181+
$type = (Get-AzureRmContext).Account.AccountType
182+
$type = (Set-AzureRmContext -SubscriptionId xxx-xxx-xxx-xxx).Account.AccountType
183+
$type = (Add-AzureRmAccount).Context.Account.AccountType
184+
185+
# New
186+
$type = (Get-AzureRmContext).Account.Type
187+
$type = (Set-AzureRmContext -SubscriptionId xxx-xxx-xxx-xxx).Account.Type
188+
$type = (Add-AzureRmAccount).Context.Account.Type
189+
```
190+
191+
### Breaking Changes to the output PSAzureSubscription Type
192+
- The ```SubscriptionId``` property was changed to ```Id```
193+
194+
```powershell
195+
# Old
196+
$id =(Get-AzureRmSubscription -SubscriptionId xxxx-xxxx-xxxx-xxxx).SubscriptionId
197+
$id =(Add-AzureRmAccount -SubscriptionId xxxx-xxxx-xxxx-xxxx).Context.Subscription.SubscriptionId
198+
$id =(Get-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.SubscriptionId
199+
$id =(Set-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.SubscriptionId
200+
201+
# New
202+
$id =(Get-AzureRmSubscription -SubscriptionId xxxx-xxxx-xxxx-xxxx).Id
203+
$id =(Add-AzureRmAccount -SubscriptionId xxxx-xxxx-xxxx-xxxx).Context.Subscription.Id
204+
$id =(Get-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.Id
205+
$id =(Set-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.Id
206+
```
207+
208+
- The ```SubscriptionName``` property was changed to ```Name```
209+
210+
```powershell
211+
# Old
212+
$name =(Get-AzureRmSubscription -SubscriptionId xxxx-xxxx-xxxx-xxxx).SubscriptionName
213+
$name =(Add-AzureRmAccount -SubscriptionId xxxx-xxxx-xxxx-xxxx).Context.Subscription.SubscriptionName
214+
$name =(Get-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.SubscriptionName
215+
$name =(Set-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.SubscriptionName
216+
217+
# New
218+
$name =(Get-AzureRmSubscription -SubscriptionId xxxx-xxxx-xxxx-xxxx).Name
219+
$name =(Add-AzureRmAccount -SubscriptionId xxxx-xxxx-xxxx-xxxx).Context.Subscription.Name
220+
$name =(Get-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.Name
221+
$name =(Set-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Subscription.Name
222+
```
223+
224+
### Breaking Changes to the output PSAzureTenant Type
225+
226+
- The ```TenantId``` property was changed to ```Id```
227+
228+
```powershell
229+
# Old
230+
$id =(Get-AzureRmTenant -TenantId xxxx-xxxx-xxxx-xxxx).TenantId
231+
$id =(Add-AzureRmAccount -SubscriptionId xxxx-xxxx-xxxx-xxxx).Context.Tenant.TenantId
232+
$id =(Get-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Tenant.TenantId
233+
$id =(Set-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Tenant.TenantId
234+
235+
# New
236+
$id =(Get-AzureRmTenant -TenantId xxxx-xxxx-xxxx-xxxx).Id
237+
$id =(Add-AzureRmAccount -SubscriptionId xxxx-xxxx-xxxx-xxxx).Context.Tenant.Id
238+
$id =(Get-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Tenant.Id
239+
$id =(Set-AzureRmContext -SubscriptionId xxxx-xxxx-xxxx-xxxx).Tenant.Id
240+
```
241+
242+
- The ```Domain``` property was changed to ```Directory```
243+
244+
```powershell
245+
# Old
246+
$tenantName =(Get-AzureRmTenant -TenantId xxxx-xxxx-xxxx-xxxx).Domain
247+
248+
# New
249+
$tenantName =(Get-AzureRmTenant -TenantId xxxx-xxxx-xxxx-xxxx).Directory
250+
```
251+

0 commit comments

Comments
 (0)