Reputation: 4289
I have a bicep deployment that never ends. This deployment is to setup an Azure SQL Failover Group. The first time I deploy it, it creates the failover group in about 1 minute. When I run it a second time it never completes. I have let it run for over 16 hours.
It was not doing this two days ago. I had made some minor changes, but now I have reverted to the version that was working. I've also blown away the failover group, and the Azure SQL resources, and recreated everything from scratch. The first run is quick, and the second run never returns.
The database is trivial. It doesn't even have any data.
How can I troubleshoot this?
How can I tell what operation it's hung on?
Here is my bicep, but keep in mind that this exact bicep used to work.
param failoverGroupName string
param primarySqlServerName string
param secondarySqlServerName string
param databaseName string
param secondaryResourceGroup string
resource primary 'Microsoft.Sql/servers@2022-08-01-preview' existing = {
name: primarySqlServerName
}
resource secondary 'Microsoft.Sql/servers@2022-08-01-preview' existing = {
name: secondarySqlServerName
scope: resourceGroup(secondaryResourceGroup)
}
resource sqlServerFailoverGroup 'Microsoft.Sql/servers/failoverGroups@2023-05-01-preview' = {
name: failoverGroupName
parent: primary
properties: {
databases: [
resourceId('Microsoft.Sql/servers/databases', primarySqlServerName,databaseName)
]
readWriteEndpoint: {
failoverPolicy: 'Manual'
}
partnerServers: [
{
id: secondary.id
}
]
}
}
Upvotes: 0
Views: 439
Reputation: 8018
Bicep deployment never ends:
Based on the detailed steps outlined in my response here in SO, I successfully deployed the necessary SQL failover group resource twice as expected.
In order to troubleshoot it from your side, check below factors.
Need to check below:
Try adding--mode Complete
when providing az deployment group create
command during deployment. Default mode is incremental and it might take some time to add all the resources. Adding complete mode will make things work faster without much waiting time.
Clear the cache with az cache purge
command and try deployment once again.
If still the issue persists, delete all the existing deployments with az deployment group delete
and try a new deployment.
Another approach is to attempt validation of the deployment using the provided command format. This can help identify the resources that is causing the failure.
az deployment group validate --resource-group xxxx --template-file <filename.bicep>
Resource Group >> Deployments >> Related events
The above way provides you a clear view of the deployments with the status and operation name as well.
Reference: Blog
Upvotes: -1