Skip to content

Commit 1af9149

Browse files
Merge pull request #2080 from lindazqli/patch-21
update openapi spec instructions
2 parents 0ee5530 + 36fa452 commit 1af9149

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

articles/ai-services/agents/how-to/tools/openapi-spec.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,29 @@ automated, and scalable API integrations that enhance the capabilities and effic
2727
describing HTTP APIs. This allows people to understand how an API works, how a sequence of APIs
2828
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`.
2929

30-
## Set up
30+
## Prerequisites
3131
1. Ensure you've completed the prerequisites and setup steps in the [quickstart](../../quickstart.md).
3232

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.
3453

3554
1. Go to the [Azure AI Foundry portal](https://ai.azure.com/) and select the AI Project. Click **connected resources**.
3655
:::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
4665
:::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":::
4766

4867
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+
```
5078
- 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.)
5280
- 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.
5381

5482
::: zone-end

0 commit comments

Comments
 (0)