Skip to content

Unable to create azuread_application_registration with service principal credentials #1802

@1oglop1

Description

@1oglop1

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureAD Provider) Version

  • provider registry.terraform.io/hashicorp/azuread v3.6.0

Affected Resource(s)

  • azuread_application_registration

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
    azuread = {
      source  = "hashicorp/azuread"
      version = "~> 2.0"
    }
    time = {
      source  = "hashicorp/time"
      version = "~> 0.10"
    }
  }
}

provider "azuread" {
  # Azure AD provider configuration will use environment variables or Azure CLI
}


# Azure AD Application Registration
resource "azuread_application_registration" "aar" {
  display_name = "my-app-tf"
}

# Timer for propagation wait
resource "time_sleep" "wait_for_app_propagation" {
  create_duration = "5s"

  depends_on = [azuread_application_registration.aar]
}

output "app_client_id" {
  value       = azuread_application_registration.aar.client_id
  description = "The application client ID"
}

output "app_object_id" {
  value       = azuread_application_registration.aar.object_id
  description = "The application object ID"
}

Debug Output

Panic Output

Expected Behavior

Actual Behavior

Resource is created but not written to the state due to error

{"error":{"code":"Request_ResourceNotFound","message":"Resource '7b8d7f18-95d1-48b0-9d81-d2f820f90cfb' does not exist or one of its queried reference-property objects are not present.","innerError":{"date":"2025-11-14T14:45:58","request-id":"314975ef-6bd3-49db-828e-0de63b3cad01","client-request-id":"314975ef-6bd3-49db-828e-0de63b3cad01"}}}
eventSink::Debug(<{%reset%}>{"error":{"code":"Request_ResourceNotFound","message":"Resource '7b8d7f18-95d1-48b0-9d81-d2f820f90cfb' does not exist or one of its queried reference-property objects are not present.","innerError":{"date":"2025-11-14T14:45:58","request-id":"314975ef-6bd3-49db-828e-0de63b3cad01","client-request-id":"314975ef-6bd3-49db-828e-0de63b3cad01"}}}<{%reset%}>)
============================= End AzureAD Response ============================
eventSink::Debug(<{%reset%}>============================= End AzureAD Response ============================<{%reset%}>)
eventSink::Info(<{%reset%}>[DEBUG] Application (Application: "7b8d7f18-95d1-48b0-9d81-d2f820f90cfb") was not found - removing from state<{%reset%}>)
provider received rpc error `Unknown`: `expected non-nil error with nil state during Create of urn:pulumi:my-stack::my-pulumi-project::azuread:index/applicationRegistration:ApplicationRegistration::my-app`
rpc error kind `Unknown` may not be recoverable
Provider[azuread, 0xc0019bd7c0].Create(urn:pulumi:my-stack::my-pulumi-project::azuread:index/applicationRegistration:ApplicationRegistration::my-app) failed: expected non-nil error with nil state during Create of urn:pulumi:my-stack::my-pulumi-project::azuread:index/applicationRegistration:ApplicationRegistration::my-app
eventSink::Error(<{%reset%}>expected non-nil error with nil state during Create of urn:pulumi:my-stack::my-pulumi-project::azuread:index/applicationRegistration:ApplicationRegistration::my-app<{%reset%}>)
azuread_application_registration.bccom_bait_first: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to azuread_application_registration.my-app-tf, provider "provider[\"registry.terraform.io/hashicorp/azuread\"]" produced an unexpected new value: Root object was present, but now
│ absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Steps to Reproduce

  1. Use Service Principal credentials inside kubernetes pod.
  2. terraform apply

Important Factoids

References

  • #0000

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