Azure Communication Services deploy fails due to InvalidResourceOperation

Tim Joosten 20 Reputation points
2023-06-13T11:19:21.59+00:00

The first run deploying communication services using the Bicep file below succeeds. However when deploying a second time the deployment fails due to an InvalidResourceOperation error. Could anyone tell me how to solve this issue?

When removing the resources and rerunning deployment resources are successfully created.

{
  "code": "DeploymentFailed",
  "target": "/subscriptions/711699cf-05b7-4ec1-948b-65637bfb0de0/resourceGroups/sso-dev/providers/Microsoft.Resources/deployments/nexusCommunications-20230613.3",
  "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": "InvalidResourceOperation",
      "message": "The operation for resource '/subscriptions/711699cf-05b7-4ec1-948b-65637bfb0de0/resourceGroups/sso-dev/providers/Microsoft.Communication/communicationServices/coms-hsks-nxs-dev-we' is invalid as it is being provisioned with state: 'Accepted'."
    }
  ]
}
// https://learn.microsoft.com/en-us/azure/templates/microsoft.communication/communicationservices?pivots=deployment-language-bicep
// https://learn.microsoft.com/en-us/azure/templates/microsoft.communication/emailservices?pivots=deployment-language-bicep

param communicationsName string
param communicationsEmailName string
param domainUsername string
param domainDisplayName string

resource communicationsEmail 'Microsoft.Communication/emailServices@2023-03-01-preview' = {
  name: communicationsEmailName
  location: 'global'
  tags: {}
  properties: {
    dataLocation: 'Europe'
  }
}

resource communicationsEmailDomain 'Microsoft.Communication/emailServices/domains@2023-03-01-preview' = {
  name: 'AzureManagedDomain'
  location: 'global'
  parent: communicationsEmail
  properties: {
    domainManagement: 'AzureManaged'
    userEngagementTracking: 'Disabled'
  }
}

resource communicationsEmailDomainSendUsername 'Microsoft.Communication/emailServices/domains/senderUsernames@2023-03-01-preview' = {
  name: domainUsername
  parent: communicationsEmailDomain
  properties: {
    displayName: domainDisplayName
    username: domainUsername
  }
}

resource communications 'Microsoft.Communication/communicationServices@2023-03-01-preview' = {
  name: communicationsName
  location: 'global'
  tags: {}
  properties: {
    dataLocation: 'Europe'
    linkedDomains: [
      communicationsEmailDomain.id
    ]
  }
}

// Determine our connection string
var communicationsConnectionString = listKeys(communications.id, communications.apiVersion).primaryConnectionString

// Output our variables
output communicationsConnectionString string = communicationsConnectionString
output communicationsEmailDomainName string = communicationsEmailDomain.name
Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
684 questions
{count} votes

Accepted answer
  1. Tushar Kumar 3,226 Reputation points MVP
    2023-06-13T11:35:08.1233333+00:00

    Try changing the name to someting else seems like some previous deployment

    coms-hsks-nxs-dev-weu
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful