Skip to content

Commit 3e6ec68

Browse files
authored
Merge pull request #284297 from eric-urban/eur/use-key-vault
discourage environment variables for API key
2 parents 02b1c41 + 37e538e commit 3e6ec68

27 files changed

+94
-54
lines changed

articles/ai-services/Anomaly-Detector/includes/quickstarts/anomaly-detector-client-library-csharp-multivariate.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
7272

7373
Create and assign persistent environment variables for your key and endpoint.
7474

75+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)]
76+
7577
# [Command Line](#tab/command-line)
7678

7779
```CMD

articles/ai-services/Anomaly-Detector/includes/quickstarts/anomaly-detector-client-library-csharp.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
7676

7777
Create and assign persistent environment variables for your key and endpoint.
7878

79+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)]
80+
7981
# [Command Line](#tab/command-line)
8082

8183
```CMD
@@ -185,8 +187,7 @@ namespace anomaly_detector_quickstart
185187

186188
```
187189

188-
> [!IMPORTANT]
189-
> For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](/azure/key-vault/general/overview). For more information about credential security, see the Azure AI services [security](../../../security-features.md) article.
190+
Run the application with the following command:
190191

191192
```cmd
192193
dotnet run program.cs

articles/ai-services/Anomaly-Detector/includes/quickstarts/anomaly-detector-client-library-javascript.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ Use the Anomaly Detector client library for JavaScript to:
2525

2626
* An Azure subscription - <a href="https://azure.microsoft.com/free/cognitive-services" target="_blank">Create one for free</a>
2727
* The current version of <a href="https://nodejs.org/" target="_blank">Node.js</a>
28-
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesAnomalyDetector" title="Create an Anomaly Detector resource" target="_blank">create an Anomaly Detector resource </a> in the Azure portal to get your key and endpoint. Wait for it to deploy and select the **Go to resource** button.
29-
* You'll need the key and endpoint from the resource you create to connect your application to the Anomaly Detector API. You'll use the key and endpoint to create environment variables.
30-
You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
28+
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesAnomalyDetector" title="Create an Anomaly Detector resource" target="_blank">create an Anomaly Detector resource </a> in the Azure portal to get your key and endpoint. Wait for it to deploy and select the **Go to resource** button. You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
3129

3230
## Set up
3331

@@ -76,6 +74,8 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
7674

7775
Create and assign persistent environment variables for your key and endpoint.
7876

77+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)]
78+
7979
# [Command Line](#tab/command-line)
8080

8181
```CMD
@@ -130,7 +130,7 @@ const { AzureKeyCredential } = require("@azure/core-auth");
130130
const { parse } = require("csv-parse/sync");
131131
const fs = require("fs");
132132

133-
// You will need to set this environment variables or edit the following values
133+
// Retrieve the endpoint and key from the environment variables.
134134
const apiKey = process.env["ANOMALY_DETECTOR_API_KEY"] || "";
135135
const endpoint = process.env["ANOMALY_DETECTOR_ENDPOINT"] || "";
136136
const timeSeriesDataPath = "./request-data.csv";

articles/ai-services/Anomaly-Detector/includes/quickstarts/anomaly-detector-client-library-python-multivariate.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
7676

7777
Create and assign persistent environment variables for your key and endpoint.
7878

79+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)]
80+
7981
# [Command Line](#tab/command-line)
8082

8183
```CMD

articles/ai-services/Anomaly-Detector/includes/quickstarts/anomaly-detector-client-library-python.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
5252

5353
Create and assign persistent environment variables for your key and endpoint.
5454

55+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)]
56+
5557
# [Command Line](#tab/command-line)
5658

5759
```CMD

articles/ai-services/Anomaly-Detector/includes/quickstarts/anomaly-detector-rest-api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
3232

3333
Create and assign persistent environment variables for your key and endpoint.
3434

35+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)]
36+
3537
# [Command Line](#tab/command-line)
3638

3739
```CMD

