Skip to content

Commit a8c1187

Browse files
authored
Merge pull request #107631 from IEvangelist/cogServicesSecurity
Cog Svcs security skeleton
2 parents 04e546f + 795313d commit a8c1187

File tree

3 files changed

+218
-29
lines changed

3 files changed

+218
-29
lines changed

articles/cognitive-services/TOC.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,28 @@
77
href: Welcome.md
88
- name: Cognitive Services and Machine learning
99
href: cognitive-services-and-machine-learning.md
10-
- name: Virtual networks for Cognitive Services
11-
href: cognitive-services-virtual-networks.md
1210
- name: Custom subdomains for Cognitive Services
1311
href: cognitive-services-custom-subdomains.md
1412
- name: Language support
1513
href: language-support.md
16-
- name: Configure customer-managed keys with the Azure portal
17-
href: ./Encryption/cognitive-services-encryption-keys-portal.md
14+
- name: Quickstarts
15+
items:
16+
- name: Create a new resource using the Azure portal
17+
href: cognitive-services-apis-create-account.md
18+
- name: Create a new resource using the Azure CLI
19+
href: cognitive-services-apis-create-account-cli.md
20+
- name: Diagnostic logging
21+
href: diagnostic-logging.md
22+
- name: Security
23+
items:
24+
- name: Cognitive Services security
25+
href: cognitive-services-security.md
26+
- name: Virtual networks for Cognitive Services
27+
href: cognitive-services-virtual-networks.md
28+
- name: Configure customer-managed keys
29+
href: ./encryption/cognitive-services-encryption-keys-portal.md
30+
- name: Authenticate requests to Cognitive Services
31+
href: authentication.md
1832
- name: Container support
1933
items:
2034
- name: Container support
@@ -41,16 +55,6 @@
4155
href: ../container-registry/container-registry-get-started-azure-cli.md
4256
- name: Azure Kubernetes Service (AKS)
4357
href: ../aks/tutorial-kubernetes-prepare-app.md
44-
- name: Quickstarts
45-
items:
46-
- name: Create a new resource using the Azure portal
47-
href: cognitive-services-apis-create-account.md
48-
- name: Create a new resource using the Azure CLI
49-
href: cognitive-services-apis-create-account-cli.md
50-
- name: Authentication
51-
href: authentication.md
52-
- name: Diagnostic logging
53-
href: diagnostic-logging.md
5458
- name: Resources
5559
items:
5660
- name: Azure Roadmap
@@ -63,15 +67,15 @@
6367
href: https://azure.microsoft.com/support/legal/cognitive-services-compliance-and-privacy/
6468
- name: Support & help options
6569
href: cognitive-services-support-options.md
66-
- name: Service Level Agreement(SLA)
70+
- name: Service Level Agreement (SLA)
6771
href: https://azure.microsoft.com/support/legal/sla/cognitive-services/v1_1/
6872
- name: Videos
6973
href: https://azure.microsoft.com/resources/videos/index/?services=cognitive-services
7074
- name: Blog
7175
href: https://azure.microsoft.com/blog/topics/cognitive-services/
7276
- name: Service updates
7377
href: https://azure.microsoft.com/updates/?product=cognitive-services
74-
- name: Provide Product Feedback
78+
- name: Provide product feedback
7579
href: https://cognitive.uservoice.com/
7680
- name: Code of conduct
7781
href: https://go.microsoft.com/fwlink/?LinkId=698895
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
---
2+
title: Security
3+
titleSuffix: Azure Cognitive Services
4+
description: Learn about the various security considerations for Cognitive Services usage.
5+
services: cognitive-services
6+
author: IEvangelist
7+
manager: nitinme
8+
ms.service: cognitive-services
9+
ms.topic: conceptual
10+
ms.date: 03/18/2020
11+
ms.author: dapine
12+
---
13+
14+
# Azure Cognitive Services security
15+
16+
Security should be considered a top priority when developing any and all applications. With the onset of artificial intelligence enabled applications, security is even more important. In this article various aspects of Azure Cognitive Services security are outlined, such as the use of transport layer security, authentication, and securely configuring sensitive data.
17+
18+
## Transport Layer Security (TLS)
19+
20+
All of the Cognitive Services endpoints exposed over HTTP enforce TLS 1.2. With an enforced security protocol, consumers attempting to call a Cognitive Services endpoint should adhere to guidelines:
21+
22+
* The client Operating System (OS) would need to support TLS 1.2
23+
* The language (and platform) used to make the HTTP call would need to specify TLS 1.2 as part of the request
24+
* Depending on the language and platform, specifying TLS is done either implicitly or explicitly
25+
26+
For .NET users, consider the <a href="https://docs.microsoft.com/dotnet/framework/network-programming/tls" target="_blank">Transport Layer Security best practices <span class="docon docon-navigate-external x-hidden-focus"></span></a>.
27+
28+
## Authentication
29+
30+
When discussing authentication, there are several common misconceptions. Authentication and authorization are often confused for one another. Identity is also a major component in security. An identity is a collection of information about a <a href="https://en.wikipedia.org/wiki/Principal_(computer_security)" target="_blank">principal <span class="docon docon-navigate-external x-hidden-focus"></span></a>. Identity providers (IdP) provide identities to authentication services. Authentication is the act of verifying a user's identity. Authorization is the specification of access rights and privileges to resources for a given identity.
31+
32+
For more information on authentication with subscription keys, access tokens and Azure Active Directory (AAD), see <a href="https://docs.microsoft.com/azure/cognitive-services/authentication" target="_blank">authenticate requests to Azure Cognitive Services<span class="docon docon-navigate-external x-hidden-focus"></span></a>.
33+
34+
## Environment variables and application configuration
35+
36+
Environment variables are name-value pairs, stored within a specific environment. A more secure alternative to using hardcoded values for sensitive data, is to use environment variables. Hardcoded values are insecure and should be avoided.
37+
38+
> [!CAUTION]
39+
> Do **not** use hardcoded values for sensitive data, doing so is a major security vulnerability.
40+
41+
> [!NOTE]
42+
> While environment variables are stored in plain text, they are isolated to an environment. If an environment is compromised, so too are the variables with the environment.
43+
44+
### Set environment variable
45+
46+
To set environment variables, use one the following commands - where the `ENVIRONMENT_VARIABLE_KEY` is the named key and `value` is the value stored in the environment variable.
47+
48+
# [Command Line](#tab/command-line)
49+
50+
```CMD
51+
:: Assigns the env var to the value
52+
set ENVIRONMENT_VARIABLE_KEY=value
53+
54+
:: Prints the env var value
55+
echo %ENVIRONMENT_VARIABLE_KEY%
56+
```
57+
58+
# [PowerShell](#tab/powershell)
59+
60+
```powershell
61+
# Assigns the env var to the value
62+
$Env:ENVIRONMENT_VARIABLE_KEY="value"
63+
64+
# Prints the env var value
65+
$Env:ENVIRONMENT_VARIABLE_KEY
66+
```
67+
68+
# [Bash](#tab/bash)
69+
70+
```Bash
71+
# Assigns the env var to the value
72+
export ENVIRONMENT_VARIABLE_KEY=value
73+
74+
# Prints the env var value
75+
echo ENVIRONMENT_VARIABLE_KEY
76+
```
77+
78+
---
79+
80+
> [!TIP]
81+
> After setting an environment variable, restart your integrated development environment (IDE) to ensure that newly added environment variables are available.
82+
83+
### Get environment variable
84+
85+
To get an environment variable, it must be read into memory. Depending on the language you're using, consider the following code snippets. These code snippets demonstrate how to get environment variable given the `ENVIRONMENT_VARIABLE_KEY` and assign to a variable named `value`.
86+
87+
# [C#](#tab/csharp)
88+
89+
For more information, see <a href="https://docs.microsoft.com/dotnet/api/system.environment.getenvironmentvariable" target="_blank">`Environment.GetEnvironmentVariable` <span class="docon docon-navigate-external x-hidden-focus"></span></a>.
90+
91+
```csharp
92+
using static System.Environment;
93+
94+
class Program
95+
{
96+
static void Main()
97+
{
98+
// Get the named env var, and assign it to the value variable
99+
var value =
100+
GetEnvironmentVariable(
101+
"ENVIRONMENT_VARIABLE_KEY");
102+
}
103+
}
104+
```
105+
106+
# [C++](#tab/cpp)
107+
108+
For more information, see <a href="https://docs.microsoft.com/cpp/c-runtime-library/reference/getenv-wgetenv" target="_blank">`getenv` <span class="docon docon-navigate-external x-hidden-focus"></span></a>.
109+
110+
```cpp
111+
#include <stdlib.h>
112+
113+
int main()
114+
{
115+
// Get the named env var, and assign it to the value variable
116+
auto value =
117+
getenv("ENVIRONMENT_VARIABLE_KEY");
118+
}
119+
```
120+
121+
# [Java](#tab/java)
122+
123+
For more information, see <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#getenv(java.lang.String)" target="_blank">`System.getenv` <span class="docon docon-navigate-external x-hidden-focus"></span></a>.
124+
125+
```java
126+
import java.lang.*;
127+
128+
public class Program {
129+
public static void main(String[] args) throws Exception {
130+
// Get the named env var, and assign it to the value variable
131+
String value =
132+
System.getenv(
133+
"ENVIRONMENT_VARIABLE_KEY")
134+
}
135+
}
136+
```
137+
138+
# [Node.js](#tab/node-js)
139+
140+
For more information, see <a href="https://nodejs.org/api/process.html#process_process_env" target="_blank">`process.env` <span class="docon docon-navigate-external x-hidden-focus"></span></a>.
141+
142+
```javascript
143+
// Get the named env var, and assign it to the value variable
144+
const value =
145+
process.env.ENVIRONMENT_VARIABLE_KEY;
146+
```
147+
148+
# [Python](#tab/python)
149+
150+
For more information, see <a href="https://docs.python.org/2/library/os.html#os.environ" target="_blank">`os.environ` <span class="docon docon-navigate-external x-hidden-focus"></span></a>.
151+
152+
```python
153+
import os
154+
155+
# Get the named env var, and assign it to the value variable
156+
value = os.environ['ENVIRONMENT_VARIABLE_KEY']
157+
```
158+
159+
# [Objective-C](#tab/objective-c)
160+
161+
For more information, see <a href="https://developer.apple.com/documentation/foundation/nsprocessinfo/1417911-environment?language=objc" target="_blank">`environment` <span class="docon docon-navigate-external x-hidden-focus"></span></a>.
162+
163+
```objectivec
164+
// Get the named env var, and assign it to the value variable
165+
NSString* value =
166+
[[[NSProcessInfo processInfo]environment]objectForKey:@"ENVIRONMENT_VARIABLE_KEY"];
167+
```
168+
169+
---
170+
171+
## Next steps
172+
173+
* Explore the various [Cognitive Services](welcome.md)
174+
* Learn more about [Cognitive Services Virtual Networks](cognitive-services-virtual-networks.md)

