Skip to content

Commit 203d841

Browse files
foundry-samples-repo-sync[bot]geabdlucaAhmadAbdullah91
authored
Automated sync from private repo (2026-03-19) (#611)
* fix: scope Cosmos DB SQL role assignment to account level for Agents v2 (#84) Replace three per-collection azurerm_cosmosdb_sql_role_assignment resources (scoped to individual enterprise_memory collections) with a single assignment scoped at the Cosmos DB account level. This is required for Agents v2 and eliminates redundant per-collection definitions. Affected templates: - infrastructure-setup-terraform/15a-private-network-standard-agent-setup - infrastructure-setup-terraform/15b-private-network-standard-agent-setup-byovnet * Update README with correct parameters for deployment (#95) * fixup: correct drift after commit replay * Update sync state to 4144addd759b --------- Co-authored-by: geabdluca <73857153+geabdluca@users.noreply.github.com> Co-authored-by: AhmadAbdullah91 <91725950+AhmadAbdullah91@users.noreply.github.com> Co-authored-by: foundry-samples-repo-sync[bot] <foundry-samples-repo-sync[bot]@users.noreply.github.com>
1 parent 37a9482 commit 203d841

10 files changed

Lines changed: 18 additions & 70 deletions

File tree

.github/.sync-sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
560fc8afc9b55c70a8dd25d7b55335a4426fddef
1+
4144addd759bfc0271f88b62c3f4c945bebbc604

infrastructure/infrastructure-setup-bicep/31-customer-managed-keys-standard-agent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This Azure AI Foundry template demonstrates how to deploy AI Foundry with Agents
2626
Steps:
2727
1. Run the command above once to create the account and project without CMK.
2828
```bash
29-
az deployment group create --name "{DEPLOYMENT_NAME}" --resource-group "{RESOURCE_GROUP_NAME}" --template-file ./main.bicep --parameters azureKeyVaultName="{KEY_VAULT_NAME}" azureKeyName="{KEY_NAME}" azureKeyVersion="{KEY_VERSION}"
29+
az deployment group create --name "{DEPLOYMENT_NAME}" --resource-group "{RESOURCE_GROUP_NAME}" --template-file ./main.bicep --parameters keyVaultName="{KEY_VAULT_NAME}" keyName="{KEY_NAME}" keyVersion="{KEY_VERSION}"
3030
```
3131
1. Give account resource Key Vault Admin role, or more restricted get/wrap/unwrap key role assignments, on the Azure Key Vault.
3232
1. Uncomment out the encryption section in the main.bicep file to update with CMK.

infrastructure/infrastructure-setup-terraform/15a-private-network-standard-agent-setup/code/main.tf

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -707,40 +707,16 @@ resource "azapi_resource" "ai_foundry_project_capability_host" {
707707
}
708708
}
709709

710-
## Create the necessary data plane role assignments to the CosmosDb databases created by the AI Foundry Project
710+
## Create the necessary data plane role assignments to the CosmosDb account created by the AI Foundry Project
711711
##
712-
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp_user_thread_message_store" {
712+
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp" {
713713
depends_on = [
714714
azapi_resource.ai_foundry_project_capability_host
715715
]
716-
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}userthreadmessage_dbsqlrole")
716+
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}cosmosdb_dbsqlrole")
717717
resource_group_name = azurerm_resource_group.rg.name
718718
account_name = azurerm_cosmosdb_account.cosmosdb.name
719-
scope = "${azurerm_cosmosdb_account.cosmosdb.id}/dbs/enterprise_memory/colls/${local.project_id_guid}-thread-message-store"
720-
role_definition_id = "${azurerm_cosmosdb_account.cosmosdb.id}/sqlRoleDefinitions/00000000-0000-0000-0000-000000000002"
721-
principal_id = azapi_resource.ai_foundry_project.output.identity.principalId
722-
}
723-
724-
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp_system_thread_name" {
725-
depends_on = [
726-
azurerm_cosmosdb_sql_role_assignment.cosmosdb_db_sql_role_aifp_user_thread_message_store
727-
]
728-
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}systemthread_dbsqlrole")
729-
resource_group_name = azurerm_resource_group.rg.name
730-
account_name = azurerm_cosmosdb_account.cosmosdb.name
731-
scope = "${azurerm_cosmosdb_account.cosmosdb.id}/dbs/enterprise_memory/colls/${local.project_id_guid}-system-thread-message-store"
732-
role_definition_id = "${azurerm_cosmosdb_account.cosmosdb.id}/sqlRoleDefinitions/00000000-0000-0000-0000-000000000002"
733-
principal_id = azapi_resource.ai_foundry_project.output.identity.principalId
734-
}
735-
736-
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp_entity_store_name" {
737-
depends_on = [
738-
azurerm_cosmosdb_sql_role_assignment.cosmosdb_db_sql_role_aifp_system_thread_name
739-
]
740-
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}entitystore_dbsqlrole")
741-
resource_group_name = azurerm_resource_group.rg.name
742-
account_name = azurerm_cosmosdb_account.cosmosdb.name
743-
scope = "${azurerm_cosmosdb_account.cosmosdb.id}/dbs/enterprise_memory/colls/${local.project_id_guid}-agent-entity-store"
719+
scope = azurerm_cosmosdb_account.cosmosdb.id
744720
role_definition_id = "${azurerm_cosmosdb_account.cosmosdb.id}/sqlRoleDefinitions/00000000-0000-0000-0000-000000000002"
745721
principal_id = azapi_resource.ai_foundry_project.output.identity.principalId
746722
}

