Skip to content

Commit aeaf1bb

Browse files
committed
Update security note
1 parent b4e328f commit aeaf1bb

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ since the local app needs credentials for Azure AI to work properly.
2424

2525
## Important Security Notice
2626

27-
This template, the application code and configuration it contains, has been built to showcase Microsoft Azure specific services and tools. We strongly advise our customers not to make this code part of their production environments without implementing or enabling additional security features. When you deploy this app, it will be **publicly accessible on the internet**. See [Security Guidelines](#security-guidelines) for more information on how to secure your deployment.
27+
This template, the application code and configuration it contains, has been built to showcase Microsoft Azure specific services and tools. We strongly advise our customers not to make this code part of their production environments without implementing or enabling additional security features. See [Security Guidelines](#security-guidelines) for more information on how to secure your deployment.
2828

2929
## Features
3030

3131
* A Python [Quart](https://quart.palletsprojects.com/en/latest/) that uses the [Azure AI Inference SDK](https://learn.microsoft.com/python/api/overview/azure/ai-inference-readme?view=azure-python-preview) package to generate responses to user messages.
32-
* A basic HTML/JS frontend that streams responses from the backend using [JSON Lines](http://jsonlines.org/) over a [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
32+
* A basic HTML/JS frontend that streams responses from the backend using [JSON Lines](http://jsonlines.org/) over a [ReadableStream](https://developer.mozilla.org/docs/Web/API/ReadableStream).
3333
* [Bicep files](https://docs.microsoft.com/azure/azure-resource-manager/bicep/) for provisioning Azure resources, including Azure AI Services, Azure Container Apps, Azure Container Registry, Azure Log Analytics, and RBAC roles.
3434

3535
![Screenshot of the chat app](docs/screenshot_chatapp.png)
@@ -126,7 +126,7 @@ Once you've opened the project in [Codespaces](#github-codespaces), in [Dev Cont
126126
azd up
127127
```
128128

129-
It will prompt you to provide an `azd` environment name (like "chat-app"), select a subscription from your Azure account, and select a [location where DeepSeek-R1 is available](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-serverless-availability#deepseek-models-from-microsoft) (like "westus"). Then it will provision the resources in your account and deploy the latest code. If you get an error or timeout with deployment, changing the location can help, as there may be availability constraints for the Azure AI resource.
129+
It will prompt you to provide an `azd` environment name (like "chat-app"), select a subscription from your Azure account, and select a [location where DeepSeek-R1 is available](https://learn.microsoft.com/azure/ai-studio/how-to/deploy-models-serverless-availability#deepseek-models-from-microsoft) (like "westus"). Then it will provision the resources in your account and deploy the latest code. If you get an error or timeout with deployment, changing the location can help, as there may be availability constraints for the Azure AI resource.
130130

131131
3. When `azd` has finished deploying, you'll see an endpoint URI in the command output. Visit that URI, and you should see the chat app! 🎉
132132
4. Remember to take down your app once you're no longer using it, either by deleting the resource group in the Portal or running this command:
@@ -197,9 +197,11 @@ either by deleting the resource group in the Portal or running `azd down`.
197197
198198
This template uses [Managed Identity](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/overview) for authenticating to the Azure OpenAI service.
199199
200+
This template also enables the Container Apps [built-in authentication feature](https://learn.microsoft.com/azure/container-apps/authentication) with a Microsoft Entra ID identity provider. The Bicep files use the new [Microsoft Graph extension (public preview)](https://learn.microsoft.com/graph/templates/overview-bicep-templates-for-graph) to create the Entra application registration using [managed identity with Federated Identity Credentials](https://learn.microsoft.com/azure/container-apps/managed-identity), so that no client secrets or certificates are necessary.
201+
200202
Additionally, we have added a [GitHub Action](https://github.com/microsoft/security-devops-action) that scans the infrastructure-as-code files and generates a report containing any detected issues. To ensure continued best practices in your own repository, we recommend that anyone creating solutions based on our templates ensure that the [Github secret scanning](https://docs.github.com/code-security/secret-scanning/about-secret-scanning) setting is enabled.
201203
202204
You may want to consider additional security measures, such as:
203205
204206
* Protecting the Azure Container Apps instance with a [firewall](https://learn.microsoft.com/azure/container-apps/waf-app-gateway) and/or [Virtual Network](https://learn.microsoft.com/azure/container-apps/networking?tabs=workload-profiles-env%2Cazure-cli).
205-
* Adding user login to the app, to restrict access only to users within your organization. See [this example for adding user login with the built-in auth feature of Container Apps](https://github.com/Azure-Samples/openai-chat-app-entra-auth-builtin).
207+
* Enabling Microsoft Defender for Cloud on the resource group and setting up [security policies](https://learn.microsoft.com/azure/defender-for-cloud/security-policy-concept).

infra/aca.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ module app 'core/host/container-app-upsert.bicep' = {
4747
containerRegistryName: containerRegistryName
4848
env: env
4949
targetPort: 50505
50+
secrets: {
51+
'override-use-mi-fic-assertion-client-id': acaIdentity.properties.clientId
52+
}
5053
}
5154
}
5255

infra/main.bicep

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ param principalId string = ''
1414

1515
param acaExists bool = false
1616

17-
// Parameters for the Azure AI resource:
18-
param aiServicesResourceGroupName string = ''
1917
@minLength(1)
2018
@description('Location for the Azure AI resource')
2119
// https://learn.microsoft.com/azure/ai-studio/how-to/deploy-models-serverless-availability#deepseek-models-from-microsoft
@@ -50,10 +48,6 @@ resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
5048
tags: tags
5149
}
5250

53-
resource aiServicesResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = if (!empty(aiServicesResourceGroupName)) {
54-
name: !empty(aiServicesResourceGroupName) ? aiServicesResourceGroupName : resourceGroup.name
55-
}
56-
5751
var prefix = '${name}-${resourceToken}'
5852

5953
var aiServicesNameAndSubdomain = '${resourceToken}-aiservices'
@@ -133,7 +127,7 @@ module aca 'aca.bicep' = {
133127
}
134128
}
135129

136-
/*var issuer = '${environment().authentication.loginEndpoint}${tenant().tenantId}/v2.0'
130+
var issuer = '${environment().authentication.loginEndpoint}${tenant().tenantId}/v2.0'
137131
module registration 'appregistration.bicep' = {
138132
name: 'reg'
139133
scope: resourceGroup
@@ -145,9 +139,9 @@ module registration 'appregistration.bicep' = {
145139
issuer: issuer
146140
serviceManagementReference: serviceManagementReference
147141
}
148-
}*/
142+
}
149143

150-
/*module appupdate 'appupdate.bicep' = {
144+
module appupdate 'appupdate.bicep' = {
151145
name: 'appupdate'
152146
scope: resourceGroup
153147
params: {
@@ -156,11 +150,11 @@ module registration 'appregistration.bicep' = {
156150
openIdIssuer: issuer
157151
includeTokenStore: false
158152
}
159-
}*/
153+
}
160154

161155

162156
module aiServicesRoleBackend 'core/security/role.bicep' = {
163-
scope: aiServicesResourceGroup
157+
scope: resourceGroup
164158
name: 'aiservices-role-backend'
165159
params: {
166160
principalId: aca.outputs.identityPrincipalId

0 commit comments

Comments
 (0)