I would like to pass connection properties to vm as environment
variables in my arm template. Is it possible with azure templates?
As 4c74356b41 said, template does not support this directly. According to your scenario, I suggest you could use Custom Script Extension.
The Custom Script Extension downloads and executes scripts on Azure virtual machines. This extension is useful for post deployment configuration, software installation, or any other configuration / management task.
Azure custom script extension supports Linux and Windows, you could write a script that configure connection properties to vm and use extension to execute on your VMs. The custom script extension template example is like below:
"resources": [
{
"type": "extensions",
"name": "CustomScriptExtension",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"dependsOn": [
"[variables('vmName')]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.8",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[concat(parameters('_artifactsLocation'), '/', variables('ScriptFolder'), '/', variables('ScriptFileName'), parameters('_artifactsLocationSasToken'))]"
],
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('scriptFolder'), '/', variables('scriptFileName'), ' ', variables('scriptParameters'))]"
}
}
}
]
They could find many examples about this extension on Git Hub.