infrastructure/infrastructure-setup-terraform/15b-private-network-standard-agent-setup-byovnet/code/main.tf

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -563,46 +563,18 @@ resource "azapi_resource" "ai_foundry_project_capability_host" {
563563
}
564564
}
565565

566-
## Create the necessary data plane role assignments to the CosmosDb databases created by the AI Foundry Project
566+
## Create the necessary data plane role assignments to the CosmosDb account created by the AI Foundry Project
567567
##
568-
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp_user_thread_message_store" {
568+
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp" {
569569
provider = azurerm.workload_subscription
570570

571571
depends_on = [
572572
azapi_resource.ai_foundry_project_capability_host
573573
]
574-
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}userthreadmessage_dbsqlrole")
574+
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}cosmosdb_dbsqlrole")
575575
resource_group_name = var.resource_group_name_resources
576576
account_name = azurerm_cosmosdb_account.cosmosdb.name
577-
scope = "${azurerm_cosmosdb_account.cosmosdb.id}/dbs/enterprise_memory/colls/${local.project_id_guid}-thread-message-store"
578-
role_definition_id = "${azurerm_cosmosdb_account.cosmosdb.id}/sqlRoleDefinitions/00000000-0000-0000-0000-000000000002"
579-
principal_id = azapi_resource.ai_foundry_project.output.identity.principalId
580-
}
581-
582-
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp_system_thread_name" {
583-
provider = azurerm.workload_subscription
584-
585-
depends_on = [
586-
azurerm_cosmosdb_sql_role_assignment.cosmosdb_db_sql_role_aifp_user_thread_message_store
587-
]
588-
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}systemthread_dbsqlrole")
589-
resource_group_name = var.resource_group_name_resources
590-
account_name = azurerm_cosmosdb_account.cosmosdb.name
591-
scope = "${azurerm_cosmosdb_account.cosmosdb.id}/dbs/enterprise_memory/colls/${local.project_id_guid}-system-thread-message-store"
592-
role_definition_id = "${azurerm_cosmosdb_account.cosmosdb.id}/sqlRoleDefinitions/00000000-0000-0000-0000-000000000002"
593-
principal_id = azapi_resource.ai_foundry_project.output.identity.principalId
594-
}
595-
596-
resource "azurerm_cosmosdb_sql_role_assignment" "cosmosdb_db_sql_role_aifp_entity_store_name" {
597-
provider = azurerm.workload_subscription
598-
599-
depends_on = [
600-
azurerm_cosmosdb_sql_role_assignment.cosmosdb_db_sql_role_aifp_system_thread_name
601-
]
602-
name = uuidv5("dns", "${azapi_resource.ai_foundry_project.name}${azapi_resource.ai_foundry_project.output.identity.principalId}entitystore_dbsqlrole")
603-
resource_group_name = var.resource_group_name_resources
604-
account_name = azurerm_cosmosdb_account.cosmosdb.name
605-
scope = "${azurerm_cosmosdb_account.cosmosdb.id}/dbs/enterprise_memory/colls/${local.project_id_guid}-agent-entity-store"
577+
scope = azurerm_cosmosdb_account.cosmosdb.id
606578
role_definition_id = "${azurerm_cosmosdb_account.cosmosdb.id}/sqlRoleDefinitions/00000000-0000-0000-0000-000000000002"
607579
principal_id = azapi_resource.ai_foundry_project.output.identity.principalId
608580
}

samples/python/quickstart/chat-with-agent/quickstart-chat-with-agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Create project and openai clients to call Foundry API
99
project = AIProjectClient(
10-
endpoint=FOUNDRY_PROJECT_ENDPOINT,
10+
endpoint=PROJECT_ENDPOINT,
1111
credential=DefaultAzureCredential(),
1212
)
1313
openai = project.get_openai_client()
@@ -18,15 +18,15 @@
1818
# Chat with the agent to answer questions
1919
response = openai.responses.create(
2020
conversation=conversation.id,
21-
extra_body={"agent_reference": {"name": FOUNDRY_AGENT_NAME, "type": "agent_reference"}},
21+
extra_body={"agent_reference": {"name": AGENT_NAME, "type": "agent_reference"}},
2222
input="What is the size of France in square miles?",
2323
)
2424
print(response.output_text)
2525

2626
# Ask a follow-up question in the same conversation
2727
response = openai.responses.create(
2828
conversation=conversation.id,
29-
extra_body={"agent_reference": {"name": FOUNDRY_AGENT_NAME, "type": "agent_reference"}},
29+
extra_body={"agent_reference": {"name": AGENT_NAME, "type": "agent_reference"}},
3030
input="And what is the capital city?",
3131
)
3232
print(response.output_text)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
azure-ai-projects>=2.0.0a20250915020
22
azure-identity
33
python-dotenv
4-
openai
4+
openai

samples/python/quickstart/create-agent/quickstart-create-agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
instructions="You are a helpful assistant that answers general questions",
2121
),
2222
)
23-
print(f"Agent created (id: {agent.id}, name: {agent.name}, version: {agent.version})")
23+
print(f"Agent created (id: {agent.id}, name: {agent.name}, version: {agent.version})")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
azure-ai-projects>=2.0.0a20250915020
22
azure-identity
33
python-dotenv
4-
openai
4+
openai

samples/python/quickstart/responses/quickstart-responses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
model="gpt-5-mini", # supports all Foundry direct models
1717
input="What is the size of France in square miles?",
1818
)
19-
print(f"Response output: {response.output_text}")
19+
print(f"Response output: {response.output_text}")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
azure-ai-projects>=2.0.0a20250915020
22
azure-identity
33
python-dotenv
4-
openai
4+
openai

0 commit comments

Comments
 (0)