articles/ai-services/TOC.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ items:
7676
href: authentication.md
7777
- name: Disable local authentication
7878
href: disable-local-auth.md
79+
- name: Use Azure key vault
80+
href: use-key-vault.md
7981
- name: Rotate keys
8082
href: rotate-keys.md
8183
- name: Use environment variables
@@ -84,8 +86,6 @@ items:
8486
href: ./encryption/cognitive-services-encryption-keys-portal.md
8587
- name: Use virtual networks
8688
href: cognitive-services-virtual-networks.md
87-
- name: Use Azure key vault
88-
href: use-key-vault.md
8989
- name: Configure data loss prevention
9090
href: cognitive-services-data-loss-prevention.md
9191
- name: Security baseline

articles/ai-services/authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ In this sample, a password is used to authenticate the service principal. The to
251251
```
252252

253253
> [!NOTE]
254-
> Anytime you use passwords in a script, the most secure option is to use the PowerShell Secrets Management module and integrate with a solution such as Azure KeyVault.
254+
> Anytime you use passwords in a script, the most secure option is to use the PowerShell Secrets Management module and integrate with a solution such as Azure Key Vault.
255255
256256
3. Call the Computer Vision API:
257257
```powershell-interactive

articles/ai-services/cognitive-services-environment-variables.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
title: Use environment variables with Azure AI services
33
titleSuffix: Azure AI services
4-
description: "This guide shows you how to set and retrieve environment variables to handle your Azure AI services subscription credentials in a more secure way when you test out applications."
5-
#services: cognitive-services
6-
author: PatrickFarley
4+
description: This guide shows you how to set and retrieve environment variables for your Azure AI services credentials when you test applications.
5+
author: eric-urban
76
manager: nitinme
87
ms.service: azure-ai-services
98
ms.topic: how-to
10-
ms.date: 01/20/2024
11-
ms.author: pafarley
9+
ms.date: 8/11/2024
10+
ms.author: eur
1211
---
1312

1413
# Use environment variables with Azure AI services
1514

16-
This guide shows you how to set and retrieve environment variables to handle your Azure AI services subscription credentials in a more secure way when you test out applications.
15+
This guide shows you how to set and retrieve environment variables for your Azure AI services credentials when you test applications.
16+
17+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)]
1718

1819
## Set an environment variable
1920

articles/ai-services/security-features.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,34 @@
22
title: Azure AI services security
33
titleSuffix: Azure AI services
44
description: Learn about the security considerations for Azure AI services usage.
5-
#services: cognitive-services
6-
author: PatrickFarley
5+
author: eric-urban
76
manager: nitinme
87
ms.service: azure-ai-services
98
ms.topic: conceptual
10-
ms.date: 01/20/2024
11-
ms.author: pafarley
9+
ms.date: 8/11/2024
10+
ms.author: eur
1211
ms.custom: devx-track-csharp
1312
---
1413

1514
# Azure AI services security
1615

1716
Security should be considered a top priority in the development of all applications, and with the growth of artificial intelligence enabled applications, security is even more important. This article outlines various security features available for Azure AI services. Each feature addresses a specific liability, so multiple features can be used in the same workflow.
1817

19-
For a comprehensive list of Azure service security recommendations see the [Azure AI services security baseline](/security/benchmark/azure/baselines/cognitive-services-security-baseline?toc=%2Fazure%2Fcognitive-services%2FTOC.json) article.
18+
For a comprehensive list of Azure service security recommendations, see the [Azure AI services security baseline](/security/benchmark/azure/baselines/cognitive-services-security-baseline?toc=%2Fazure%2Fcognitive-services%2FTOC.json) article.
2019

2120
## Security features
2221

