Describe the bug
Importing an existing powerplatform_user resource fails even when using the documented import syntax.
The resource's import path only passes through id, but the subsequent read path requires environment_id to already be present in state. As a result, terraform import prepares the import and then fails during refresh with:
Error: Invalid State
Environment ID is required and cannot be null or unknown
This makes the documented import flow unusable for existing Dataverse users.
Sample Terraform Code
resource "powerplatform_user" "example" {
environment_id = "00000000-0000-0000-0000-000000000001"
aad_id = "00000000-0000-0000-0000-000000000002"
security_roles = [
"11111111-1111-1111-1111-111111111111"
]
disable_delete = false
}
Expected behavior
Running terraform import powerplatform_user.example 00000000-0000-0000-0000-000000000002 should import the existing user successfully and hydrate the resource state so that a subsequent terraform plan can compare the imported user with configuration.
Instead, the import fails during refresh because environment_id is still null/unknown in state.
System Information
- Provider Version:
4.1.1
- OS & Version:
macOS (darwin arm64); also reproduced in Azure Pipelines on Linux
Additional context
- The provider docs currently state that user resources can be imported using the Entra Object ID.
- The relevant implementation appears to be:
ImportState: passthrough of only id
Read: validates environment_id before attempting lookup
- Reproduction command:
terraform import powerplatform_user.example 00000000-0000-0000-0000-000000000002
powerplatform_user.example: Import prepared!
powerplatform_user.example: Refreshing state... [id=00000000-0000-0000-0000-000000000002]
Error: Invalid State
Environment ID is required and cannot be null or unknown
Describe the bug
Importing an existing
powerplatform_userresource fails even when using the documented import syntax.The resource's import path only passes through
id, but the subsequent read path requiresenvironment_idto already be present in state. As a result,terraform importprepares the import and then fails during refresh with:Error: Invalid StateEnvironment ID is required and cannot be null or unknownThis makes the documented import flow unusable for existing Dataverse users.
Sample Terraform Code
Expected behavior
Running
terraform import powerplatform_user.example 00000000-0000-0000-0000-000000000002should import the existing user successfully and hydrate the resource state so that a subsequentterraform plancan compare the imported user with configuration.Instead, the import fails during refresh because
environment_idis still null/unknown in state.System Information
4.1.1macOS (darwin arm64); also reproduced in Azure Pipelines onLinuxAdditional context
ImportState: passthrough of onlyidRead: validatesenvironment_idbefore attempting lookup