Azure / Azure/azure-rest-api-specs

[BUG] Microsoft.Quota/groupQuotas CreateOrUpdate does not support PUT updates

Open
#42,262 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug customer-reported Mgmt question quota Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
6k
Avg merge
2d 21h
Merged PRs (30d)
432

Description

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/quota/resource-manager/Microsoft.Quota/Quota/GroupQuotasEntity.tsp

API Spec version

2025-09-01

Describe the bug

After importing a resource into Terraform using the AzAPI provider, a no-change full PUT is attempted (likely due to an incorrect detection by the AzAPI provider). However, the PUT request still fails stating the resource already exists.

Expected behavior

The Update is accepted and applied.

Actual behavior
azapi_resource.quota_group: Preparing import... [id=/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup]
azapi_resource.quota_group: Refreshing state... [id=/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # azapi_resource.quota_group will be updated in-place
  # (imported from "/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup")
  ~ resource "azapi_resource" "quota_group" {
        body                      = {
            properties = {
                displayName = "GroupQuota1"
            }
        }
        id                        = "/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup"
        ignore_casing             = false
        ignore_missing_property   = true
        ignore_null_property      = false
        name                      = "sharedquotagroup"
        output                    = {
            id         = "/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup"
            properties = {
                groupType         = "AllocationGroup"
                provisioningState = "Succeeded"
            }
            type       = "Microsoft.Quota/groupQuotas"
        }
        parent_id                 = "/providers/Microsoft.Management/managementGroups/mg-group-name"
      ~ schema_validation_enabled = true -> false
        sensitive_body            = (write-only attribute)
        type                      = "Microsoft.Quota/groupQuotas@2025-09-01"
    }


---------------

azapi_resource.quota_group: Importing... [id=/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup]
azapi_resource.quota_group: Import complete [id=/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup]
azapi_resource.quota_group: Modifying... [id=/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup]

Error: Failed to create/update resource

  with azapi_resource.quota_group,
  on main.tf line 28, in resource "azapi_resource" "quota_group":
  28: resource "azapi_resource" "quota_group" {

creating/updating Resource: (ResourceId
"/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup"
/ Api Version "2025-09-01"): PUT
https://management.azure.com/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup
--------------------------------------------------------------------------------
RESPONSE 409: 409 Conflict
ERROR CODE: EntityAlreadyExists
--------------------------------------------------------------------------------
{
  "error": {
    "code": "EntityAlreadyExists",
    "message": "GroupQuota already exists for GroupId: sharedquotagroup, MgId: mg-group-name, TenantId: ***."
  }
}
--------------------------------------------------------------------------------
Reproduction Steps
# Create Management Group
az rest -m put -u "/providers/Microsoft.Management/managementGroups/mg-group-name?api-version=2020-05-01" --body '{"properties":{"displayName":"ChildGroup","details":{"parent":{"id":"/providers/Microsoft.Management/managementGroups/***"}}}}'

# Create Quota Group
az rest -m put -u "https://management.azure.com/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup?api-version=2025-09-01" --body '{"properties":{"displayName":"GroupQuota1"}}'

# Update with no changes
az rest -m put -u "https://management.azure.com/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup?api-version=2025-09-01" --body '{"properties":{"displayName":"GroupQuota1"}}'

# {"error":{"code":"EntityAlreadyExists","message":"GroupQuota already exists for GroupId: sharedquotagroup, MgId: mg-group-name, TenantId: ***."}}

# Update with display name change
az rest -m put -u "https://management.azure.com/providers/Microsoft.Management/managementGroups/mg-group-name/providers/Microsoft.Quota/groupQuotas/sharedquotagroup?api-version=2025-09-01" --body '{"properties":{"displayName":"NameChange"}}'

# {"error":{"code":"EntityAlreadyExists","message":"GroupQuota already exists for GroupId: sharedquotagroup, MgId: mg-group-name, TenantId: ***."}}
Environment

Terraform 1.14
AzAPI 2.9.0

Manual testing: Azure Shell

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.

Research direction

Read specification/quota/resource-manager/Microsoft.Quota/Quota/GroupQuotasEntity.tsp and inspect the 2025-09-01 GroupQuotas PUT definition. Reproduce the create and update requests from the issue with az rest, including a changed displayName. Done means both no-op and changed-name PUT requests are accepted instead of returning EntityAlreadyExists.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.