Output from azd version
azd version 0.1.0-beta.5 (commit 7bd25dd6f1b1899abf63b5f6f36d268a465183e4)
Output from az version
{
"azure-cli": "2.38.0",
"azure-cli-core": "2.38.0",
"azure-cli-telemetry": "1.0.6",
"extensions": {
"containerapp": "0.3.5",
"log-analytics": "0.2.2",
"rdbms-connect": "1.0.2"
}
}
Describe the bug
Cannot run azd down because AZD reads resourceGroup names from deployment groups and finds a group name that has not been deployed.
Error: listing resource group rg-azd-conditional2: failed running az resource list: exit code: 3, stdout: , stderr: ERROR: (ResourceGroupNotFound) Resource group 'rg-azd-conditional2' could not be found.
Code: ResourceGroupNotFound
Message: Resource group 'rg-azd-conditional2' could not be found.
: exit status 3
To Reproduce
azd init
- Choose a template (I chose todo-csharp-cosmos-sql)
- Open
main.bicep and add the following
resource resourceGroup2 'Microsoft.Resources/resourceGroups@2021-04-01' = if (false) {
name: '${abbrs.resourcesResourceGroups}${name}2'
location: location
tags: tags
}
module secondaryResources 'resources.bicep' = if (false) {
name: 'resources2'
scope: resourceGroup2
params: {
location: location
principalId: principalId
resourceToken: resourceToken
tags: tags
}
}
- Run
azd provision
- Observe - Verify the 2nd resource group was not deployed
- Run
azd down --no-prompt --force
- Observe - The command will fail with error message shown above
- Run
az deployment sub show -n {name}
- Observe - The 2nd resource group was not deployed because the conditional is false but the deployment included it in the description. This causes the
azd command to fail because it thinks 2 resource groups were deployed.
Expected behavior
Expected azd down to delete resources
Environment
Information on your environment:
* Ran from PowerShell
Output from
azd versionOutput from
az versionDescribe the bug
Cannot run
azd downbecause AZD reads resourceGroup names from deployment groups and finds a group name that has not been deployed.To Reproduce
azd initmain.bicepand add the followingazd provisionazd down --no-prompt --forceaz deployment sub show -n {name}azdcommand to fail because it thinks 2 resource groups were deployed.Expected behavior
Expected
azd downto delete resourcesEnvironment
Information on your environment:
* Ran from PowerShell