Skip to content

Commit 41ed04d

Browse files
Migrate Subscription from generation to main (#22658)
* Move Subscription to main * Update changelog * Update changelog --------- Co-authored-by: Jinpei Li <[email protected]>
1 parent 3747a3b commit 41ed04d

23 files changed

+477
-778
lines changed

src/Subscription/Az.Subscription.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 26/07/2023
6+
# Generated on: 8/25/2023
77
#
88

99
@{
@@ -112,7 +112,7 @@ PrivateData = @{
112112
# IconUri = ''
113113

114114
# ReleaseNotes of this module
115-
ReleaseNotes = '* Upgrade API version to 2021-10-01.'
115+
# ReleaseNotes = ''
116116

117117
# Prerelease string of this module
118118
# Prerelease = ''

src/Subscription/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Removed the default value for the `New-AzSubscriptionAlias` cmdlet parameter `SubscriptionId`.
22+
* Removed the default value for the `Get-AzSubscriptionAcceptOwnershipStatus` cmdlet parameter `SubscriptionId` and mark the parameter as mandatory.
23+
* Removed the default value for the `Invoke-AzSubscriptionAcceptOwnership` cmdlet parameter `SubscriptionId` and mark the parameter as mandatory.
2124

2225
## Version 0.10.0
2326
* Upgrade API version to 2021-10-01.

src/Subscription/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ directive:
120120
subject: SubscriptionPolicyUpdatePolicy
121121
set:
122122
subject: SubscriptionPolicy
123+
- where:
124+
verb: Get
125+
subject: SubscriptionPolicy
126+
variant: ^Get$
127+
remove: true
128+
123129
- where:
124130
subject: AcceptSubscriptionOwnership
125131
set:
@@ -167,6 +173,55 @@ directive:
167173
set:
168174
property-name: AliasName
169175

176+
- from: NewAzSubscriptionAlias_CreateExpanded.cs
177+
where: $
178+
transform: $ = $.replace('[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.DefaultInfo(', '');
179+
- from: NewAzSubscriptionAlias_CreateExpanded.cs
180+
where: $
181+
transform: $ = $.replace('Name = @"",', '');
182+
- from: NewAzSubscriptionAlias_CreateExpanded.cs
183+
where: $
184+
transform: $ = $.replace('Description =@"",', '');
185+
- from: NewAzSubscriptionAlias_CreateExpanded.cs
186+
where: $
187+
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id")]', '');
188+
189+
- from: GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs
190+
where: $
191+
transform: $ = $.replace('[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.DefaultInfo(', '');
192+
- from: GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs
193+
where: $
194+
transform: $ = $.replace('Name = @"",', '');
195+
- from: GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs
196+
where: $
197+
transform: $ = $.replace('Description =@"",', '');
198+
- from: GetAzSubscriptionAcceptOwnershipStatus_AcceptExpanded.cs
199+
where: $
200+
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id")]', '');
201+
- where:
202+
verb: Get
203+
subject: AcceptOwnershipStatus
204+
parameter-name: SubscriptionId
205+
required: true
206+
207+
- from: InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs
208+
where: $
209+
transform: $ = $.replace('[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.DefaultInfo(', '');
210+
- from: InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs
211+
where: $
212+
transform: $ = $.replace('Name = @"",', '');
213+
- from: InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs
214+
where: $
215+
transform: $ = $.replace('Description =@"",', '');
216+
- from: InvokeAzSubscriptionAcceptOwnership_AcceptExpanded.cs
217+
where: $
218+
transform: $ = $.replace('Script = @"(Get-AzContext).Subscription.Id")]', '');
219+
- where:
220+
verb: Invoke
221+
subject: AcceptOwnership
222+
parameter-name: SubscriptionId
223+
required: true
224+
170225
- where:
171226
model-name: SubscriptionAliasResponse
172227
set:

src/Subscription/Subscription.sln

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{99FFFFA8-37D2-4242-ABF6-AB54D5CF296E}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{8424F531-551F-4D6F-812B-732A3BC0D664}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{3E5029BA-AB3D-473B-A73D-14AF26951107}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{28026F5B-B921-43C7-8546-BA1C28774B5B}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{4E479E72-AE5C-4657-8A85-5D7EB740D9EE}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{1A79A3B1-1C84-4755-8053-C6279EA1878D}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{2852F1E5-9C0E-4238-BF57-135B3A24E69D}"
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{F4D70888-0C6D-4037-AF52-7BF38E8B2664}"
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{23E6E6DB-A9EA-4007-9521-EC37A0C866B0}"
1515
EndProject
16-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{4366D2AC-51C2-439A-8326-BB6772DF53AC}"
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{035C5B60-9416-4808-9365-5BDBE37EEBBD}"
1717
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Subscription", "Az.Subscription.csproj", "{4DD4F253-9EC1-4D06-A119-F235131DA7C1}"
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Subscription", "Az.Subscription.csproj", "{980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}"
1919
EndProject
2020
Global
2121
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -26,33 +26,33 @@ Global
2626
HideSolutionNode = FALSE
2727
EndGlobalSection
2828
GlobalSection(ProjectConfigurationPlatforms) = postSolution
29-
{99FFFFA8-37D2-4242-ABF6-AB54D5CF296E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30-
{99FFFFA8-37D2-4242-ABF6-AB54D5CF296E}.Debug|Any CPU.Build.0 = Debug|Any CPU
31-
{99FFFFA8-37D2-4242-ABF6-AB54D5CF296E}.Release|Any CPU.ActiveCfg = Release|Any CPU
32-
{99FFFFA8-37D2-4242-ABF6-AB54D5CF296E}.Release|Any CPU.Build.0 = Release|Any CPU
33-
{8424F531-551F-4D6F-812B-732A3BC0D664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34-
{8424F531-551F-4D6F-812B-732A3BC0D664}.Debug|Any CPU.Build.0 = Debug|Any CPU
35-
{8424F531-551F-4D6F-812B-732A3BC0D664}.Release|Any CPU.ActiveCfg = Release|Any CPU
36-
{8424F531-551F-4D6F-812B-732A3BC0D664}.Release|Any CPU.Build.0 = Release|Any CPU
37-
{28026F5B-B921-43C7-8546-BA1C28774B5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38-
{28026F5B-B921-43C7-8546-BA1C28774B5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
39-
{28026F5B-B921-43C7-8546-BA1C28774B5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
40-
{28026F5B-B921-43C7-8546-BA1C28774B5B}.Release|Any CPU.Build.0 = Release|Any CPU
41-
{1A79A3B1-1C84-4755-8053-C6279EA1878D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42-
{1A79A3B1-1C84-4755-8053-C6279EA1878D}.Debug|Any CPU.Build.0 = Debug|Any CPU
43-
{1A79A3B1-1C84-4755-8053-C6279EA1878D}.Release|Any CPU.ActiveCfg = Release|Any CPU
44-
{1A79A3B1-1C84-4755-8053-C6279EA1878D}.Release|Any CPU.Build.0 = Release|Any CPU
45-
{F4D70888-0C6D-4037-AF52-7BF38E8B2664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46-
{F4D70888-0C6D-4037-AF52-7BF38E8B2664}.Debug|Any CPU.Build.0 = Debug|Any CPU
47-
{F4D70888-0C6D-4037-AF52-7BF38E8B2664}.Release|Any CPU.ActiveCfg = Release|Any CPU
48-
{F4D70888-0C6D-4037-AF52-7BF38E8B2664}.Release|Any CPU.Build.0 = Release|Any CPU
49-
{4366D2AC-51C2-439A-8326-BB6772DF53AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50-
{4366D2AC-51C2-439A-8326-BB6772DF53AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
51-
{4366D2AC-51C2-439A-8326-BB6772DF53AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
52-
{4366D2AC-51C2-439A-8326-BB6772DF53AC}.Release|Any CPU.Build.0 = Release|Any CPU
53-
{4DD4F253-9EC1-4D06-A119-F235131DA7C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54-
{4DD4F253-9EC1-4D06-A119-F235131DA7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
55-
{4DD4F253-9EC1-4D06-A119-F235131DA7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
56-
{4DD4F253-9EC1-4D06-A119-F235131DA7C1}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{3CF7EAC8-FBCC-4F2C-BE7F-19AA306D43FA}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{3E5029BA-AB3D-473B-A73D-14AF26951107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{3E5029BA-AB3D-473B-A73D-14AF26951107}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{3E5029BA-AB3D-473B-A73D-14AF26951107}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{3E5029BA-AB3D-473B-A73D-14AF26951107}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{4E479E72-AE5C-4657-8A85-5D7EB740D9EE}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{2852F1E5-9C0E-4238-BF57-135B3A24E69D}.Release|Any CPU.Build.0 = Release|Any CPU
45+
{23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46+
{23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
47+
{23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{23E6E6DB-A9EA-4007-9521-EC37A0C866B0}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{035C5B60-9416-4808-9365-5BDBE37EEBBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{035C5B60-9416-4808-9365-5BDBE37EEBBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{035C5B60-9416-4808-9365-5BDBE37EEBBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{035C5B60-9416-4808-9365-5BDBE37EEBBD}.Release|Any CPU.Build.0 = Release|Any CPU
53+
{980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54+
{980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
55+
{980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{980C0C20-CAC8-48D0-9D16-7A0CC0BD2D5F}.Release|Any CPU.Build.0 = Release|Any CPU
5757
EndGlobalSection
5858
EndGlobal

src/Subscription/examples/Get-AzSubscriptionAcceptOwnershipStatus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Example 1: Accept subscription ownership status.
22
```powershell
3-
Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
3+
Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
44
```
55

66
```output

src/Subscription/examples/New-AzSubscriptionAlias.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
### Example 1: Create Alias Subscription.
22
```powershell
3-
New-AzSubscriptionAlias -AliasName test-subscription
3+
New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4+
```
5+
6+
```output
7+
AliasName DisplayName SubscriptionId ProvisioningState
8+
--------- ----------- -------------- -----------------
9+
test-subscription createSub XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Succeeded
10+
```
11+
12+
Create Alias Subscription.
13+
14+
### Example 2: Create Alias Subscription.
15+
```powershell
16+
New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production'
417
```
518

619
```output

src/Subscription/exports/Get-AzSubscriptionAcceptOwnershipStatus.ps1

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Accept subscription ownership status.
2020
.Description
2121
Accept subscription ownership status.
2222
.Example
23-
Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
23+
Get-AzSubscriptionAcceptOwnershipStatus -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
2424
2525
.Inputs
2626
Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.ISubscriptionIdentity
@@ -43,9 +43,8 @@ function Get-AzSubscriptionAcceptOwnershipStatus {
4343
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IAcceptOwnershipStatusResponse])]
4444
[CmdletBinding(DefaultParameterSetName='AcceptExpanded', PositionalBinding=$false)]
4545
param(
46-
[Parameter(ParameterSetName='AcceptExpanded')]
46+
[Parameter(ParameterSetName='AcceptExpanded', Mandatory)]
4747
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')]
48-
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
4948
[System.String[]]
5049
# Subscription Id.
5150
${SubscriptionId},
@@ -135,9 +134,6 @@ begin {
135134
AcceptExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptExpanded';
136135
AcceptViaIdentityExpanded = 'Az.Subscription.private\Get-AzSubscriptionAcceptOwnershipStatus_AcceptViaIdentityExpanded';
137136
}
138-
if (('AcceptExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
139-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
140-
}
141137
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
142138
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
143139
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)

src/Subscription/exports/Get-AzSubscriptionPolicy.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ https://learn.microsoft.com/powershell/module/az.subscription/get-azsubscription
2929
#>
3030
function Get-AzSubscriptionPolicy {
3131
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.IGetTenantPolicyResponse])]
32-
[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)]
32+
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
3333
param(
3434
[Parameter()]
3535
[Alias('AzureRMContext', 'AzureCredential')]
@@ -106,7 +106,6 @@ begin {
106106
}
107107

108108
$mapping = @{
109-
Get = 'Az.Subscription.private\Get-AzSubscriptionPolicy_Get';
110109
List = 'Az.Subscription.private\Get-AzSubscriptionPolicy_List';
111110
}
112111
$cmdInfo = Get-Command -Name $mapping[$parameterSet]

src/Subscription/exports/Invoke-AzSubscriptionAcceptOwnership.ps1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ function Invoke-AzSubscriptionAcceptOwnership {
4343
[OutputType([System.Boolean])]
4444
[CmdletBinding(DefaultParameterSetName='AcceptExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
4545
param(
46-
[Parameter(ParameterSetName='AcceptExpanded')]
46+
[Parameter(ParameterSetName='AcceptExpanded', Mandatory)]
4747
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Path')]
48-
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
4948
[System.String]
5049
# Subscription Id.
5150
${SubscriptionId},
@@ -172,9 +171,6 @@ begin {
172171
AcceptExpanded = 'Az.Subscription.private\Invoke-AzSubscriptionAcceptOwnership_AcceptExpanded';
173172
AcceptViaIdentityExpanded = 'Az.Subscription.private\Invoke-AzSubscriptionAcceptOwnership_AcceptViaIdentityExpanded';
174173
}
175-
if (('AcceptExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
176-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
177-
}
178174
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
179175
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
180176
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)

src/Subscription/exports/New-AzSubscriptionAlias.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ Create Alias Subscription.
2020
.Description
2121
Create Alias Subscription.
2222
.Example
23-
New-AzSubscriptionAlias -AliasName test-subscription
23+
New-AzSubscriptionAlias -AliasName test-subscription -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
24+
.Example
25+
New-AzSubscriptionAlias -AliasName test-subscription -DisplayName "createSub" -BillingScope "/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" -Workload 'Production'
2426
2527
.Outputs
2628
Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20211001.ISubscriptionAliasResponse
@@ -64,7 +66,6 @@ param(
6466

6567
[Parameter()]
6668
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Category('Body')]
67-
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
6869
[System.String]
6970
# This parameter can be used to create alias for existing subscription Id
7071
${SubscriptionId},
@@ -185,9 +186,6 @@ begin {
185186
$mapping = @{
186187
CreateExpanded = 'Az.Subscription.private\New-AzSubscriptionAlias_CreateExpanded';
187188
}
188-
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
189-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
190-
}
191189
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
192190
[Microsoft.Azure.PowerShell.Cmdlets.Subscription.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
193191
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)

0 commit comments

Comments
 (0)