2322
|Feature | Description |
2423
|:---|:---|
2524
| [Transport Layer Security (TLS)](/dotnet/framework/network-programming/tls) | All of the Azure AI services endpoints exposed over HTTP enforce the TLS 1.2 protocol. With an enforced security protocol, consumers attempting to call an Azure AI services endpoint should follow these guidelines:<ul><li>The client operating system (OS) needs to support TLS 1.2.</li><li>The language (and platform) used to make the HTTP call need to specify TLS 1.2 as part of the request. Depending on the language and platform, specifying TLS is done either implicitly or explicitly.</li><li>For .NET users, consider the [Transport Layer Security best practices](/dotnet/framework/network-programming/tls)</li></ul> |
26-
| [Authentication options](./authentication.md)| Authentication is the act of verifying a user's identity. Authorization, by contrast, is the specification of access rights and privileges to resources for a given identity. An identity is a collection of information about a <a href="https://en.wikipedia.org/wiki/Principal_(computer_security)" target="_blank">principal</a>, and a principal can be either an individual user or a service.</br></br>By default, you authenticate your own calls to Azure AI services using the subscription keys provided; this is the simplest method but not the most secure. The most secure authentication method is to use managed roles in Microsoft Entra ID. To learn about this and other authentication options, see [Authenticate requests to Azure AI services](./authentication.md). |
27-
| [Key rotation](./authentication.md)| Each Azure AI services resource has two API keys to enable secret rotation. This is a security precaution that lets you regularly change the keys that can access your service, protecting the privacy of your service in the event that a key gets leaked. To learn about this and other authentication options, see [Rotate keys](./rotate-keys.md). |
28-
| [Environment variables](cognitive-services-environment-variables.md) | Environment variables are name-value pairs that are stored within a specific development environment. You can store your credentials in this way as a more secure alternative to using hardcoded values in your code. However, if your environment is compromised, the environment variables are compromised as well, so this is not the most secure approach.</br></br> For instructions on how to use environment variables in your code, see the [Environment variables guide](cognitive-services-environment-variables.md). |
29-
| [Customer-managed keys (CMK)](./encryption/cognitive-services-encryption-keys-portal.md) | This feature is for services that store customer data at rest (longer than 48 hours). While this data is already double-encrypted on Azure servers, users can get extra security by adding another layer of encryption, with keys they manage themselves. You can link your service to Azure Key Vault and manage your data encryption keys there. </br></br>Only some services can use CMK; look for your service on the [Customer-managed keys](./encryption/cognitive-services-encryption-keys-portal.md) page.|
25+
| [Authentication options](./authentication.md)| Authentication is the act of verifying a user's identity. Authorization, by contrast, is the specification of access rights and privileges to resources for a given identity. An identity is a collection of information about a <a href="https://en.wikipedia.org/wiki/Principal_(computer_security)" target="_blank">principal</a>, and a principal can be either an individual user or a service.<br/><br/>By default, you authenticate your own calls to Azure AI services using the subscription keys provided; this is the simplest method but not the most secure. The most secure authentication method is to use managed roles in Microsoft Entra ID. To learn about this and other authentication options, see [Authenticate requests to Azure AI services](./authentication.md).|
26+
| [Key rotation](./authentication.md)| Each Azure AI services resource has two API keys to enable secret rotation. This is a security precaution that lets you regularly change the keys that can access your service, protecting the privacy of your service if a key gets leaked. To learn about this and other authentication options, see [Rotate keys](./rotate-keys.md). |
27+
| [Environment variables](cognitive-services-environment-variables.md) | Environment variables are name-value pairs that are stored within a specific development environment. Environment variables are more secure than using hardcoded values in your code. For instructions on how to use environment variables in your code, see the [Environment variables guide](cognitive-services-environment-variables.md).<br/><br/>However, if your environment is compromised, the environment variables are compromised as well, so this isn't the most secure approach. The most secure authentication method is to use managed roles in Microsoft Entra ID. To learn about this and other authentication options, see [Authenticate requests to Azure AI services](./authentication.md).|
28+
| [Customer-managed keys (CMK)](./encryption/cognitive-services-encryption-keys-portal.md) | This feature is for services that store customer data at rest (longer than 48 hours). While this data is already double-encrypted on Azure servers, users can get extra security by adding another layer of encryption, with keys they manage themselves. You can link your service to Azure Key Vault and manage your data encryption keys there.<br/><br/>Check to see if CMK is supported by the service that you want to use in the [Customer-managed keys](./encryption/cognitive-services-encryption-keys-portal.md) documentation.|
3029
| [Virtual networks](./cognitive-services-virtual-networks.md) | Virtual networks allow you to specify which endpoints can make API calls to your resource. The Azure service will reject API calls from devices outside of your network. You can set a formula-based definition of the allowed network, or you can define an exhaustive list of endpoints to allow. This is another layer of security that can be used in combination with others. |
3130
| [Data loss prevention](./cognitive-services-data-loss-prevention.md) | The data loss prevention feature lets an administrator decide what types of URIs their Azure resource can take as inputs (for those API calls that take URIs as input). This can be done to prevent the possible exfiltration of sensitive company data: If a company stores sensitive information (such as a customer's private data) in URL parameters, a bad actor inside that company could submit the sensitive URLs to an Azure service, which surfaces that data outside the company. Data loss prevention lets you configure the service to reject certain URI forms on arrival.|
32-
| [Customer Lockbox](../security/fundamentals/customer-lockbox-overview.md) |The Customer Lockbox feature provides an interface for customers to review and approve or reject data access requests. It's used in cases where a Microsoft engineer needs to access customer data during a support request. For information on how Customer Lockbox requests are initiated, tracked, and stored for later reviews and audits, see the [Customer Lockbox guide](../security/fundamentals/customer-lockbox-overview.md).</br></br>Customer Lockbox is available for the following services:<ul><li>Azure OpenAI</li><li>Translator</li><li>Conversational language understanding</li><li>Custom text classification</li><li>Custom named entity recognition</li><li>Orchestration workflow</li></ul>|
33-
| [Bring your own storage (BYOS)](./speech-service/speech-encryption-of-data-at-rest.md)| The Speech service doesn't currently support Customer Lockbox. However, you can arrange for your service-specific data to be stored in your own storage resource using bring-your-own-storage (BYOS). BYOS allows you to achieve similar data controls to Customer Lockbox. Keep in mind that Speech service data stays and is processed in the Azure region where the Speech resource was created. This applies to any data at rest and data in transit. For customization features like Custom Speech and Custom Voice, all customer data is transferred, stored, and processed in the same region where the Speech service resource and BYOS resource (if used) reside. </br></br>To use BYOS with Speech, follow the [Speech encryption of data at rest](./speech-service/speech-encryption-of-data-at-rest.md) guide.</br></br> Microsoft does not use customer data to improve its Speech models. Additionally, if endpoint logging is disabled and no customizations are used, then no customer data is stored by Speech. |
31+
| [Customer Lockbox](../security/fundamentals/customer-lockbox-overview.md) |The Customer Lockbox feature provides an interface for customers to review and approve or reject data access requests. It's used in cases where a Microsoft engineer needs to access customer data during a support request. For information on how Customer Lockbox requests are initiated, tracked, and stored for later reviews and audits, see the [Customer Lockbox guide](../security/fundamentals/customer-lockbox-overview.md).<br/><br/>Customer Lockbox is available for the following services:<ul><li>Azure OpenAI</li><li>Translator</li><li>Conversational language understanding</li><li>Custom text classification</li><li>Custom named entity recognition</li><li>Orchestration workflow</li></ul>|
32+
| [Bring your own storage (BYOS)](./speech-service/speech-encryption-of-data-at-rest.md)| The Speech service doesn't currently support Customer Lockbox. However, you can arrange for your service-specific data to be stored in your own storage resource using bring-your-own-storage (BYOS). BYOS allows you to achieve similar data controls to Customer Lockbox. Keep in mind that Speech service data stays and is processed in the Azure region where the Speech resource was created. This applies to any data at rest and data in transit. For customization features like Custom Speech and Custom Voice, all customer data is transferred, stored, and processed in the same region where the Speech service resource and BYOS resource (if used) reside.<br/><br/>To use BYOS with Speech, follow the [Speech encryption of data at rest](./speech-service/speech-encryption-of-data-at-rest.md) guide.<br/><br/>Microsoft doesn't use customer data to improve its Speech models. Additionally, if endpoint logging is disabled and no customizations are used, then no customer data is stored by Speech. |
3433

3534
## Next steps
3635

0 commit comments

Comments
 (0)