-
Notifications
You must be signed in to change notification settings - Fork 202
Description
I'm trying to create AI Foundry, using Terraform azapi provider:-
resource "azapi_resource" "foundry" {
type = "Microsoft.CognitiveServices/accounts@2025-04-01-preview"
name = local.resource_name
parent_id = data.azurerm_resource_group.rg.id
location = var.azure_region
tags = merge({ Name = "${local.resource_name}" }, var.tags)
schema_validation_enabled = false
body = {
kind = "AIServices"
sku = {
name = var.sku
}
identity = {
type = "SystemAssigned"
}
properties = {
disableLocalAuth = var.disable_local_auth
allowProjectManagement = true
publicNetworkAccess = var.public_network_access
restrictOutboundNetworkAccess = var.restrict_outbound_network_access
customSubDomainName = local.resource_name
networkAcls = var.network_acls == null ? null : {
bypass = var.network_acls.bypass
defaultAction = var.network_acls.defaultAction
ipRules = [
for ip_rule in lookup(var.network_acls, "ip_rules", []) : {
value = ip_rule.value
}
]
virtualNetworkRules = [
for vnet_rule in lookup(var.network_acls, "virtual_network_rules", []) : {
id = vnet_rule.id
ignoreMissingVnetServiceEndpoint = lookup(vnet_rule, "ignore_missing_vnet_service_endpoint", false)
state = lookup(vnet_rule, "state", "Succeeded")
}
]
}
networkInjections = var.network_injection == null ? null : [
{
scenario = var.network_injection.scenario
subnetArmId = var.network_injection.subnet_arm_id
useMicrosoftManagedNetwork = var.network_injection.use_microsoft
}
]
}
}
provider = azapi.azapi
}
But when trying to deploy, we are facing multiple failures; twice it has succeeded. But today onwards, facing the 404 error, and these
"message": "Failed to create Aml RP virtual workspace due to System.Exception: Failed async operation {\n "status": "Failed",\n "error": {\n "code": "InternalServerError",\n "message": "Object reference not set to an instance of an object."\n }\n}\n at Microsoft.CognitiveServices.ResourceProvider.AmlRp.AsyncOperationHelper.PollUntilCompleteAsync[T](TraceContext traceContext, HttpResponseMessage response, HttpClient httpClient, Int32 timeoutInMin, CancellationToken cancellationToken) in /__w/1/s/src/Common/ResourceProvider/AmlRp/AsyncOperationHelper.cs:line 117\n at Microsoft.CognitiveServices.ResourceProvider.AmlRp.AmlRpClient.PutAmlRpVirtualHubAsync(TraceContext traceContext, Dictionary2 headers, ResourceIdentityInArm resourceIdentity, String primaryUserAssignedIdentity, String internalId, KeyVaultProperties keyVaultProperties, String subscriptionId, String resourceGroupName, String workspaceName, List1 networkInjections, PublicNetworkAccessType publicNetworkAccessType, CancellationToken cancellationToken) in /__w/1/s/src/Common/ResourceProvider/AmlRp/AmlRpClient.cs:line 119\n at Microsoft.CognitiveServices.ResourceProvider.AmlRp.AmlRpService.PutAmlRpWorkspaceAsync(TraceContext traceContext, ResourceRequestContext requestContext, WorkerMessageRequestContext workerMessageRequestContext, IResourceEntity insertedResourceEntity, CancellationToken cancellationToken) in /__w/1/s/src/Common/ResourceProvider/AmlRp/AmlRpService.cs:line 124\n at Microsoft.CognitiveServices.ResourceProvider.Worker.MessageProcessor.ProcessInternalAsync(TraceContext traceContext, RpWorkerQueueMessage message, CancellationToken cancellationToken) in /__w/1/s/src/ResourceProvider/Rp.WorkerRole/AccountProvisioning/MessageProcessor.cs:line 225"
I'm using the Class B subnet, with required .app delegation everything, once worked with same rg deployment now its not working with any type cross rg or same rg, guys can you please provide any fix ?