-
Notifications
You must be signed in to change notification settings - Fork 7
/
azcli-last-steps-template.yml
37 lines (34 loc) · 1.09 KB
/
azcli-last-steps-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
parameters:
environment: someenv
applicationName: gridwich
steps:
- bash: |
set -eu
cat ./variables.json
cat ./variables.json | jq -r '
. as $in
| keys[]
| ["##vso[task.setvariable variable=" + . + "]" + ($in[.] | tostring)]
| @tsv'
name: TerraformOutputs
displayName: Export variables outputs
workingDirectory: $(Pipeline.Workspace)/variables_${{ parameters.environment }}_top
- task: AzureCLI@2
displayName: 'Turn on Storage Analytics for all Storage accounts'
inputs:
azureSubscription: ${{parameters.serviceConnection}}
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
set -eu
storaccts=$(az storage account list --query [].name -o tsv)
for acct in $storaccts
{
if [[ $acct =~ '${{ parameters.environment }}'$ ]]; then
echo "Setting Storage Analytics for $acct"
az storage logging update --log rwd --retention 365 --services b --account-name $acct 2> /dev/null
else
echo "Ignored Storage Analytics for $acct"
fi
}
addSpnToEnvironment: true