This document details how to deploy Chat Copilot's required resources to your Azure subscription.
-
Access to Azure OpenAI is currently limited as we navigate high demand, upcoming product improvements, and Microsoft’s commitment to responsible AI. For more details and information on applying for access, go here. For regional availability of Azure OpenAI, see the availability map.
-
With the limited availability of Azure OpenAI, consider sharing an Azure OpenAI instance across multiple resources.
-
F1
andD1
SKUs for the App Service Plans are not currently supported for this deployment in order to support private networking. -
Chat Copilot deployments use Azure Active Directory for authentication. All endpoints (except
/healthz
and/authInfo
) require authentication to access.
Before you get started, make sure you have the following requirements in place:
- Azure AD Tenant
- Azure CLI (i.e., az) (if you already installed Azure CLI, make sure to update your installation to the latest version)
- Windows, go to https://aka.ms/installazurecliwindows
- Linux, run "
curl -L https://aka.ms/InstallAzureCli | bash
"
- (Linux only)
zip
can be installed by running "sudo apt install zip
"
You will need two Azure Active Directory (AAD) application registrations -- one for the frontend web app and one for the backend API.
For details on creating an application registration, go here.
NOTE: Other account types can be used to allow multitenant and personal Microsoft accounts to use your application if you desire. Doing so may result in more users and therefore higher costs.
- Select
Single-page application (SPA)
as platform type, and set the redirect URI tohttp://localhost:3000
- Select
Accounts in this organizational directory only ({YOUR TENANT} only - Single tenant)
as supported account types. - Make a note of the
Application (client) ID
from the Azure Portal for use in theDeploy Frontend
step below.
- Do not set a redirect URI
- Select
Accounts in this organizational directory only ({YOUR TENANT} only - Single tenant)
as supported account types. - Make a note of the
Application (client) ID
from the Azure Portal for use in theDeploy Azure infrastructure
step below.
-
Expose an API within the backend app registration
-
Select Expose an API from the menu
-
Add an Application ID URI
-
This will generate an
api://
URI -
Click Save to store the generated URI
-
-
Add a scope for
access_as_user
-
Click Add scope
-
Set Scope name to
access_as_user
-
Set Who can consent to Admins and users
-
Set Admin consent display name and User consent display name to
Access Chat Copilot as a user
-
Set Admin consent description and User consent description to
Allows the accesses to the Chat Copilot web API as a user
-
-
Add the web app frontend as an authorized client application
-
Click Add a client application
-
For Client ID, enter the frontend's application (client) ID
-
Check the checkbox under Authorized scopes
-
Click Add application
-
-
-
Add permissions to web app frontend to access web api as user
-
Open app registration for web app frontend
-
Go to API Permissions
-
Click Add a permission
-
Select the tab APIs my organization uses
-
Choose the app registration representing the web api backend
-
Select permissions
access_as_user
-
Click Add permissions
-
The examples below assume you are using an existing Azure OpenAI resource. See the notes following each command for using OpenAI or creating a new Azure OpenAI resource.
./deploy-azure.ps1 -Subscription {YOUR_SUBSCRIPTION_ID} -DeploymentName {YOUR_DEPLOYMENT_NAME} -AIService {AzureOpenAI or OpenAI} -AIApiKey {YOUR_AI_KEY} -AIEndpoint {YOUR_AZURE_OPENAI_ENDPOINT} -BackendClientId {YOUR_BACKEND_APPLICATION_ID} -FrontendClientId {YOUR_FRONTEND_APPLICATION_ID} -TenantId {YOUR_TENANT_ID}
- To use an existing Azure OpenAI resource, set
-AIService
toAzureOpenAI
and include-AIApiKey
and-AIEndpoint
. - To deploy a new Azure OpenAI resource, set
-AIService
toAzureOpenAI
and omit-AIApiKey
and-AIEndpoint
. - To use an an OpenAI account, set
-AIService
toOpenAI
and include-AIApiKey
.
chmod +x ./deploy-azure.sh
./deploy-azure.sh --subscription {YOUR_SUBSCRIPTION_ID} --deployment-name {YOUR_DEPLOYMENT_NAME} --ai-service {AzureOpenAI or OpenAI} --ai-service-key {YOUR_AI_KEY} --ai-endpoint {YOUR_AZURE_OPENAI_ENDPOINT} --client-id {YOUR_BACKEND_APPLICATION_ID} --frontend-client-id {YOUR_FRONTEND_APPLICATION_ID} --tenant-id {YOUR_TENANT_ID}
- To use an existing Azure OpenAI resource, set
--ai-service
toAzureOpenAI
and include--ai-service-key
and--ai-endpoint
. - To deploy a new Azure OpenAI resource, set
--ai-service
toAzureOpenAI
and omit--ai-service-key
and--ai-endpoint
. - To use an an OpenAI account, set
--ai-service
toOpenAI
and include--ai-service-key
.
You can also deploy the infrastructure directly from the Azure Portal by clicking the button below:
This will automatically deploy the most recent release of Chat Copilot binaries (link).
To find the deployment name when using
Deploy to Azure
, look for a deployment in your resource group that starts withMicrosoft.Template
.
To deploy the application, first package it, then deploy it to the Azure resources created above.
./package-webapi.ps1
./deploy-webapi.ps1 -Subscription {YOUR_SUBSCRIPTION_ID} -ResourceGroupName {YOUR_RESOURCE_GROUP_NAME} -DeploymentName {YOUR_DEPLOYMENT_NAME}
chmod +x ./package-webapi.sh
./package-webapi.sh
chmod +x ./deploy-webapi.sh
./deploy-webapi.sh --subscription {YOUR_SUBSCRIPTION_ID} --resource-group {YOUR_RESOURCE_GROUP_NAME} --deployment-name {YOUR_DEPLOYMENT_NAME}
NOTE: This step can be skipped if the required resources for the web searcher plugin are not deployed. The required resources include a Bing resource and an Azure Function. The required resources are NOT deployed by default. To deploy the required resources, use the
-DeployWebSearcherPlugin
or--deploy-web-searcher-plugin
flag when running the deploy-azure.ps1/deploy-azure.sh script.
NOTE: This step can be skipped if the previous Azure Resources creation step, including the resources required by the Web Search plugin, succeeded without errors. The
deployPackages = true
setting in main.bicep ensures that the WebSearcher is deployed.
NOTE: More hosted plugins will be available.
To deploy the plugins, build the packages first and deploy them to the Azure resources created above.
./package-plugins.ps1
./deploy-plugins.ps1 -Subscription {YOUR_SUBSCRIPTION_ID} -ResourceGroupName rg-{YOUR_DEPLOYMENT_NAME} -DeploymentName {YOUR_DEPLOYMENT_NAME}
chmod +x ./package-plugins.sh
./package-webapi.sh
chmod +x ./deploy-plugins.sh
./deploy-webapi.sh --subscription {YOUR_SUBSCRIPTION_ID} --resource-group rg-{YOUR_DEPLOYMENT_NAME} --deployment-name {YOUR_DEPLOYMENT_NAME}
NOTE: This step can be skipped if the WebApi is NOT configured to run asynchronously for document processing. By default, the WebApi is configured to run asynchronously for document processing in deployment.
NOTE: This step can be skipped if the previous Azure Resources creation step succeeded without errors. The deployPackages = true setting in main.bicep ensures that the latest Chat Copilot memory pipeline is deployed.
To deploy the memorypipeline, build the deployment package first and deploy it to the Azure resources created above.
.\package-memorypipeline.ps1
.\deploy-memorypipeline.ps1 -Subscription {YOUR_SUBSCRIPTION_ID} -ResourceGroupName {YOUR_RESOURCE_GROUP_NAME} -DeploymentName {YOUR_DEPLOYMENT_NAME}
chmod +x ./package-memorypipeline.sh
./package-memorypipeline.sh
chmod +x ./deploy-memorypipeline.sh
./deploy-memorypipeline.sh --subscription {YOUR_SUBSCRIPTION_ID} --resource-group {YOUR_RESOURCE_GROUP_NAME} --deployment-name {YOUR_DEPLOYMENT_NAME}
Your Chat Copilot application is now deployed!
Make sure to include your frontend's URL as an allowed origin in your deployment's CORS settings. Otherwise, web browsers will refuse to let JavaScript make calls to your deployment.
To do this, go on the Azure portal, select your Semantic Kernel App Service, then click on "CORS" under the "API" section of the resource menu on the left of the page. This will get you to the CORS page where you can add your allowed hosts.
$webApiName = $(az deployment group show --name {DEPLOYMENT_NAME} --resource-group {YOUR_RESOURCE_GROUP_NAME} --output json | ConvertFrom-Json).properties.outputs.webapiName.value
az webapp cors add --name $webapiName --resource-group $ResourceGroupName --subscription $Subscription --allowed-origins YOUR_FRONTEND_URL
eval WEB_API_NAME=$(az deployment group show --name $DEPLOYMENT_NAME --resource-group $RESOURCE_GROUP --output json) | jq -r '.properties.outputs.webapiName.value'
az webapp cors add --name $WEB_API_NAME --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION --allowed-origins YOUR_FRONTEND_URL