Added Tenent ID env var

This commit is contained in:
Jeffrey Cline 2018-02-28 15:01:25 -08:00
parent 01e04057a5
commit bd113c744f
2 changed files with 6 additions and 1 deletions

View File

@ -92,6 +92,7 @@
"installParm1": "[concat(' -u ', parameters('adminUserName'))]",
"installParm2": "[concat(' -s ', subscription().subscriptionId)]",
"installParm3": "[concat(' -a ', variables('stateStorageAccountName'))]",
"installParm4": "[concat(' -t ', subscription().tenantId)]",
"resourceGuid": "[guid(resourceGroup().id)]"
},
"resources": [
@ -310,7 +311,7 @@
]
},
"protectedSettings": {
"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)]"
"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)]"
}
}
}

View File

@ -58,6 +58,9 @@ while getopts :s:a:k:l:u:d: optname; do
s) #azure subscription id
SUBSCRIPTION_ID=${OPTARG}
;;
t) #azure tenant id
TENANT_ID=${OPTARG}
;;
a) #storage account name
STORAGE_ACCOUNT_NAME=${OPTARG}
;;
@ -114,6 +117,7 @@ echo "export ARM_SUBSCRIPTION_ID=\"$SUBSCRIPTION_ID\"" >> $PROFILEFILE
echo "export ARM_CLIENT_ID=\"$MSI_PRINCIPAL_ID\"" >> $PROFILEFILE
echo "export ARM_USE_MSI=true" >> $PROFILEFILE
echo "export ARM_MSI_ENDPOINT=\"https://localhost:50342\"" >> $PROFILEFILE
echo "export ARM_TENANT_ID=\"$TENANT_ID\"" >> $PROFILEFILE
# Add contributor permissions to the MSI for entire subscription
touch $TFENVFILE