Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
Foundry IQ (Azure AI Search) provides direct indexing and query APIs alongside higher-level knowledge source and knowledge base APIs for managed retrieval. Use the Azure portal, REST APIs, or Azure SDKs to configure these capabilities, or connect agents to knowledge bases in the Microsoft Foundry portal.
As an independent software vendor (ISV) building multitenant SaaS applications, you can give your customers confidence in data protection through control over their encryption keys. You host Foundry IQ (Azure AI Search) in your Microsoft Entra tenant while your customer manages their key in Azure Key Vault in their own tenant. They can revoke key access to block access to encrypted data. Use a multitenant Microsoft Entra application to enable customer-managed key (CMK) encryption across these tenants without granting your user accounts direct access to the key.
Prerequisites
Tenant A: A tenant and the necessary permissions to create the Foundry IQ service and associated objects (indexes, synonym lists, indexers, data sources, vectorizers, skillsets). Support for customer-managed keys (CMK) requires Basic pricing tier or higher.
Configure the Foundry IQ service for role-based access (recommended for enhanced security, not required).
Tenant B: A separate customer tenant with an Azure Key Vault and the necessary permissions on that tenant:
- Key Vault Contributor: This role is required if you need to create a new key vault.
- Application Administrator or Cloud Application Administrator: Use either role to create a service principal for the multitenant application in tenant B.
- Key Vault Crypto Officer: This role is required to add a new key to the key vault.
- Key Vault Crypto Service Encryption User: This role must be assigned to the service principal created for the installed multitenant application in order to grant the service principal access to the customer-managed key in the key vault. Use Key Vault Data Access Administrator to assign this role. For role assignment requirements, see Grant applications access to a key vault using Azure RBAC. You can view the service principal GUID (also known as Object ID) under:
Enterprise applications\<installed multitenant application>\Manage\Properties\Object ID.
The Azure Key Vault must also be configured for role-based access.
Azure CLI for sending requests.
Choose an authentication approach
You can configure a multitenant Microsoft Entra application to use customer-managed keys in a cross-tenant scenario by using one of the following approaches:
Federated identity support (recommended): Configure Microsoft Entra federated identity credentials (FIC) with a user-assigned managed identity (UAMI). This approach uses managed identity tokens and exchanges them for access tokens, eliminating the need for long-lived secrets and aligning with workload identity federation principles. This approach requires the
federatedIdentityClientIdproperty, which is generally available starting with data plane API version2026-10-01.Client secrets: Configure a client secret using the
accessCredentialsproperty. This approach is less secure and requires additional management to rotate and protect the secret.
For Azure Key Vault Managed HSM configuration, see Configure customer-managed keys for Foundry IQ encrypted data.
Create a multitenant Microsoft Entra application in tenant A
Use the Azure CLI to send requests. The service provider's tenant that contains Foundry IQ will be referred to as tenant A.
Get the tenant ID:
az account show --query tenantId --output tsvEnsure you're signed in to tenant A:
az login --tenant <tenant-A-id>Create the application registration:
az ad app create --display-name cross-tenant-auth --sign-in-audience AzureADMultipleOrgsSave the app ID output from this step.
Use federated identity support
To use federated identity to support a cross-tenant CMK scenario:
The service provider configures the Foundry IQ service in their tenant (Tenant A). For guidance on how to do this, see Create a Foundry IQ service (in the Azure portal) or use the az search service create command in Azure CLI.
The service provider uses the multitenant Microsoft Entra app registration created in tenant A. Record its Application (client) ID.
The service provider sets up a user-assigned managed identity and assigns it to the Foundry IQ service. For guidance on how to do this, see Create a user-assigned managed identity.
The service provider configures the user-assigned managed identity as a federated identity credential on the app. For guidance on how to do this, see Configure an application to trust a managed identity.
Once the service provider shares the multitenant app ID, the customer grants the service provider's app access to the Key Vault in their tenant (Tenant B). To install the app in Tenant B, a service principal must be created with the multitenant app ID. To create the service principal, construct an admin-consent URL and grant tenant-wide consent or use the az ad sp command in Azure CLI.
If the customer doesn't already have a key vault to use, see Quickstart - Create an Azure Key Vault with the Azure portal or Quickstart - Create an Azure Key Vault with the Azure CLI. The Key Vault will need the permission model set to "Azure role-based access control (RBAC)" with the service provider's multitenant application granted permission by assigning it the Key Vault Crypto Service Encryption User role. The customer can then create an encryption key. For guidance on how to do this, see Grant permission to applications to access an Azure key vault using Azure RBAC.
Once these steps are completed, the service provider now has:
An application ID for a multitenant application installed in the customer's tenant, which has been granted access to the customer-managed key.
A managed identity configured as the federated credential on the multitenant application.
The location of the key in the customer's key vault.
With these three parameters, the service provider can now create Foundry IQ objects in Tenant A that can be encrypted with the customer-managed key stored in Tenant B. For guidance on how to configure customer-managed keys on new search objects, see Configure customer-managed keys for Foundry IQ encrypted data.
Validate the federated identity cross-tenant CMK configuration
After you configure the multitenant Microsoft Entra application and connect it to the customer's Key Vault, verify the setup by creating a test object in your Foundry IQ service (tenant A). This example creates an index to confirm that the Foundry IQ service can access the customer-managed key using federated identity authentication.
See Configure customer-managed keys for Foundry IQ encrypted data for guidance on how to create a Foundry IQ service and a new index object with a customer-managed key.
Before creating the index, fill in the following values in its
encryptionKeyconfiguration:keyVaultUri: The URI address from the customer.keyVaultKeyName: The key name from the customer.keyVaultKeyVersion: The key version from the customer.userAssignedIdentity: The<subscription-id>and<resource-group>from your tenant, and the<identity-name>is the user-assigned managed identity name.federatedIdentityClientId: This property value,<application-client-id>, will be the multitenant application (client) ID.
{ "name": "cross-tenant-cmk-test", "fields": [ { "name": "id", "type": "Edm.String", "key": true } ], "encryptionKey": { "keyVaultUri": "https://<key-vault-name>.vault.azure.net/", "keyVaultKeyName": "<key-name>", "keyVaultKeyVersion": "<key-version>", "identity": { "@odata.type": "#Microsoft.Azure.Search.DataUserAssignedIdentity", "userAssignedIdentity": "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identity-name>", "federatedIdentityClientId": "<application-client-id>" } } }Verify the index by sending a
GETrequest:GET https://<search-service>.search.windows.net/indexes/cross-tenant-cmk-test?api-version=2026-10-01
If the request succeeds, check that encryptionKey contains the expected key and identity configuration. This check confirms the saved configuration, not that document indexing and queries work.
If index creation fails with a key access error, verify that:
- The user-assigned managed identity is configured correctly
- The federated identity credential is set on the app
- The Key Vault access policy or RBAC role assignments are correct
Use a client secret (if using federated identity isn't an option)
If federated identity isn't an option, you can add a client secret to the multitenant application to support a cross-tenant CMK scenario:
To add the client secret to the multitenant application in tenant A, run the following command:
az ad app credential reset --id <multitenant-app-id> --append --end-date <end-date>The
--appendparameter preserves existing credentials.Save the password output from this step. The password output is a required input for setting up CMK in Foundry IQ.
For
--end-date, specify a future date in ISO 8601 format that your tenant policy allows. Don't run the credential reset command again after saving the password.
Create a service principal in tenant B for the multitenant application
We refer to the tenant containing Azure Key Vault as tenant B. In tenant B, create a service principal for the multitenant application in tenant A.
Sign in to tenant B:
az login --tenant <tenant-B-id>Create the service principal using the multitenant app ID output from the first step:
az ad sp create --id <multitenant-app-id>The service principal represents the application in tenant B. When you assign the key vault role, you authorize that service principal to use the key in tenant B.
Verify the link between tenant A and B by reviewing the "appOwnerOrganizationId" in the following command:
az ad sp show --id <multitenant-app-id>This command displays the service principal details in JSON. Look for the "appOwnerOrganizationId" field in the output to confirm it matches tenant A's ID.
Save the object ID of the service principal (from the
"id"field) from this step. The object ID is a required input for setting up CMK in Foundry IQ.Get the resource ID for Azure Key Vault:
az keyvault show --name <key-vault-name> --query id --output tsvAssign the Key Vault Crypto Service Encryption User role on the key vault in tenant B to the new service principal.
az role assignment create --assignee <service-principal-object-id> --role "Key Vault Crypto Service Encryption User" --scope <key-vault-resource-id>An example of this assignment might look like this:
az role assignment create --assignee 00001111-aaaa-2222-bbbb-3333cccc4444 --role "Key Vault Crypto Service Encryption User" --scope /subscriptions/87654321-4321-4321-4321-210987654321/resourceGroups/myKeyVaultRG/providers/Microsoft.KeyVault/vaults/myCompanyKeyVault
Validate the client secret cross-tenant CMK configuration
After you configure the multitenant Microsoft Entra application and connect it to the customer's Key Vault, verify the setup by creating a test object in your Foundry IQ service (tenant A). This example creates an index to confirm that the Foundry IQ service can access the customer-managed key using the client secret.
See Configure customer-managed keys for Foundry IQ encrypted data for guidance on how to create a Foundry IQ service and a new index object with a customer-managed key.
Use a REST client to send a
Create Indexrequest. Before creating the index, fill in the following fields:keyVaultUri: The URI address from the customer.keyVaultKeyName: The key name from the customer.keyVaultKeyVersion: The key version from the customer.accessCredentials: TheapplicationIdis something like00001111-aaaa-2222-bbbb-3333cccc4444, and theapplicationSecretis the value you just created.
{
"name": "cross-tenant-cmk-test",
"fields": [
{
"name": "id",
"type": "Edm.String",
"key": true
}
],
"encryptionKey": {
"keyVaultUri": "https://<key-vault-name>.vault.azure.net/",
"keyVaultKeyName": "<key-name>",
"keyVaultKeyVersion": "<key-version>",
"accessCredentials": {
"applicationId": "<application-client-id>",
"applicationSecret": "<application-client-secret>"
}
}
}
Verify the index was created successfully:
GET https://<search-service>.search.windows.net/indexes/cross-tenant-cmk-test?api-version=2026-10-01
The response doesn't return applicationSecret.
For more information about how to rotate or manage keys, see Configure customer-managed keys for data encryption.