Skip to content

Commit

Permalink
Add static file secret-less sub-config support
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljurek authored and azure-sdk committed May 22, 2024
1 parent 29b02a0 commit 2f99b0b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ param (
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
[string] $ProvisionerApplicationOid,

[Parameter(ParameterSetName = 'Provisioner', Mandatory = $true)]
[Parameter(ParameterSetName = 'Provisioner')]
[string] $ProvisionerApplicationSecret,

[Parameter()]
Expand Down
6 changes: 3 additions & 3 deletions eng/common/TestResources/New-TestResources.ps1.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ New-TestResources.ps1 [-BaseName <String>] [-ResourceGroupName <String>] [-Servi
[-TestResourcesDirectory <String>] [-TestApplicationId <String>] [-TestApplicationSecret <String>]
[-TestApplicationOid <String>] -TenantId <String> [-SubscriptionId <String>]
-ProvisionerApplicationId <String> [-ProvisionerApplicationOid <String>]
-ProvisionerApplicationSecret <String> [-DeleteAfterHours <Int32>] [-Location <String>]
[-ProvisionerApplicationSecret <String>] [-DeleteAfterHours <Int32>] [-Location <String>]
[-Environment <String>] [-ResourceType <String>] [-ArmTemplateParameters <Hashtable>]
[-AdditionalParameters <Hashtable>] [-EnvironmentVariables <Hashtable>] [-CI] [-Force] [-OutFile]
[-SuppressVsoCommands] [-ServicePrincipalAuth] [-NewTestResourcesRemainingArguments <Object>]
Expand Down Expand Up @@ -426,7 +426,7 @@ Type: String
Parameter Sets: Provisioner
Aliases:

Required: True
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Expand Down Expand Up @@ -712,7 +712,7 @@ Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
Expand Down
4 changes: 2 additions & 2 deletions eng/common/TestResources/Remove-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ param (
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
[string] $ProvisionerApplicationId,

[Parameter(ParameterSetName = 'Default+Provisioner', Mandatory = $true)]
[Parameter(ParameterSetName = 'ResourceGroup+Provisioner', Mandatory = $true)]
[Parameter(ParameterSetName = 'Default+Provisioner')]
[Parameter(ParameterSetName = 'ResourceGroup+Provisioner')]
[string] $ProvisionerApplicationSecret,

[Parameter(ParameterSetName = 'Default', Position = 0)]
Expand Down
8 changes: 4 additions & 4 deletions eng/common/TestResources/Remove-TestResources.ps1.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Remove-TestResources.ps1 [-BaseName <String>] [-SubscriptionId <String>] [[-Serv
### Default+Provisioner
```
Remove-TestResources.ps1 -BaseName <String> -TenantId <String> [-SubscriptionId <String>]
-ProvisionerApplicationId <String> -ProvisionerApplicationSecret <String> [[-ServiceDirectory] <String>]
-ProvisionerApplicationId <String> [-ProvisionerApplicationSecret <String>] [[-ServiceDirectory] <String>]
[-Environment <String>] [-ResourceType <String>] [-ServicePrincipalAuth] [-Force]
[-RemoveTestResourcesRemainingArguments <Object>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Expand All @@ -32,7 +32,7 @@ Remove-TestResources.ps1 -BaseName <String> -TenantId <String> [-SubscriptionId
### ResourceGroup+Provisioner
```
Remove-TestResources.ps1 [-ResourceGroupName <String>] -TenantId <String> [-SubscriptionId <String>]
-ProvisionerApplicationId <String> -ProvisionerApplicationSecret <String> [[-ServiceDirectory] <String>]
-ProvisionerApplicationId <String> [-ProvisionerApplicationSecret <String>] [[-ServiceDirectory] <String>]
[-Environment <String>] [-CI] [-ResourceType <String>] [-ServicePrincipalAuth] [-Force]
[-RemoveTestResourcesRemainingArguments <Object>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Expand Down Expand Up @@ -184,7 +184,7 @@ Type: String
Parameter Sets: Default+Provisioner, ResourceGroup+Provisioner
Aliases:

Required: True
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Expand Down Expand Up @@ -347,7 +347,7 @@ Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
Expand Down
7 changes: 7 additions & 0 deletions eng/common/TestResources/deploy-test-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parameters:
ServiceConnection: not-specified
ResourceType: test
UseFederatedAuth: false
SubscriptionConfigurationFilePath: ''


# SubscriptionConfiguration will be splatted into the parameters of the test
Expand Down Expand Up @@ -58,6 +59,12 @@ steps:
${{ parameters.SubscriptionConfiguration }}
'@ | ConvertFrom-Json -AsHashtable;
if ('${{ parameters.SubscriptionConfigurationFilePath }}' -ne '') {
$subscriptionConfiguration = `
Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' `
| ConvertFrom-Json -AsHashtable;
}
# The subscriptionConfiguration may have ArmTemplateParameters defined, so
# pass those in via the ArmTemplateParameters flag, and handle any
# additional parameters from the pipelines via AdditionalParameters
Expand Down
7 changes: 7 additions & 0 deletions eng/common/TestResources/remove-test-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parameters:
ServiceConnection: not-specified
ResourceType: test
UseFederatedAuth: false
SubscriptionConfigurationFilePath: ''

# SubscriptionConfiguration will be splat into the parameters of the test
# resources script. It should be JSON in the form:
Expand Down Expand Up @@ -40,6 +41,12 @@ steps:
${{ parameters.SubscriptionConfiguration }}
"@ | ConvertFrom-Json -AsHashtable;
if ('${{ parameters.SubscriptionConfigurationFilePath }}' -ne '') {
$subscriptionConfiguration = `
Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' `
| ConvertFrom-Json -AsHashtable;
}
eng/common/TestResources/Remove-TestResources.ps1 `
@subscriptionConfiguration `
-ResourceType '${{ parameters.ResourceType }}' `
Expand Down

0 comments on commit 2f99b0b

Please sign in to comment.