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
Copy file name to clipboardExpand all lines: articles/ai-services/agents/how-to/tools/openapi-spec.md
+32-4Lines changed: 32 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,29 @@ automated, and scalable API integrations that enhance the capabilities and effic
27
27
describing HTTP APIs. This allows people to understand how an API works, how a sequence of APIs
28
28
work together, generate client code, create tests, apply design standards, and more. Currently, we support 3 authentication types with the OpenAPI 3.0 specified tools: `anonymous`, `API key`, `managed identity`.
29
29
30
-
## Set up
30
+
## Prerequisites
31
31
1. Ensure you've completed the prerequisites and setup steps in the [quickstart](../../quickstart.md).
32
32
33
-
1.[optional]If your OpenAPI spec requires API key, you can store your API key in a `custom keys` connection and use `connection` authentication
33
+
1. Check the OpenAPI spec for the following requirements:
34
+
1.`operationId` should only contain letters, `-` and `_`. You can modify it to meet the requirement. We recommend using descriptive name to help models efficiently decide which function to use.
35
+
36
+
## Authenticating with API Key
37
+
38
+
1. Verify that the OpenAPI spec supports API keys: it has `securitySchemes` section and has one scheme of type `apiKey". An example would be:
39
+
```json
40
+
"securitySchemes": {
41
+
"apiKeyHeader": {
42
+
"type": "apiKey",
43
+
"name": "x-api-key",
44
+
"in": "header"
45
+
}
46
+
}
47
+
```
48
+
If the security schemes include multiple schemes, we recommend keeping only one of them.
49
+
50
+
1. Remove any parameter in the OpenAPI spec that needs API key, because API key will be stored and passed through a connection, as described later in this article.
51
+
52
+
1. Create a `custom keys` connection to store your API key.
34
53
35
54
1. Go to the [Azure AI Foundry portal](https://ai.azure.com/) and select the AI Project. Click **connected resources**.
36
55
:::image type="content" source="../../media/tools/bing/project-settings-button.png" alt-text="A screenshot of the settings button for an AI project." lightbox="../../media/tools/bing/project-settings-button.png":::
@@ -46,9 +65,18 @@ work together, generate client code, create tests, apply design standards, and m
46
65
:::image type="content" source="../../media/tools/bing/api-key-connection.png" alt-text="A screenshot of the custom keys selection for the AI project." lightbox="../../media/tools/bing/api-key-connection.png":::
47
66
48
67
1. Enter the following information
49
-
-`key`: "key"
68
+
- key: `name` of your security scheme. In this example, it should be `x-api-key`
69
+
```json
70
+
"securitySchemes": {
71
+
"apiKeyHeader": {
72
+
"type": "apiKey",
73
+
"name": "x-api-key",
74
+
"in": "header"
75
+
}
76
+
}
77
+
```
50
78
- value: YOUR_API_KEY
51
-
- Connection name: `YOUR_CONNECTION_NAME` (You will use this connection name in the sample code below.)
79
+
- Connection name: YOUR_CONNECTION_NAME (You will use this connection name in the sample code below.)
52
80
- Access: you can choose either *this project only* or *shared to all projects*. Just make sure in the sample code below, the project you entered connection string for has access to this connection.
0 commit comments