microsoftgraph / msgraph-bicep-types

Repo contains Microsoft Graph resource types to integrate with bicep templates.
MIT License
46 stars 7 forks source link

UniqueName is not released after deleting an app registration #137

Closed GABRIELNGBTUC closed 5 months ago

GABRIELNGBTUC commented 5 months ago

Bicep version v0.28.1

Resource and API version Microsoft.Graph/applications@v1.0

Auth flow Interactive

Deployment details

New-AzResourceGroupDeployment: 08:12:16 - The deployment 'test' failed with error(s). Showing 1 out of 1 error(s).
Status Message: {"error":{"code":"BadRequest","target":"/resources/app_registration","message":"Another object with the same value for property uniqueName already exists. Graph client request id: 706ed0e9-f28f-4c4c-b11c-0ccb2fd12ca7. Graph request timestamp: 2024-06-10T06:12:10Z."}} (Code:DeploymentOperationFailed)

CorrelationId: eb1c71b8-2a97-48ec-a188-6b9c45d39abe

Describe the bug When creating an app registration then deleting it, the uniqueName property is not released, preventing any new deployment attempting to reuse this unique name name

To Reproduce

provider microsoftGraph
param app_registration_name string = '88c5ca92-ec4c-4280-935e-38cd0acb2e22'

resource app_registration_resource 'Microsoft.Graph/applications@v1.0' = {
  displayName: app_registration_name
  uniqueName: app_registration_name
}

Run the above bicep file once, delete the app registration created and run the file once more

Additional context If creating the unique name using a function like guid(display_name), app creation with the same display name would be blocked in the event of the app registration being accidentally deleted or deleted on purpose but recommissioned in the future.

GABRIELNGBTUC commented 5 months ago

Please ignore this issue.

I forgot that Entra ID apps now had a soft delete feature.

After deleting the soft deleted application, the uniqueName is definitely available to be reassigned

dkershaw10 commented 5 months ago

@GABRIELNGBTUC, FYI - this issue is already documented as a Known Issue