We created the following hierarchy of resources via terraform (as described in the Microsoft Learn):

In a C# console app, we are trying to create a persistent agent that uses the deployed model:
using Azure.Identity;
using Azure.AI.Agents.Persistent;
using Azure;
using Microsoft.Agents.AI;
// Some values are redacted
string endpoint = "https://mainaiserv*****.services.ai.azure.com/api/projects/mainaiserv****";
string deploymentName = "gtp35******";
var client = new PersistentAgentsClient(endpoint, new DefaultAzureCredential());
Response<PersistentAgent> aiFoundryAgent = await client.Administration.CreateAgentAsync( deploymentName, "Agent003", "A question answerer", "You are a helpful assistant that provides concise answers that do not exceed 50 words.");
Creating the agent results in a 404 project not found error:
Azure.RequestFailedException: 'The project does not exist.Status: 404 (ResourceNotFound)ErrorCode: ResourceNotFound
It seems that the deployed model is not visible via the project endpoint, furthermore deploying the agent under the project is:
- Not possible via azcli, terraform and ARM as all three accept a Foundry Resource as parent with no way to specify a project
https://registry.terraform.io/providers/hashicorp/azurerm/4.51.0/docs/resources/cognitive_deployment
https://learn.microsoft.com/en-us/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest#az-cognitiveservices-account-deployment-create
https://learn.microsoft.com/en-us/azure/templates/microsoft.cognitiveservices/accounts/deployments?pivots=deployment-language-arm-template
- The Agent Section in the AI Foundry Project created via IaC seems stuck here with the drop down always empty:
However, everything works fine when the AI foundry resource, the underlying project and the model deployments are created from the Azure portal and AI Foundry portal.
Is this an issue with the azurerm provider ? Or are we missing something ?