Skip to content

Commit d97c5ca

Browse files
author
Sheyla Trudo
committed
fixup! Artifacts
1 parent 2d255a0 commit d97c5ca

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.pipelines/templates/artifact-storage.steps.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ steps:
9696
env:
9797
SA_LIST_LENGTH: $(SA_LIST_LENGTH)
9898

99-
10099
- task: AzureCLI@2
101100
displayName: "Add Storage Account to Pool"
102101
condition: and(succeeded(), eq(variables.CREATE_NEW_SA, True))
@@ -124,13 +123,19 @@ steps:
124123
"$ACNCI_BUILDTAG_CREATEDBYBUILDID"="$BUILD_BUILDID" \
125124
"$ACNCI_BUILDTAG_CREATEDBYAPPID"="$servicePrincipalId"
126125
#--enable-files-aadds true
126+
az role assignment create \
127+
--role "Contributor" \
128+
--assignee-principal-type ServicePrincipal \
129+
--assignee-object-id "$SP_APP_OID" \
130+
--scope "$RG_ID"/providers/Microsoft.Storage/storageAccounts/"$SA_NAME"
127131
env:
128132
ACNCI_UNIQUE_ID: $(ACNCI_UNIQUE_ID)
129133
RG_NAME: $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP)
130134

131135
- template: get-storage-accounts.steps.yaml
132136
parameters:
133137
STORAGE_ACCOUNT_SERVICE_CONNECTION: $(ACN_TEST_SERVICE_CONNECTION)
138+
condition: and(succeeded(), eq(variables.SA_LIST_LENGTH, 0))
134139
resourceGroupName: $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP)
135140

136141
# Select Storage Account for use.
@@ -205,13 +210,13 @@ steps:
205210
set -e
206211
[[ -n $SYSTEM_DEBUG ]] && [[ $SYSTEM_DEBUG =~ $IS_TRUE ]] && set -x || set +x
207212
213+
az storage account show -n "$SA_NAME" --query networkRuleSet
208214
az storage container create \
209215
--account-name "$SA_NAME" \
210216
--resource-group "RG_NAME" \
211217
--name "$CONTAINER_NAME" \
212218
--auth-mode login
213219
#--public-access off
214-
az storage account show -n "$SA_NAME" --query networkRuleSet
215220
216221
echo >&2 "##vso[task.setvariable variable=ACNCI_STORAGEACCOUNT_ARTIFACT_CONTAINER;isoutput=true]$CONTAINER_NAME"
217222
env:

.pipelines/templates/get-storage-accounts.steps.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ parameters:
33
- name: STORAGE_ACCOUNT_SERVICE_CONNECTION
44
type: string
55

6+
- name: condition
7+
type: boolean
8+
default: true
9+
610
- name: resourceGroupName
711
type: string
812

@@ -14,6 +18,7 @@ steps:
1418
## Storage Account Resource Query
1519
- task: AzureCLI@2
1620
displayName: "Get Storage Account Resources"
21+
condition: ${{ parameters.condition }}
1722
inputs:
1823
azureSubscription: ${{ parameters.STORAGE_ACCOUNT_SERVICE_CONNECTION }}
1924
scriptType: bash

0 commit comments

Comments
 (0)