I have a large, complex Azure BICEP deployment script. It works 100%, however I get an intermittent transient error from Azure.
{
"code": "DeploymentFailed",
"target": "/subscriptions/xx-xx-xx-xx-xx/resourceGroups/xx-xx-rg-tst-xx-eus-99/providers/Microsoft.Resources/deployments/webAppSubCreateWeb-xx-xx-app-xx-tst-aty-eus-99-dev",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
"details": [
{
"code": "InternalServerError",
"message": "There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: xxxx"
}
]
}
The error will always happen when deploying a web app from an string array; it’s not always the same web app. A lot of times there is no error.
Am I doing anything wrong? Can I do anything better to protect my deployment from InternalServerError?
‘main’
@batchSize(6)
module webAppSubCreateApi 'webAppSubCreate.bicep' = [for (web,i) in webApplicationsToCreateApi: {
name: 'webAppSubCreateApi-${web}'
params: {
location: location
createAppServicePlanId: createAppServicePlanApi.id
identityId: identity.id
vnetSubNetId: vnetSubNetId
webapp: web
appInsightsConnectionString: appInsights.properties.ConnectionString
}
dependsOn: [createAppServicePlanApi, identity, workspace]
}]
Module
param webapp string
param location string
param identityId string
param createAppServicePlanId string
param vnetSubNetId string
param appInsightsConnectionString string
//create web app instances, one for each web application in the list webApplicationsToCreate
resource createWebApp 'Microsoft.Web/sites@2023-01-01' = {
name: webapp
location: location
kind: 'windows'
identity: {
type:'UserAssigned'
userAssignedIdentities: {
'${identityId}': {}
}
}
properties: {
httpsOnly: true
serverFarmId: createAppServicePlanId
reserved: false
vnetRouteAllEnabled: false
siteConfig:{
alwaysOn:true
netFrameworkVersion: '6.0'
metadata:[
{
name: 'CURRENT_STACK'
value: 'dotnet'
}
{
name: 'netFrameworkVersion'
value: 'v6.0'
}
]
appSettings:[
{
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
value: appInsightsConnectionString
}
]
}
virtualNetworkSubnetId:vnetSubNetId
}
}
output webappparentname string = createWebApp.name