articles/cognitive-services/index.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ metadata:
1212
author: nitinme
1313
ms.author: nitinme
1414
manager: nitinme
15-
ms.date: 01/21/2020
15+
ms.date: 03/17/2020
1616

1717
highlightedContent:
1818
# itemType: architecture | concept | deploy | download | get-started | how-to-guide | learn | overview | quickstart | reference | tutorial | whats-new
@@ -139,6 +139,29 @@ conceptualContent:
139139
itemType: reference
140140
text: Cognitive Services containers FAQ
141141

142+
tools:
143+
title: Software development kits (SDKs)
144+
summary: Get started with the Cognitive Services SDK in your favorite programming language.
145+
items:
146+
- title: C#
147+
imageSrc: https://docs.microsoft.com/media/logos/logo_Csharp.svg
148+
url: https://docs.microsoft.com/dotnet/api/overview/azure/cognitiveservices/client?view=azure-dotnet
149+
- title: Go
150+
imageSrc: https://docs.microsoft.com/media/logos/logo_Go-lightblue.svg
151+
url: https://godoc.org/github.com/Azure/azure-sdk-for-go/services/cognitiveservices
152+
- title: Java
153+
imageSrc: https://docs.microsoft.com/media/logos/logo_java.svg
154+
url: https://docs.microsoft.com/java/api/overview/azure/cognitiveservices/client?view=azure-java-stable
155+
- title: JavaScript
156+
imageSrc: https://docs.microsoft.com/media/logos/logo_js.svg
157+
url: https://docs.microsoft.com/javascript/api/overview/azure/cognitive-services?view=azure-node-latest
158+
- title: Python
159+
imageSrc: https://docs.microsoft.com/media/logos/logo_python.svg
160+
url: https://docs.microsoft.com/python/api/overview/azure/cognitive-services?view=azure-python
161+
- title: R
162+
imageSrc: https://docs.microsoft.com/media/logos/logo_R.svg
163+
url: https://github.com/Azure/AzureCognitive
164+
142165
additionalContent:
143166
sections:
144167
- items:
@@ -152,15 +175,3 @@ additionalContent:
152175
links:
153176
- text: Cognitive Services Management
154177
url: https://docs.microsoft.com/rest/api/cognitiveservices/
155-
- title: SDKs
156-
links:
157-
- text: .NET
158-
url: https://docs.microsoft.com/dotnet/api/overview/azure/cognitiveservices/client?view=azure-dotnet
159-
- text: Go
160-
url: https://godoc.org/github.com/Azure/azure-sdk-for-go/services/cognitiveservices
161-
- text: Java
162-
url: https://docs.microsoft.com/java/api/overview/azure/cognitiveservices/client?view=azure-java-stable
163-
- text: Node.js
164-
url: https://docs.microsoft.com/javascript/api/overview/azure/cognitive-services?view=azure-node-latest
165-
- text: Python
166-
url: https://docs.microsoft.com/python/api/overview/azure/cognitive-services?view=azure-python

0 commit comments

Comments
 (0)