You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the recommended keyless authentication with Microsoft Entra ID, you need to:
14
+
- Install the [Azure CLI](/cli/azure/install-azure-cli) used for keyless authentication with Microsoft Entra ID.
15
+
- Assign the `Cognitive Services User` role to your user account. You can assign roles in the Azure portal under **Access control (IAM)** > **Add role assignment**.
16
+
17
+
## Set up
18
+
19
+
1. Create a new folder `dall-e-quickstart` and go to the quickstart folder with the following command:
20
+
21
+
```shell
22
+
mkdir dall-e-quickstart && cd dall-e-quickstart
23
+
```
24
+
25
+
1. For the **recommended** keyless authentication with Microsoft Entra ID, sign in to Azure with the following command:
26
+
27
+
```console
28
+
az login
29
+
```
30
+
11
31
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
12
32
13
-
## Create a Go environment
33
+
## Run the quickstart
14
34
15
-
1. Create a new folder named *openai-go*for your project and a new Go code file named *sample.go*. Change into that directory:
35
+
The sample code in this quickstart uses Microsoft Entra ID for the recommended keyless authentication. If you prefer to use an API key, you can replace the `NewDefaultAzureCredential` implementation with `NewKeyCredential`.
// This allows Azure OpenAI to use an Azure AI Search index.
76
-
//
77
-
// > Because the model has access to, and can reference specific sources to support its responses, answers are not only based on its pretrained knowledge
78
-
// > but also on the latest information available in the designated data source. This grounding data also helps the model avoid generating responses
79
-
// > based on outdated or incorrect information.
80
-
//
81
-
// Quote from here: https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/use-your-data
210
+
// Answers are based on the model's pretrained knowledge
211
+
// and the latest information available in the designated data source.
> 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.
241
+
1. Run the following command to create a new Go module:
112
242
243
+
```shell
244
+
go mod init quickstart.go
245
+
```
113
246
114
-
1.Now open a command prompt and run the following:
247
+
1.Run `go mod tidy` to install the required dependencies:
115
248
116
-
```cmd
117
-
go mod init sample.go
118
-
```
119
-
120
-
1. Next run:
121
249
```cmd
122
250
go mod tidy
123
-
go run sample.go
124
251
```
125
252
126
-
The application prints the response including both answers to your query and citations from your uploaded files.
253
+
1. Run the following command to run the sample:
254
+
255
+
```shell
256
+
go run quickstart.go
257
+
```
258
+
259
+
---
260
+
261
+
The application prints the response including both answers to your query and citations from your uploaded files.
0 commit comments