bicep resource deletion using --mode complete
Let's say you created azure resources using the following bicep file and deploy it using:
az deployment group create -f ./servicebus.bicep -g exampleRG
@description('Location for all resources.')
param location string = resourceGroup().location
@description('')
resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' = {
name: 'mytestservicebusjerwo'
location: location
sku: {
name: 'Basic'
capacity: 1
tier: 'Basic'
}
}
resource serviceBusQueue 'Microsoft.ServiceBus/namespaces/queues@2022-01-01-preview' = {
parent: serviceBusNamespace
name: 'myqueue'
properties: {
lockDuration: 'PT5M'
maxSizeInMegabytes: 1024
requiresDuplicateDetection: false
requiresSession: false
//defaultMessageTimeToLive: 'P10675199DT2H48M5.4775807S'
deadLetteringOnMessageExpiration: false
duplicateDetectionHistoryTimeWindow: 'PT2M'
maxDeliveryCount: 10
//autoDeleteOnIdle: 'P10675199DT2H48M5.4775807S'
enablePartitioning: false
enableExpress: false
}
}
output name string = serviceBusNamespace.name
output sku string = serviceBusNamespace.sku.name
To remove resources, you might need to remove the namespace code. Also noticed that removing queues does not seems to trigger resource deletion
@description('Location for all resources.')
param location string = resourceGroup().location
If you have the code above, then running command below would work.
az deployment group create -f ./servicebus.bicep -g exampleRG --mode Complete
So i guess it might not worked with all resources types.
Comments