Azure / Azure/azure-rest-api-specs

[BUG] Resource ID for create backend in APIM not working as expected

Open
#29,531 2 comments 1 reaction 1 assignee View on GitHub

@solankisamir is already working on this.

Since Jun 21, 2024.

bug customer-reported Mgmt question
Dominant language
TypeSpec
Stars
3.1k
Forks
6k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

### API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/061505b89d5d0bbcc9f980e2276f79ff354ce286/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/definitions.json#L1957

### API Spec version

2023-05-01-preview

### Describe the bug

The error happens when I try to create the backend in APIM with the resource ID, and it doesn't find the resource.

I'm using terraform, but following the [documentation](https://github.com/Azure/azure-rest-api-specs/blob/061505b89d5d0bbcc9f980e2276f79ff354ce286/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/definitions.json#L1957), it looks like an Azure problem with the resource ID.

However, resource_id isn't found only with the resource_ID. You need to put `https://management.azure.com/` before the resource_id.

Like this after formatting:
`https://management.azure.com/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1`

### Expected behavior

Create the APIM backend with only the resource ID, `/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1`.

### Actual behavior

Not creating the APIM backend with only the resource ID

### Reproduction Steps

As I said before, I'm using terraform.

To reproduce can use this example to test the error:

```terraform
resource "azurerm_api_management_backend" "example" {
name = format("%s%s", "example", var.env)
description = format("%s%s", "example", var.env)
api_management_name = var.apim_name
resource_group_name = var.resource_group_name
protocol = "http"
url = format("%s%s%s", "https://example", var.env, ".azurewebsites.net/api")
resource_id = var.example_id

tls {
validate_certificate_chain = false
validate_certificate_name = false
}
}
```

And to reproduce without the error:

```terraform
resource "azurerm_api_management_backend" "example" {
name = format("%s%s", "example", var.env)
description = format("%s%s", "example", var.env)

api_management_name = var.apim_name
resource_group_name = var.resource_group_name

protocol = "http"
url = format("%s%s%s", "https://***", var.env, ".azurewebsites.net/api")
resource_id = format("%s%s", "https://management.azure.com", var.example)

tls {
validate_certificate_chain = false
validate_certificate_name = false
}
}
```

### Environment

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.