@@ -103,7 +103,7 @@ function ShouldMarkValueAsSecret([string]$serviceName, [string]$key, [string]$va
103
103
104
104
function SetSubscriptionConfiguration ([object ]$subscriptionConfiguration )
105
105
{
106
- foreach ($pair in $subscriptionConfiguration.GetEnumerator ()) {
106
+ foreach ($pair in $subscriptionConfiguration.GetEnumerator ()) {
107
107
if ($pair.Value -is [Hashtable ]) {
108
108
foreach ($nestedPair in $pair.Value.GetEnumerator ()) {
109
109
# Mark values as secret so we don't print json blobs containing secrets in the logs.
@@ -126,36 +126,32 @@ function SetSubscriptionConfiguration([object]$subscriptionConfiguration)
126
126
}
127
127
}
128
128
129
- Write-Host ($subscriptionConfiguration | ConvertTo-Json )
130
- $serialized = $subscriptionConfiguration | ConvertTo-Json - Compress
131
- Write-Host " ##vso[task.setvariable variable=SubscriptionConfiguration;]$serialized "
129
+ return $subscriptionConfiguration
132
130
}
133
131
134
132
function UpdateSubscriptionConfiguration ([object ]$subscriptionConfigurationBase , [object ]$subscriptionConfiguration )
135
133
{
136
- foreach ($pair in $subscriptionConfiguration.GetEnumerator ()) {
137
- if ($pair.Value -is [Hashtable ]) {
138
- if (! $subscriptionConfigurationBase.ContainsKey ($pair.Name )) {
139
- $subscriptionConfigurationBase [$pair.Name ] = @ {}
140
- }
141
- foreach ($nestedPair in $pair.Value.GetEnumerator ()) {
142
- # Mark values as secret so we don't print json blobs containing secrets in the logs.
143
- # Prepend underscore to the variable name, so we can still access the variable names via environment
144
- # variables if they get set subsequently.
145
- if (ShouldMarkValueAsSecret " AZURE_" $nestedPair.Name $nestedPair.Value ) {
146
- Write-Host " ##vso[task.setvariable variable=_$ ( $nestedPair.Name ) ;issecret=true;]$ ( $nestedPair.Value ) "
147
- }
148
- $subscriptionConfigurationBase [$pair.Name ][$nestedPair.Name ] = $nestedPair.Value
149
- }
150
- } else {
151
- if (ShouldMarkValueAsSecret " AZURE_" $pair.Name $pair.Value ) {
152
- Write-Host " ##vso[task.setvariable variable=_$ ( $pair.Name ) ;issecret=true;]$ ( $pair.Value ) "
134
+ foreach ($pair in $subscriptionConfiguration.GetEnumerator ()) {
135
+ if ($pair.Value -is [Hashtable ]) {
136
+ if (! $subscriptionConfigurationBase.ContainsKey ($pair.Name )) {
137
+ $subscriptionConfigurationBase [$pair.Name ] = @ {}
138
+ }
139
+ foreach ($nestedPair in $pair.Value.GetEnumerator ()) {
140
+ # Mark values as secret so we don't print json blobs containing secrets in the logs.
141
+ # Prepend underscore to the variable name, so we can still access the variable names via environment
142
+ # variables if they get set subsequently.
143
+ if (ShouldMarkValueAsSecret " AZURE_" $nestedPair.Name $nestedPair.Value ) {
144
+ Write-Host " ##vso[task.setvariable variable=_$ ( $nestedPair.Name ) ;issecret=true;]$ ( $nestedPair.Value ) "
153
145
}
154
- $subscriptionConfigurationBase [$pair.Name ] = $pair .Value
146
+ $subscriptionConfigurationBase [$pair.Name ][ $nestedPair .Name ] = $nestedPair .Value
155
147
}
148
+ } else {
149
+ if (ShouldMarkValueAsSecret " AZURE_" $pair.Name $pair.Value ) {
150
+ Write-Host " ##vso[task.setvariable variable=_$ ( $pair.Name ) ;issecret=true;]$ ( $pair.Value ) "
151
+ }
152
+ $subscriptionConfigurationBase [$pair.Name ] = $pair.Value
156
153
}
154
+ }
157
155
158
- $serialized = $subscriptionConfigurationBase | ConvertTo-Json - Compress
159
- Write-Host ($subscriptionConfigurationBase | ConvertTo-Json )
160
- Write-Host " ##vso[task.setvariable variable=SubscriptionConfiguration;]$serialized "
156
+ return $subscriptionConfigurationBase
161
157
}
0 commit comments