Skip to content

Commit 4430f4a

Browse files
Migrate Cdn from generation to main (#24488)
* Move Cdn to main * Create UXMetadataIssues.csv --------- Co-authored-by: Yabo Hu <[email protected]>
1 parent 3b7ac99 commit 4430f4a

File tree

268 files changed

+1651
-1916
lines changed

Some content is hidden

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

268 files changed

+1651
-1916
lines changed

src/Cdn/Cdn.Autorest/UX/Microsoft.Cdn/profiles-afdEndpoints.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,49 @@
55
"url": "https://learn.microsoft.com/powershell/module/az.cdn"
66
},
77
"commands": [
8+
{
9+
"name": "Clear-AzFrontDoorCdnEndpointContent",
10+
"description": "Removes a content from AzureFrontDoor.",
11+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.cdn/clear-azfrontdoorcdnendpointcontent"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-EndpointName <String>",
20+
"-ProfileName <String>",
21+
"-ResourceGroupName <String>",
22+
"[-SubscriptionId <String>]"
23+
]
24+
}
25+
]
26+
},
27+
"examples": [
28+
{
29+
"description": "Removes a content from AzureFrontDoor.",
30+
"parameters": [
31+
{
32+
"name": "-EndpointName",
33+
"value": "[Path.endpointName]"
34+
},
35+
{
36+
"name": "-ProfileName",
37+
"value": "[Path.profileName]"
38+
},
39+
{
40+
"name": "-ResourceGroupName",
41+
"value": "[Path.resourceGroupName]"
42+
},
43+
{
44+
"name": "-SubscriptionId",
45+
"value": "[Path.subscriptionId]"
46+
}
47+
]
48+
}
49+
]
50+
},
851
{
952
"name": "Get-AzFrontDoorCdnEndpoint",
1053
"description": "Gets an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile.",

src/Cdn/Cdn.Autorest/UX/Microsoft.Cdn/profiles-endpoints-customDomains.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,54 @@
5353
}
5454
]
5555
},
56+
{
57+
"name": "Enable-AzCdnCustomDomainCustomHttps",
58+
"description": "Enable https delivery of the custom domain.",
59+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps",
60+
"help": {
61+
"learnMore": {
62+
"url": "https://learn.microsoft.com/powershell/module/az.cdn/enable-azcdncustomdomaincustomhttps"
63+
},
64+
"parameterSets": [
65+
{
66+
"parameters": [
67+
"-CustomDomainName <String>",
68+
"-EndpointName <String>",
69+
"-ProfileName <String>",
70+
"-ResourceGroupName <String>",
71+
"[-SubscriptionId <String>]"
72+
]
73+
}
74+
]
75+
},
76+
"examples": [
77+
{
78+
"description": "Enable https delivery of the custom domain.",
79+
"parameters": [
80+
{
81+
"name": "-CustomDomainName",
82+
"value": "[Path.customDomainName]"
83+
},
84+
{
85+
"name": "-EndpointName",
86+
"value": "[Path.endpointName]"
87+
},
88+
{
89+
"name": "-ProfileName",
90+
"value": "[Path.profileName]"
91+
},
92+
{
93+
"name": "-ResourceGroupName",
94+
"value": "[Path.resourceGroupName]"
95+
},
96+
{
97+
"name": "-SubscriptionId",
98+
"value": "[Path.subscriptionId]"
99+
}
100+
]
101+
}
102+
]
103+
},
56104
{
57105
"name": "Get-AzCdnCustomDomain",
58106
"description": "Gets an existing custom domain within an endpoint.",

src/Cdn/Cdn.Autorest/UX/Microsoft.Cdn/profiles-endpoints.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,49 @@
55
"url": "https://learn.microsoft.com/powershell/module/az.cdn"
66
},
77
"commands": [
8+
{
9+
"name": "Clear-AzCdnEndpointContent",
10+
"description": "Removes a content from CDN.",
11+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.cdn/clear-azcdnendpointcontent"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-EndpointName <String>",
20+
"-ProfileName <String>",
21+
"-ResourceGroupName <String>",
22+
"[-SubscriptionId <String>]"
23+
]
24+
}
25+
]
26+
},
27+
"examples": [
28+
{
29+
"description": "Removes a content from CDN.",
30+
"parameters": [
31+
{
32+
"name": "-EndpointName",
33+
"value": "[Path.endpointName]"
34+
},
35+
{
36+
"name": "-ProfileName",
37+
"value": "[Path.profileName]"
38+
},
39+
{
40+
"name": "-ResourceGroupName",
41+
"value": "[Path.resourceGroupName]"
42+
},
43+
{
44+
"name": "-SubscriptionId",
45+
"value": "[Path.subscriptionId]"
46+
}
47+
]
48+
}
49+
]
50+
},
851
{
952
"name": "Get-AzCdnEndpoint",
1053
"description": "Gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile.",
@@ -48,6 +91,49 @@
4891
}
4992
]
5093
},
94+
{
95+
"name": "Import-AzCdnEndpointContent",
96+
"description": "Pre-loads a content to CDN.\nAvailable for Verizon Profiles.",
97+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load",
98+
"help": {
99+
"learnMore": {
100+
"url": "https://learn.microsoft.com/powershell/module/az.cdn/import-azcdnendpointcontent"
101+
},
102+
"parameterSets": [
103+
{
104+
"parameters": [
105+
"-EndpointName <String>",
106+
"-ProfileName <String>",
107+
"-ResourceGroupName <String>",
108+
"[-SubscriptionId <String>]"
109+
]
110+
}
111+
]
112+
},
113+
"examples": [
114+
{
115+
"description": "Pre-loads a content to CDN. Available for Verizon Profiles.",
116+
"parameters": [
117+
{
118+
"name": "-EndpointName",
119+
"value": "[Path.endpointName]"
120+
},
121+
{
122+
"name": "-ProfileName",
123+
"value": "[Path.profileName]"
124+
},
125+
{
126+
"name": "-ResourceGroupName",
127+
"value": "[Path.resourceGroupName]"
128+
},
129+
{
130+
"name": "-SubscriptionId",
131+
"value": "[Path.subscriptionId]"
132+
}
133+
]
134+
}
135+
]
136+
},
51137
{
52138
"name": "Remove-AzCdnEndpoint",
53139
"description": "Deletes an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile.",

src/Cdn/Cdn.Autorest/exports/Clear-AzCdnEndpointContent.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,13 @@ begin {
214214
PurgeViaIdentityExpanded1 = 'Az.Cdn.private\Clear-AzCdnEndpointContent_PurgeViaIdentityExpanded1';
215215
}
216216
if (('Purge1', 'PurgeExpanded1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
217-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
217+
$testPlayback = $false
218+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
219+
if ($testPlayback) {
220+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
221+
} else {
222+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
223+
}
218224
}
219225
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
220226
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Clear-AzFrontDoorCdnEndpointContent.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,13 @@ begin {
223223
PurgeViaIdentityExpanded = 'Az.Cdn.private\Clear-AzFrontDoorCdnEndpointContent_PurgeViaIdentityExpanded';
224224
}
225225
if (('Purge', 'PurgeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
226-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
226+
$testPlayback = $false
227+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
228+
if ($testPlayback) {
229+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
230+
} else {
231+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
232+
}
227233
}
228234
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
229235
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Disable-AzCdnCustomDomainCustomHttps.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ begin {
181181
DisableViaIdentity = 'Az.Cdn.private\Disable-AzCdnCustomDomainCustomHttps_DisableViaIdentity';
182182
}
183183
if (('Disable') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
184-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
184+
$testPlayback = $false
185+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
186+
if ($testPlayback) {
187+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
188+
} else {
189+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
190+
}
185191
}
186192
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
187193
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Enable-AzCdnCustomDomainCustomHttps.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ begin {
196196
EnableViaIdentity = 'Az.Cdn.private\Enable-AzCdnCustomDomainCustomHttps_EnableViaIdentity';
197197
}
198198
if (('Enable') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
199-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
199+
$testPlayback = $false
200+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
201+
if ($testPlayback) {
202+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
203+
} else {
204+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
205+
}
200206
}
201207
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
202208
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Enable-AzFrontDoorCdnProfileMigration.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ begin {
147147
__AllParameterSets = 'Az.Cdn.custom\Enable-AzFrontDoorCdnProfileMigration';
148148
}
149149
if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
150-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
150+
$testPlayback = $false
151+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
152+
if ($testPlayback) {
153+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
154+
} else {
155+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
156+
}
151157
}
152158
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
153159
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Get-AzCdnCustomDomain.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ begin {
179179
List1 = 'Az.Cdn.private\Get-AzCdnCustomDomain_List1';
180180
}
181181
if (('Get1', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
182-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
182+
$testPlayback = $false
183+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
184+
if ($testPlayback) {
185+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
186+
} else {
187+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
188+
}
183189
}
184190
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
185191
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Get-AzCdnEndpoint.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,13 @@ begin {
177177
List1 = 'Az.Cdn.private\Get-AzCdnEndpoint_List1';
178178
}
179179
if (('Get1', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
180-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
180+
$testPlayback = $false
181+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
182+
if ($testPlayback) {
183+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
184+
} else {
185+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
186+
}
181187
}
182188
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
183189
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Get-AzCdnEndpointResourceUsage.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ begin {
134134
List1 = 'Az.Cdn.private\Get-AzCdnEndpointResourceUsage_List1';
135135
}
136136
if (('List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
137-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
137+
$testPlayback = $false
138+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
139+
if ($testPlayback) {
140+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
141+
} else {
142+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
143+
}
138144
}
139145
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
140146
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Get-AzCdnOrigin.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ begin {
179179
List1 = 'Az.Cdn.private\Get-AzCdnOrigin_List1';
180180
}
181181
if (('Get1', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
182-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
182+
$testPlayback = $false
183+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
184+
if ($testPlayback) {
185+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
186+
} else {
187+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
188+
}
183189
}
184190
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
185191
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Get-AzCdnOriginGroup.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ begin {
181181
List1 = 'Az.Cdn.private\Get-AzCdnOriginGroup_List1';
182182
}
183183
if (('Get1', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
184-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
184+
$testPlayback = $false
185+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
186+
if ($testPlayback) {
187+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
188+
} else {
189+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
190+
}
185191
}
186192
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
187193
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Get-AzCdnProfile.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@ begin {
168168
GetViaIdentity = 'Az.Cdn.custom\Get-AzCdnProfile';
169169
}
170170
if (('List', 'Get', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
171-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
171+
$testPlayback = $false
172+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
173+
if ($testPlayback) {
174+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
175+
} else {
176+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
177+
}
172178
}
173179
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
174180
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Cdn/Cdn.Autorest/exports/Get-AzCdnProfileResourceUsage.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,13 @@ begin {
128128
List1 = 'Az.Cdn.private\Get-AzCdnProfileResourceUsage_List1';
129129
}
130130
if (('List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
131-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
131+
$testPlayback = $false
132+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.PipelineMock' -eq $_.Target.GetType().FullName) }
133+
if ($testPlayback) {
134+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
135+
} else {
136+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
137+
}
132138
}
133139
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
134140
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

0 commit comments

Comments
 (0)