Azure / Azure/bicep-types-az

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

Open
#2,220 6 comments 2 reactions 0 assignees View on GitHub
Needs: Triage :mag:
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

**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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin with the supplied privateEndpoints.bicep and its modules/privateEndpoints.bicep invocation, then reproduce the second deployment using the shown API versions and resource properties. Compare the API Management and Private Endpoint deployment behavior; done requires identifying whether bicep-types-az can address the failure or whether it is an Azure service issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.