Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Network/privateEndpoints not idempotent with Microsoft.ApiManagement/service #14430

Open
cmptscpeacock opened this issue Jun 26, 2024 · 0 comments

Comments

@cmptscpeacock
Copy link

cmptscpeacock commented Jun 26, 2024

Bicep version
0.27.1

Describe the bug
I have deployed an Azure API Management Service (APIMS) using the Developer SKU, User Managed Identity and only the required properties of publisherEmail and publisherName. I can deploy the bicep repeatedly without an issue. APIMS api version 2023-05-01

I then add a Private Endpoint to the APIMS and this deploys fine.

The next time I run the bicep, not changing anything, the following error is seen:

• Call to Microsoft.ApiManagement/service failed. Error message: Private endpoint with name PRIVATE-ENDPOINT-NAME already exists for Api Management service /subscriptions/ID/resourceGroups/RG-NAME/providers/Microsoft.ApiManagement/service/APIM-NAME (Code: PrivateEndpointBadRequest)

Therefore, appears not to be idempotent.

To Reproduce

This is the privateEndpoints.bicep file:

param name string
param location string
param tags object
param properties object

resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-11-01' = {
  name: name
  location: location
  tags: tags
  properties: properties
}

output privateEndpointName string = privateEndpoint.name
output privateEndpointId string = privateEndpoint.id

This is the private endpoint resource being deployed:

module apiManagementServicePE 'modules/privateEndpoints.bicep' = {
  scope: resourceGroup()
  name: 'pe-${apiManagementServiceName}'
  params: {
    name: 'pe-${apiManagementServiceName}'
    location: location
    tags: tagging
    properties: {
      subnet: {
        id: subnetId
      }
      privateLinkServiceConnections: [
        {
          name: 'pe-${apiManagementServiceName}'
          properties: {
            privateLinkServiceId: apiManagementService.outputs.apiManagementServiceId
            groupIds: [
              'Gateway'
            ]
          }
        }
      ]
    }
  }
}

The PE has been used on many other resources without any issue. Some APIMS seems to have an issue.

Additional context

The APIMS redeploys fine with no issues. It's the PE that fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant