Azure / azure-cli

Azure Command-Line Interface
MIT License
3.99k stars 2.97k forks source link

Can't delete DNS record with the Complete deployment mode. #23219

Open antonGritsenko opened 2 years ago

antonGritsenko commented 2 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

The DNS record is not deleted with the Complete deployment mode.

Command Name az deployment group create

Errors:

To Reproduce:

  1. Create bicep file sample.dns.bicep:
    
    param zoneName string  = 'my.local'
    var defaultTtl = 3600

resource zone 'Microsoft.Network/dnsZones@2018-05-01' = { name: zoneName location: 'global' }

resource _root_A 'Microsoft.Network/dnsZones/A@2018-05-01' = { name: '@' parent: zone properties: { TTL: defaultTtl ARecords: [ { ipv4Address: '1.1.1.1' } ] } }

2. Run the deployment
`az deployment group create --name test1 --resource-group dns-test  --template-file .\sample.dns.bicep --mode Complete`
All good, records created
3. Change the file to (so remove the record):

param zoneName string = 'my.local' var defaultTtl = 3600

resource zone 'Microsoft.Network/dnsZones@2018-05-01' = { name: zoneName location: 'global' }

2. Run the deployment
`az deployment group create --name test1 --resource-group dns-test  --template-file .\sample.dns.bicep --mode Complete`

Deployment is OK, but record is still there.

## Expected Behavior
DNS Record deleted

## Environment Summary

Windows-10-10.0.19044-SP0 Python 3.10.4 Installer: MSI

azure-cli 2.37.0 *

Extensions: account 0.2.1 scheduled-query 0.5.0

Dependencies: msal 1.18.0b1 azure-mgmt-resource 21.1.0b1


## Additional Context

<!--Please don't remove this:-->
<!--auto-generated-->
yonzhan commented 2 years ago

ARM

ghost commented 2 years ago

Thank you for your feedback. This has been routed to the support team for assistance.

frucinski commented 1 year ago

Hello, I'm also facing the same problem. Is there any chance to resolve it in near future? My az version: azure-cli 2.51.0

viniciushsantana commented 3 months ago

Still happening on Azure CLI 2.61.0.

nikneem commented 1 month ago

This seems to be intentional, this case is described in the docs: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-modes