Is there an existing issue for this?
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.
Private Endpoint Creation Fails for Azure AI Foundry: Provider Marks Cognitive Account as Complete While ARM State Is Still "Accepted"
Overview
When deploying Azure AI Foundry (Microsoft.CognitiveServices/accounts) using the Terraform azurerm_ai_services resource, the AzureRM provider reports the account creation as complete even though Azure still returns a provisioning state of Accepted.
Because Terraform incorrectly considers the resource finished, it immediately attempts to create a Private Endpoint, which then fails with:
AccountProvisioningStateInvalid: ... account ... in state Accepted
This causes the entire deployment to fail.
Impact
This issue blocks fully automated AI Foundry deployments involving Private Endpoints.
Workarounds require:
- Adding manual waits or sleep commands
- Using artificial
depends_on or retry logic
- Adding external provisioning checks
These workarounds are not ideal in IaC-driven workflows.
Suggested Fix
The provider should:
- Poll the ARM provisioning state until it reaches Succeeded.
- Not return success based solely on the initial terminal event.
- Align with other AzureRM resources that properly wait for final provisioning state.
Terraform Version
1.3.7
AzureRM Provider Version
4.58.0
Affected Resource(s)/Data Source(s)
azurerm_ai_services
Terraform Configuration Files
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_ai_services" "example" {
name = "example-account"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku_name = "S0"
tags = {
Acceptance = "Test"
}
}
resource "azurerm_private_endpoint" "example" {
name = "example-endpoint"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
subnet_id = azurerm_subnet.endpoint.id
private_service_connection {
name = "example-privateserviceconnection"
private_connection_resource_id = azurerm_ai_services.example.id
is_manual_connection = false
}
}
Debug Output/Panic Output
module.ocu_foundry.module.foundry.azurerm_ai_services.aifoundry: Creation complete after 1m10s
...
Error: ... AccountProvisioningStateInvalid: ... account ... in state Accepted
Expected Behaviour
Terraform should wait until the Cognitive Services / AI Foundry account reaches the Succeeded provisioning state before allowing dependent resources (like Private Endpoints) to be created.
Actual Behaviour
Terraform logs indicate:
- The
azurerm_ai_services resource completes after ~70 seconds.
- Azure still reports the provisioning state as Accepted.
- Terraform proceeds to create the Private Endpoint.
- Private Endpoint creation fails with HTTP 400 Bad Request.
Error snippet
Error: creating Private Endpoint ...
unexpected status 400 ... AccountProvisioningStateInvalid:
Call to Microsoft.CognitiveServices/accounts failed.
Account ... in state Accepted
Steps to Reproduce
- Deploy an Azure AI Foundry resource using:
- In the same blueprint create a dependent
azurerm_private_endpoint.
- Run
terraform apply.
- Observe:
- Provider marks AI Foundry account creation complete early.
- Azure ARM still reports
Accepted.
- Private Endpoint creation fails.
Important Factoids
No response
References
No response
Is there an existing issue for this?
Community Note
Private Endpoint Creation Fails for Azure AI Foundry: Provider Marks Cognitive Account as Complete While ARM State Is Still "Accepted"
Overview
When deploying Azure AI Foundry (
Microsoft.CognitiveServices/accounts) using the Terraformazurerm_ai_servicesresource, the AzureRM provider reports the account creation as complete even though Azure still returns a provisioning state of Accepted.Because Terraform incorrectly considers the resource finished, it immediately attempts to create a Private Endpoint, which then fails with:
This causes the entire deployment to fail.
Impact
This issue blocks fully automated AI Foundry deployments involving Private Endpoints.
Workarounds require:
depends_onor retry logicThese workarounds are not ideal in IaC-driven workflows.
Suggested Fix
The provider should:
Terraform Version
1.3.7
AzureRM Provider Version
4.58.0
Affected Resource(s)/Data Source(s)
azurerm_ai_services
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Terraform should wait until the Cognitive Services / AI Foundry account reaches the Succeeded provisioning state before allowing dependent resources (like Private Endpoints) to be created.
Actual Behaviour
Terraform logs indicate:
azurerm_ai_servicesresource completes after ~70 seconds.Error snippet
Steps to Reproduce
azurerm_ai_servicesazurerm_private_endpoint.terraform apply.Accepted.Important Factoids
No response
References
No response