The ARM template example lists
"APPINSIGHTS_INSTRUMENTATIONKEY": "[concat('@Microsoft.KeyVault(SecretUri=', reference(variables('appInsightsKeyResourceId')).secretUriWithVersion, ')')]",
as a way to get the SecretUri with the required version. But it's not clear what appInsightsKeyResourceId
is.
Can you elaborate on what that variable's value is?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@rwatjen Thanks for the feedback! We are currently investigating and will update you shortly.
@rwatjen appInsightsKeyResourceId
is a variable that you can use to add application insights to your deployment template. See https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authoring-templates#variables for more information. In this case, you would set it to the instrumentation key of an existing application insights resource.
Hope this helps but if not, please feel free to reach back out to us.
I know it is a variable, that wasn't what I meant. The variable appInsightsKeyResourceId
is referenced, but it is not declared in the example, so it wasn't clear to me how to get to the secretUriWithVersion
property.
I have figured out the solution to my problem, though.
You can get the resource ID with the resourceId
ARM function:
resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), variables('secretName'))
For keyvault secrets, it requires the keyvault and secret names.
Then, to reference that ARM resource, use the reference
function with the resource ID as parameter. The result of the reference
function is the keyvault secret, which has the secretUriWithVersion
property.
Combined into an app setting, like in the example it goes like this:
"SecretSettingsValue": "[concat('@Microsoft.KeyVault(SecretUri=', reference(resourceId('Microsoft.KeyVault/vaults/secrets', variables('keyVaultName'), variables('secretName'))).secretUriWithVersion, ')')]"
why the last comment from @rwatjen was not added to the documentation?
Thanks to @rwatjen. His comment has to be part of the official documentation.
Why the issue is closed without fixing documentation?
https://docs.microsoft.com/en-us/azure/app-service/app-service-key-vault-references
Documentation still doesn't contain the explanation about Id variable.
Is it a new style to get the results report, closing issues without fixing real problems?
Most helpful comment
I know it is a variable, that wasn't what I meant. The variable
appInsightsKeyResourceId
is referenced, but it is not declared in the example, so it wasn't clear to me how to get to thesecretUriWithVersion
property.I have figured out the solution to my problem, though.
You can get the resource ID with the
resourceId
ARM function:For keyvault secrets, it requires the keyvault and secret names.
Then, to reference that ARM resource, use the
reference
function with the resource ID as parameter. The result of thereference
function is the keyvault secret, which has thesecretUriWithVersion
property.Combined into an app setting, like in the example it goes like this: