Skip to content

Cannot delete user assigned identity #4787

@xuzhang3

Description

@xuzhang3

Resources that support user assigned identities cannot delete existing identities. From the API perspective, we need to set the value in the identity key:value map to null to delete the identity, but object in SDK is not pointer, we cannot set it to nil to tell the service delete the identity.

Affected resources: azurerm_redis_cache, azurerm_container_registry etc. that support user-assigned identities

SDK code: https://github.com/hashicorp/go-azure-helpers/blob/main/resourcemanager/identity/system_and_user_assigned_map.go#L20

Current SDK request:

{
    "identity": {
        "type": "UserAssigned",
        "userAssignedIdentities": {
            "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity": {}
        }
    }
}

Expected Delete Request:

{
    "identity": {
        "type": "UserAssigned",
        "userAssignedIdentities": {
            "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity": null
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions