File tree Expand file tree Collapse file tree 7 files changed +42
-12
lines changed
Expand file tree Collapse file tree 7 files changed +42
-12
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ param (
5252 [ValidatePattern (' ^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$' )]
5353 [string ] $ProvisionerApplicationOid ,
5454
55- [Parameter (ParameterSetName = ' Provisioner' , Mandatory = $true )]
55+ [Parameter (ParameterSetName = ' Provisioner' )]
5656 [string ] $ProvisionerApplicationSecret ,
5757
5858 [Parameter ()]
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ New-TestResources.ps1 [-BaseName <String>] [-ResourceGroupName <String>] [-Servi
2929 [-TestResourcesDirectory <String>] [-TestApplicationId <String>] [-TestApplicationSecret <String>]
3030 [-TestApplicationOid <String>] -TenantId <String> [-SubscriptionId <String>]
3131 -ProvisionerApplicationId <String> [-ProvisionerApplicationOid <String>]
32- -ProvisionerApplicationSecret <String> [-DeleteAfterHours <Int32>] [-Location <String>]
32+ [ -ProvisionerApplicationSecret <String>] [-DeleteAfterHours <Int32>] [-Location <String>]
3333 [-Environment <String>] [-ResourceType <String>] [-ArmTemplateParameters <Hashtable>]
3434 [-AdditionalParameters <Hashtable>] [-EnvironmentVariables <Hashtable>] [-CI] [-Force] [-OutFile]
3535 [-SuppressVsoCommands] [-ServicePrincipalAuth] [-NewTestResourcesRemainingArguments <Object>]
@@ -426,7 +426,7 @@ Type: String
426426Parameter Sets : Provisioner
427427Aliases :
428428
429- Required : True
429+ Required : False
430430Position : Named
431431Default value : None
432432Accept pipeline input : False
Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ param (
3434 [ValidatePattern (' ^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$' )]
3535 [string ] $ProvisionerApplicationId ,
3636
37- [Parameter (ParameterSetName = ' Default+Provisioner' , Mandatory = $true )]
38- [Parameter (ParameterSetName = ' ResourceGroup+Provisioner' , Mandatory = $true )]
37+ [Parameter (ParameterSetName = ' Default+Provisioner' )]
38+ [Parameter (ParameterSetName = ' ResourceGroup+Provisioner' )]
3939 [string ] $ProvisionerApplicationSecret ,
4040
4141 [Parameter (ParameterSetName = ' Default' , Position = 0 )]
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Remove-TestResources.ps1 [-BaseName <String>] [-SubscriptionId <String>] [[-Serv
2323### Default+Provisioner
2424```
2525Remove-TestResources.ps1 -BaseName <String> -TenantId <String> [-SubscriptionId <String>]
26- -ProvisionerApplicationId <String> -ProvisionerApplicationSecret <String> [[-ServiceDirectory] <String>]
26+ -ProvisionerApplicationId <String> [ -ProvisionerApplicationSecret <String>] [[-ServiceDirectory] <String>]
2727 [-Environment <String>] [-ResourceType <String>] [-ServicePrincipalAuth] [-Force]
2828 [-RemoveTestResourcesRemainingArguments <Object>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
2929 [<CommonParameters>]
@@ -32,7 +32,7 @@ Remove-TestResources.ps1 -BaseName <String> -TenantId <String> [-SubscriptionId
3232### ResourceGroup+Provisioner
3333```
3434Remove-TestResources.ps1 [-ResourceGroupName <String>] -TenantId <String> [-SubscriptionId <String>]
35- -ProvisionerApplicationId <String> -ProvisionerApplicationSecret <String> [[-ServiceDirectory] <String>]
35+ -ProvisionerApplicationId <String> [ -ProvisionerApplicationSecret <String>] [[-ServiceDirectory] <String>]
3636 [-Environment <String>] [-CI] [-ResourceType <String>] [-ServicePrincipalAuth] [-Force]
3737 [-RemoveTestResourcesRemainingArguments <Object>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
3838 [<CommonParameters>]
@@ -184,7 +184,7 @@ Type: String
184184Parameter Sets : Default+Provisioner, ResourceGroup+Provisioner
185185Aliases :
186186
187- Required : True
187+ Required : False
188188Position : Named
189189Default value : None
190190Accept pipeline input : False
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ parameters:
77 ServiceConnection : not-specified
88 ResourceType : test
99 UseFederatedAuth : false
10+ SubscriptionConfigurationFilePath : ' '
1011
1112
1213# SubscriptionConfiguration will be splatted into the parameters of the test
@@ -54,9 +55,17 @@ steps:
5455 Inline : |
5556 eng/common/scripts/Import-AzModules.ps1
5657
57- $subscriptionConfiguration = @'
58- ${{ parameters.SubscriptionConfiguration }}
58+ if ('${{ parameters.SubscriptionConfigurationFilePath }}' -ne '') {
59+ $subscriptionConfiguration = `
60+ Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' `
61+ | ConvertFrom-Json -AsHashtable;
62+ } else {
63+ # Multiline string termination ('@) needs to be at the beginning
64+ # of the line
65+ $subscriptionConfiguration = @'
66+ ${{ parameters.SubscriptionConfiguration }}
5967 '@ | ConvertFrom-Json -AsHashtable;
68+ }
6069
6170 # The subscriptionConfiguration may have ArmTemplateParameters defined, so
6271 # pass those in via the ArmTemplateParameters flag, and handle any
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ parameters:
77 ServiceConnection : not-specified
88 ResourceType : test
99 UseFederatedAuth : false
10+ SubscriptionConfigurationFilePath : ' '
1011
1112# SubscriptionConfiguration will be splat into the parameters of the test
1213# resources script. It should be JSON in the form:
@@ -36,10 +37,20 @@ steps:
3637 Inline : |
3738 eng/common/scripts/Import-AzModules.ps1
3839
39- $subscriptionConfiguration = @"
40- ${{ parameters.SubscriptionConfiguration }}
40+
41+ if ('${{ parameters.SubscriptionConfigurationFilePath }}' -ne '') {
42+ $subscriptionConfiguration = `
43+ Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' `
44+ | ConvertFrom-Json -AsHashtable;
45+ } else {
46+ # Multiline string termination ("@) needs to be at the beginning
47+ # of the line
48+ $subscriptionConfiguration = @"
49+ ${{ parameters.SubscriptionConfiguration }}
4150 "@ | ConvertFrom-Json -AsHashtable;
4251
52+ }
53+
4354 eng/common/TestResources/Remove-TestResources.ps1 `
4455 @subscriptionConfiguration `
4556 -ResourceType '${{ parameters.ResourceType }}' `
Original file line number Diff line number Diff line change 1+ {
2+ "SubscriptionId" : " 2cd617ea-1866-46b1-90e3-fffb087ebf9b" ,
3+ "TenantId" : " 72f988bf-86f1-41af-91ab-2d7cd011db47" ,
4+ "TestApplicationId" : " f850650c-1fcf-4489-b46f-71af2e30d360" ,
5+ "TestApplicationOid" : " 30511c9d-ba1a-4c7b-b422-5b543da11b3f" ,
6+ "ProvisionerApplicationId" : " f850650c-1fcf-4489-b46f-71af2e30d360" ,
7+ "ProvisionerApplicationOid" : " 30511c9d-ba1a-4c7b-b422-5b543da11b3f" ,
8+ "Environment" : " AzureCloud" ,
9+ "AzureSubscription" : " Azure SDK Test Resources"
10+ }
You can’t perform that action at this time.
0 commit comments