Skip to content

Commit 445750f

Browse files
fix(assign-arc-app-roles): add subscription parameter to connectedmachine calls
1 parent eb5a325 commit 445750f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

scripts/bash/assign_arc_app_roles.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
set -eu
33

44
ENV_CONFIG="$1"
5+
SUBSCRIPTION="$2"
56

67
enterpriseAppName="spn-manbrs-web-api-${ENV_CONFIG}"
78
rgName="rg-mbsgw-${ENV_CONFIG}-uks-arc-enabled-servers"
@@ -20,7 +21,7 @@ echo "SP object ID: $spObjectId"
2021
echo "App role ($appRoleValue): $appRoleId"
2122

2223
echo "Listing Arc machines in: $rgName"
23-
arcMachines=$(az connectedmachine list --resource-group "$rgName" --query "[].name" -o tsv)
24+
arcMachines=$(az connectedmachine list --resource-group "$rgName" --subscription "$SUBSCRIPTION" --query "[].name" -o tsv)
2425

2526
if [ -z "$arcMachines" ]; then
2627
echo "No Arc machines found in $rgName"
@@ -33,6 +34,7 @@ while IFS= read -r machine; do
3334
miPrincipalId=$(az connectedmachine show \
3435
--resource-group "$rgName" \
3536
--name "$machine" \
37+
--subscription "$SUBSCRIPTION" \
3638
--query "identity.principalId" -o tsv)
3739

3840
echo "Assigning $appRoleValue to $machine (MI: $miPrincipalId)..."

0 commit comments

Comments
 (0)