-
Notifications
You must be signed in to change notification settings - Fork 267
Description
- Make sure you've installed the latest version using instructions in the wiki
Output from azd version
azd version 0.5.0-beta.4-pr.2128509 (commit 8b3f34d)
Output from az version
{
"azure-cli": "2.40.0",
"azure-cli-core": "2.40.0",
"azure-cli-telemetry": "1.0.8",
"extensions": {
"containerapp": "0.3.11",
"containerapp-compose": "0.2.2"
}
}
Describe the bug
After an unsuccessful azd up (with a Key Vault related failure), a subsequent azd up results in this error:
ERROR: planning deployment: planning infrastructure provisioning: creating parameters file: substituting command output inside parameter file: reading secret 'postgresPassword' from vault 'flasksurveys-xvmc-vault': getting key vault secret: GET https://flasksurveys-xvmc-vault.vault.azure.net/secrets/postgresPassword/
--------------------------------------------------------------------------------
RESPONSE 403: 403 Forbidden
ERROR CODE: Forbidden
--------------------------------------------------------------------------------
{
"error": {
"code": "Forbidden",
"message": "The user, group or application 'appid=04b07795-8ddb-461a-bbee-02f9e1bf7b46;oid=05c421f6-d446-4f2a-8ee0-1060b47b1543;numgroups=649;iss=https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/' does not have secrets get permission on key vault 'flasksurveys-xvmc-vault;location=eastus'. For help resolving this issue, please see https://go.microsoft.com/fwlink/?linkid=2125287",
"innererror": {
"code": "AccessDenied"
}
}
}
--------------------------------------------------------------------------------
To Reproduce
You need to have a repo which has a key vault that doesn't finish provisioning correctly. I don't have the exact code committed, but for me, that happened when I attempted to create two secrets at once:
module keyVault './core/security/keyvault.bicep' = {
name: 'keyvault'
scope: resourceGroup
params: {
name: '${take(prefix, 17)}-vault'
location: location
tags: tags
principalId: principalId
}
}
module keyVaultSecret1 './core/security/keyvault-secret.bicep' = { name: 'keyvault-secret1' scope: resourceGroup params: { keyVaultName: keyVault.outputs.name name: 'DBPASS' secretValue: postgresPassword }}
module keyVaultSecret2 './core/security/keyvault-secret.bicep' = { name: 'keyvault-secret2' scope: resourceGroup params: { keyVaultName: keyVault.outputs.name name: 'FLASK_SECRET' secretValue: flaskSecret } dependsOn: [keyVault, keyVaultSecret1]}
Both of those were generated with secretOrRandom password:
"postgresPassword": {
"value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} postgresPassword)"
},
"flaskSecret": {
"value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} flaskSecret)"
}
Expected behavior
Good question! It could output a warning that there was an issue accessing the key vault and re-generate the secrets. Or it could suggest starting over and clearing all the env variables (that's what I do manually right now). Starting over probably safer?
I don't know how often people will run into this, so I'm mostly logging as an FYI and for discoverability.
Environment
Mac M1 Ventura, Terminal app