Skip to content

Commit bd113c7

Browse files
committed
Added Tenent ID env var
1 parent 01e0405 commit bd113c7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

solution_template/vm-linux-terraform/mainTemplate.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"installParm1": "[concat(' -u ', parameters('adminUserName'))]",
9393
"installParm2": "[concat(' -s ', subscription().subscriptionId)]",
9494
"installParm3": "[concat(' -a ', variables('stateStorageAccountName'))]",
95+
"installParm4": "[concat(' -t ', subscription().tenantId)]",
9596
"resourceGuid": "[guid(resourceGroup().id)]"
9697
},
9798
"resources": [
@@ -310,7 +311,7 @@
310311
]
311312
},
312313
"protectedSettings": {
313-
"commandToExecute": "[concat('bash infra.sh && bash install.sh ', variables('installParm1'), variables('installParm2'), variables('installParm3'), ' -k ', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('stateStorageAccountName')), '2017-10-01').keys[0].value, ' -l ', reference(concat(resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName')),'/providers/Microsoft.ManagedIdentity/Identities/default'),'2015-08-31-PREVIEW').principalId)]"
314+
"commandToExecute": "[concat('bash infra.sh && bash install.sh ', variables('installParm1'), variables('installParm2'), variables('installParm3'), variables('installParm4'), ' -k ', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('stateStorageAccountName')), '2017-10-01').keys[0].value, ' -l ', reference(concat(resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName')),'/providers/Microsoft.ManagedIdentity/Identities/default'),'2015-08-31-PREVIEW').principalId)]"
314315
}
315316
}
316317
}

solution_template/vm-linux-terraform/scripts/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ while getopts :s:a:k:l:u:d: optname; do
5858
s) #azure subscription id
5959
SUBSCRIPTION_ID=${OPTARG}
6060
;;
61+
t) #azure tenant id
62+
TENANT_ID=${OPTARG}
63+
;;
6164
a) #storage account name
6265
STORAGE_ACCOUNT_NAME=${OPTARG}
6366
;;
@@ -114,6 +117,7 @@ echo "export ARM_SUBSCRIPTION_ID=\"$SUBSCRIPTION_ID\"" >> $PROFILEFILE
114117
echo "export ARM_CLIENT_ID=\"$MSI_PRINCIPAL_ID\"" >> $PROFILEFILE
115118
echo "export ARM_USE_MSI=true" >> $PROFILEFILE
116119
echo "export ARM_MSI_ENDPOINT=\"https://localhost:50342\"" >> $PROFILEFILE
120+
echo "export ARM_TENANT_ID=\"$TENANT_ID\"" >> $PROFILEFILE
117121

118122
# Add contributor permissions to the MSI for entire subscription
119123
touch $TFENVFILE

0 commit comments

Comments
 (0)