Skip to content

Commit e8bab97

Browse files
author
Sheyla Trudo
committed
fixup! Move to Resource Module
1 parent f6b031c commit e8bab97

File tree

2 files changed

+25
-43
lines changed

2 files changed

+25
-43
lines changed

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

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ steps:
236236
updateCondition: False
237237
inputs:
238238
storageAccountName: '$(ACNCI_SA_PREFIX)$(LOCAL_ACNCI_UNIQUE_ID)'
239+
storageAccountLocation: $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP_LOCATION)
239240
resourceGroupName: $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP)
240-
resourceGroupLocation: $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP_LOCATION)
241241
managedIdentityResourceId: $(managedidentity.ACNCI_MANAGEDIDENTITY_ID)
242242
buildTagDefinitionIdKey: $(ACNCI_BUILDTAG_DEFINITIONID)
243243
buildTagCreatedByAppIdKey: $(ACNCI_BUILDTAG_CREATEDBYAPPID)
@@ -291,28 +291,6 @@ steps:
291291
SA_LIST_LENGTH: $(OUT_RESULT_LENGTH)
292292
SA_SERVICE_CONN: $(ACN_TEST_SERVICE_CONNECTION)
293293

294-
- task: AzureCLI@2
295-
displayName: "[Provision] Container Access Permissions"
296-
continueOnError: true
297-
inputs:
298-
azureSubscription: $(ACN_TEST_SERVICE_CONNECTION)
299-
scriptType: bash
300-
scriptLocation: inlineScript
301-
addSpnToEnvironment: true
302-
inlineScript: |
303-
set -e
304-
[[ -n $SYSTEM_DEBUG ]] && [[ $SYSTEM_DEBUG =~ $IS_TRUE ]] && set -x || set +x
305-
306-
az role assignment create \
307-
--role "Storage Blob Data Contributor" \
308-
--assignee "$ACNCI_MANAGEDIDENTITY_OBJECTID" \
309-
--assignee-principal-type "ServicePrincipal" \
310-
--scope "$ACNCI_STORAGEACCOUNT_ID"
311-
env:
312-
ACNCI_BUILD_RESOURCEGROUP_ID: $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP_ID)
313-
ACNCI_MANAGEDIDENTITY_OBJECTID: $(managedidentity.ACNCI_MANAGEDIDENTITY_OBJECTID)
314-
ACNCI_STORAGEACCOUNT_ID: $(storageaccounts.ACNCI_STORAGEACCOUNT_ID)
315-
316294
- task: AzureCLI@2
317295
name: artifact_container
318296
displayName: "[Output] Ensure Storage Container"
@@ -325,14 +303,12 @@ steps:
325303
set -e
326304
[[ -n $SYSTEM_DEBUG ]] && [[ $SYSTEM_DEBUG =~ $IS_TRUE ]] && set -x || set +x
327305
328-
az login --identity "$ACNCI_MANAGEDIDENTITY_ID"
329306
az storage account show -n "$SA_NAME" --query networkRuleSet
330307
az storage container create \
331308
--account-name "$SA_NAME" \
332309
--resource-group "$RG_NAME" \
333310
--name "$CONTAINER_NAME" \
334311
--auth-mode login
335-
#--public-access off
336312
337313
echo >&2 "##vso[task.setvariable variable=ACNCI_STORAGEACCOUNT_ARTIFACT_CONTAINER;isoutput=true]$CONTAINER_NAME"
338314
env:
@@ -341,6 +317,28 @@ steps:
341317
SA_NAME: $(artifact_storage.ACNCI_STORAGEACCOUNT_NAME)
342318
ACNCI_MANAGEDIDENTITY_ID: $(managedidentity.ACNCI_MANAGEDIDENTITY_ID)
343319

320+
- task: AzureCLI@2
321+
displayName: "[Provision] Container Access Permissions"
322+
continueOnError: true
323+
inputs:
324+
azureSubscription: $(ACN_TEST_SERVICE_CONNECTION)
325+
scriptType: bash
326+
scriptLocation: inlineScript
327+
addSpnToEnvironment: true
328+
inlineScript: |
329+
set -e
330+
[[ -n $SYSTEM_DEBUG ]] && [[ $SYSTEM_DEBUG =~ $IS_TRUE ]] && set -x || set +x
331+
332+
az role assignment create \
333+
--role "Storage Blob Data Contributor" \
334+
--assignee "$ACNCI_MANAGEDIDENTITY_OBJECTID" \
335+
--assignee-principal-type "ServicePrincipal" \
336+
--scope "$ACNCI_STORAGEACCOUNT_ID"
337+
env:
338+
ACNCI_BUILD_RESOURCEGROUP_ID: $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP_ID)
339+
ACNCI_MANAGEDIDENTITY_OBJECTID: $(managedidentity.ACNCI_MANAGEDIDENTITY_OBJECTID)
340+
ACNCI_STORAGEACCOUNT_ID: $(storageaccounts.ACNCI_STORAGEACCOUNT_ID)
341+
344342
- task: AzureCLI@2
345343
name: artifact_blob
346344
displayName: "[Output] Get Blob Path"

.pipelines/templates/create-or-update-resource.steps.yaml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ steps:
5454
${{ elseif eq(parameters.resourceType, 'storageaccounts') }}:
5555
MANAGEDIDENTITY_ARMID: ${{ parameters.inputs.managedIdentityResourceId }}
5656
RESOURCEGROUP_NAME: ${{ parameters.inputs.resourceGroupName }}
57-
RESOURCEGROUP_LOCATION: ${{ parameters.inputs.resourceGroupLocation }}
57+
STORAGEACCOUNT_LOCATION: ${{ parameters.inputs.storageAccountLocation }}
5858
STORAGEACCOUNT_NAME: ${{ parameters.inputs.storageAccountName }}
5959

6060
${{ elseif eq(parameters.resourceType, 'roledefinition') }}:
@@ -100,31 +100,15 @@ steps:
100100
#[[ -n $SYSTEM_DEBUG ]] && [[ $SYSTEM_DEBUG =~ $IS_TRUE ]] && set -x || set +x
101101
az upgrade -y
102102
103-
echo "az storage account create "
104-
echo "--name "$STORAGEACCOUNT_NAME" "
105-
echo "--location "$RESOURCEGROUP_LOCATION" "
106-
echo "--resource-group "$RESOURCEGROUP_NAME" "
107-
echo "--user-identity-id "$MANAGEDIDENTITY_ARMID" "
108-
echo "--user-identity-type UserAssigned "
109-
echo "--allow-blob-public-access false "
110-
echo "--allow-shared-key-access false "
111-
echo "--tags "$BUILDTAG_DEFINITIONID"="$SYSTEM_DEFINITIONID" "
112-
echo ""$BUILDTAG_CREATEDBYBUILDID"="$BUILD_BUILDID" "
113-
echo ""$BUILDTAG_CREATEDBYAPPID"="$servicePrincipalId""
114103
az storage account create \
115104
--name "$STORAGEACCOUNT_NAME" \
116-
--location "$RESOURCEGROUP_LOCATION" \
105+
--location "$STORAGEACCOUNT_LOCATION" \
117106
--resource-group "$RESOURCEGROUP_NAME" \
118-
--user-identity-id "$MANAGEDIDENTITY_ARMID" \
119-
--user-identity-type UserAssigned \
120107
--allow-blob-public-access false \
121108
--allow-shared-key-access false \
122109
--tags "$BUILDTAG_DEFINITIONID"="$SYSTEM_DEFINITIONID" \
123110
"$BUILDTAG_CREATEDBYBUILDID"="$BUILD_BUILDID" \
124111
"$BUILDTAG_CREATEDBYAPPID"="$servicePrincipalId"
125-
#--enable-files-aad-integration true
126-
#--assign-identity "$ACNCI_MANAGEDIDENTITY_OBJECTID"
127-
#--default-action Deny
128112
129113
${{ elseif eq(parameters.resourceType, 'roledefinition') }}:
130114
inlineScript: |

0 commit comments

Comments
 (0)