@@ -20,32 +20,6 @@ steps:
2020 echo >&2 "##vso[task.setvariable variable=SUBSCRIPTION_ID]$SUBSCRIPTION_ID"
2121
2222
23- - task : AzureCLI@2
24- displayName : " [Provision] Build User Owner Role Definition"
25- inputs :
26- azureSubscription : $(ACN_TEST_SERVICE_CONNECTION)
27- scriptType : bash
28- scriptLocation : inlineScript
29- addSpnToEnvironment : true
30- inlineScript : |
31- set -e
32- [[ -n $SYSTEM_DEBUG ]] && [[ $SYSTEM_DEBUG =~ $IS_TRUE ]] && set -x || set +x
33-
34- set -x
35- pwd
36- ls -la
37- DEFS_FOUND=$(az role definition list --name "$ACNCI_BUILDUSER_ROLE_NAME" --custom-role-only -ojson | jq length)
38-
39- DEF=$(cat ./azure-container-networking/.pipelines/templates/mi-build-role.json | jq -rc '.')
40- if (( $DEFS_FOUND < 1 )); then
41- az role definition create \
42- --role-definition "$DEF"
43- else
44- az role definition update \
45- --role-definition "$DEF"
46- fi
47-
48-
4923# # Resource Groups ##
5024- bash : |
5125 set -x
@@ -239,6 +213,36 @@ steps:
239213
240214
241215# # MI Role Assignments ##
216+ - task : AzureCLI@2
217+ displayName : " [Provision] Build User Owner Role Definition"
218+ inputs :
219+ azureSubscription : $(ACN_TEST_SERVICE_CONNECTION)
220+ scriptType : bash
221+ scriptLocation : inlineScript
222+ addSpnToEnvironment : true
223+ inlineScript : |
224+ set -e
225+ [[ -n $SYSTEM_DEBUG ]] && [[ $SYSTEM_DEBUG =~ $IS_TRUE ]] && set -x || set +x
226+
227+ set -x
228+ pwd
229+ ls -la
230+ DEFS_FOUND=$(az role definition list --name "$ACNCI_BUILDUSER_ROLE_NAME" --custom-role-only -ojson | jq length)
231+
232+ DEF=$(cat ./azure-container-networking/.pipelines/templates/mi-build-role.json | \
233+ jq -rc \
234+ --arg RESOURCE_GROUP_ID "$ACNCI_BUILD_RESOURCEGROUP_ID" \
235+ -rc '.')
236+ if (( $DEFS_FOUND < 1 )); then
237+ az role definition create \
238+ --role-definition "$DEF"
239+ else
240+ az role definition update \
241+ --role-definition "$DEF"
242+ fi
243+ env :
244+ ACNCI_BUILD_RESOURCEGROUP_ID : $(resourcegroups.ACNCI_BUILD_RESOURCEGROUP_ID)
245+
242246- task : AzureCLI@2
243247 displayName : " [Check] Build User MI Roles"
244248 inputs :
0 commit comments