The Farmer library has builder for Virtual machine creation, though it has support for parameter "diagnostics_support_external" which enables the boot diagnostics with existing created storage account.
let storageAccount = LinkedResource.Unmanaged resourceId
vm {
diagnostics_support_external storageAccount
}
But it generates the incorrect arm template. Currently it generates the arm template with following property attached to it.
"properties": {
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference('sa0ce3c1e410a5ec454941').primaryEndpoints.blob]"
}
},
The above generated templates fail to create resources as Azure complains with following error
{
"code": "InvalidTemplate",
"message": "Deployment template validation failed: 'The template reference 'sa0ce3c1e410a5ec454941' is not valid: could not find template resource or resource copy with this name. Please see https://aka.ms/arm-template-expressions/#reference for usage details.'."
}
The correct template should look like this, as after this modification Azure is able to resolve the Storage Account resource.
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', 'sa0ce3c1e410a5ec454941'),'2015-06-15').primaryEndpoints.blob]"
}
},
Can anyone help.