It is inconvenient that you cannot use the resourceId() function because it can derive the subscription/resource group name being deployed to for you.
This does not work
"reference": {
"keyVault": {
"id": "[resourceId('Microsoft.KeyVault/vaults','test-kv')]"
},
"secretName": "admin-password"
}
If you try to do this, you get the below error
New-AzureRmResourceGroupDeployment : 1:19:17 PM - Resource Microsoft.Resources/deployments
'deployment_20160527-124400' failed with message 'The resource identifier of
the KeyVault parameter 'adminPassword' is invalid. Please specify the value following 'subscriptions/{s
ubscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'
format. See http://aka.ms/arm-keyvault for usage details.'
Can you add support for this? If it doesn't make sense to put function calls in a parameter file, an alternative might be something like this:
"reference": {
"keyVault": {
"subscriptionName": "Visual Studio Enterprise",
"resourceGroupName": "test-rg",
"vaultName": "test-kv"
},
"secretName": "admin-password"
}
Where subscription name and resource group name are optional (defaults to subscription/resource group deployment is deploying to)
@rjmax @ravbhatnagar Template language feature request for you guys
Any updates on this ??
Also wondering if there are any updates on this. I'm seeing a similar error when trying to use a variable for the vault ID.
Parameters JSON:
"variables": {
"vaultId": "/subscriptions/<sub id>/resourceGroups/<rg>/providers/Microsoft.KeyVault/vaults/<vault>"
},
"parameters": {
"Security:ExampleSecret": {
"reference": {
"keyVault": {
"id": "[variables('vaultId')]"
},
"secretName": "ExampleSecret"
}
}
}
VSTS output:
2018-05-15T19:57:26.5586733Z There were errors in your deployment. Error code: KeyVaultParameterReferenceInvalidResourceId.
2018-05-15T19:57:26.5742974Z ##[error]The resource identifier of the KeyVault parameter 'Security:ExampleSecret' is invalid. Please specify the value following 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}' format. See https://aka.ms/arm-keyvault for usage details.
2018-05-15T19:57:26.5742974Z ##[error]Task failed while creating or updating the template deployment.
Also having the same issue. I've tried using variables and resourceId directly.
Any update on this ?
Is this not supported yet?
Do we have any documentation saying this is not supported?
Any updates? This issue was opened in 2016!
This is quite an essential feature.
is there anybody who can give us and updates ??? ........!!!!! almost 3 years guys please
It seems that concat function inside "reference id" is not expanded correctly either.
In parameters file:
"adminPassword": {
"reference": {
"keyVault": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/keyvault-rg/providers/Microsoft.KeyVault/vaults/my-keyvault')]"
},
"secretName": "adminPasswordKey"
}
}
Output:
code: KeyVaultParameterReferenceInvalidResourceId
Message: The resource identifier of the KeyVault parameter 'adminPassword' is invalid. Please specify the value following '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}' format. See https://aka.ms/arm-keyvault for usage details.
This is subscription deployment. However, similar example from docs implemented as group deployment works.
interestingly - as per docs section - You can't dynamically generate the resource ID in the parameters file because template expressions aren't allowed in the parameters file.
Most helpful comment
Also wondering if there are any updates on this. I'm seeing a similar error when trying to use a variable for the vault ID.
Parameters JSON:
VSTS output: