Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.23k stars 748 forks source link

`Microsoft.Communication/emailServices@2021-10-01-preview` leads to conflict after first run #7944

Open hho opened 2 years ago

hho commented 2 years ago

Bicep version

➜ az bicep version
Bicep CLI version 0.9.1 (a2950a16df)

Describe the bug After deploying an email communication service, every subsequent deployment fails with {"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"ResourceNameUnavailable\",\r\n \"message\": \"Specified resource name already in use\"\r\n }\r\n}"}]}}

To Reproduce Deploy the following template to a resource group:

param nameEmailService string
param nameCommService string
param domainName string = 'AzureManagedDomain'
param location string = 'global'
param dataLocation string = 'unitedstates'

var domainManagement = domainName != 'AzureManagedDomain' ? 'CustomerManaged' : 'AzureManaged'

resource emailCommunicationService 'Microsoft.Communication/emailServices@2021-10-01-preview' = {
  name: nameEmailService
  location: location
  properties: {
    dataLocation: dataLocation
  }

  resource emailDomain 'domains@2021-10-01-preview' = {
    name: domainName
    location: location
    properties: {
      domainManagement: domainManagement
      userEngagementTracking: 'Disabled'
      validSenderUsernames: {
        DoNotReply: 'DoNotReply'
      }
    }
  }
}

resource communicationService 'Microsoft.Communication/communicationServices@2021-10-01-preview' = {
  name: nameCommService
  location: location
  properties: {
    dataLocation: dataLocation
    linkedDomains: [
      emailCommunicationService::emailDomain.id
    ]
  }
}

Deploy with

az deployment group create --resource-group rg-foo-bar --template-file emailCommunicationService.bicep

Additional context

slavizh commented 1 year ago

+1