Skip to content

Commit 785f593

Browse files
authored
Merge pull request #4 from aahill/openapi-spec
edits to openAPI doc
2 parents 7759726 + 861b2e8 commit 785f593

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed

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

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: cognitive-services
66
manager: nitinme
77
ms.service: azure-ai-agent-service
88
ms.topic: how-to
9-
ms.date: 12/16/2024
9+
ms.date: 03/12/2025
1010
author: aahill
1111
ms.author: aahi
1212
zone_pivot_groups: selection-function-calling
@@ -25,7 +25,7 @@ OpenAPI Specified tool improves your function calling experience by providing st
2525
automated, and scalable API integrations that enhance the capabilities and efficiency of your agent.
2626
[OpenAPI specifications](https://spec.openapis.org/oas/latest.html) provide a formal standard for
2727
describing HTTP APIs. This allows people to understand how an API works, how a sequence of APIs
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`.
28+
work together, generate client code, create tests, apply design standards, and more. Currently, we support three authentication types with the OpenAPI 3.0 specified tools: `anonymous`, `API key`, `managed identity`.
2929

3030
### Usage support
3131

@@ -41,27 +41,29 @@ work together, generate client code, create tests, apply design standards, and m
4141

4242
## Authenticating with API Key
4343

44-
With API key authentication type, you can authenticate your OpenAPI spec with various methods such as API key, Bearer token. Please note only one API key security schema is supported per OpenAPI spec. If you need multiple security schemas, please create multiple OpenAPI spec tools.
44+
With API key authentication, you can authenticate your OpenAPI spec using various methods such as an API key or Bearer token. Only one API key security schema is supported per OpenAPI spec. If you need multiple security schemas, create multiple OpenAPI spec tools.
45+
46+
1. Update your OpenAPI spec security schemas. it has a `securitySchemes` section and one scheme of type `apiKey`. For example:
4547

46-
1. Update your OpenAPI spec security schemes: it has `securitySchemes` section and has one scheme of type `apiKey`. For example:
4748
```json
48-
"securitySchemes": {
49-
"apiKeyHeader": {
50-
"type": "apiKey",
51-
"name": "x-api-key",
52-
"in": "header"
53-
}
54-
}
49+
"securitySchemes": {
50+
"apiKeyHeader": {
51+
"type": "apiKey",
52+
"name": "x-api-key",
53+
"in": "header"
54+
}
55+
}
5556
```
57+
5658
You usually only need to update the `name` field, which corresponds to the name of `key` in the connection. If the security schemes include multiple schemes, we recommend keeping only one of them.
5759

58-
1. Update your OpenAPI spec to include `security` section:
60+
1. Update your OpenAPI spec to include a `security` section:
5961
```json
6062
"security": [
61-
{
62-
"apiKeyHeader": []
63-
}
64-
]
63+
{
64+
"apiKeyHeader": []
65+
}
66+
]
6567
```
6668

6769
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.
@@ -96,31 +98,37 @@ With API key authentication type, you can authenticate your OpenAPI spec with va
9698
- Connection name: YOUR_CONNECTION_NAME (You will use this connection name in the sample code below.)
9799
- 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.
98100

99-
1. Once you have created a connection, you can use it through SDK or REST API. Please use the tabs above to navigate to your preferred ways of usage.
101+
1. Once you have created a connection, you can use it through the SDK or REST API. Use the tabs at the top of this article to see code examples.
100102

101-
## Authenticating with Managed Identity (Microsoft Entra ID)
102-
[Managed Identity (Microsoft Entra ID)](https://learn.microsoft.com/en-us/entra/fundamentals/whatis) is a cloud-based identity and access management service that your employees can use to access external resources. Microsoft Entra ID allows you to authenticate your APIs with additional security without the need to pass in API keys. Once you have set up Managed Identity authentication, it will authenticate through the Azure AI Service your agent is using.
103+
## Authenticating with managed identity (Microsoft Entra ID)
104+
105+
[Microsoft Entra ID](/entra/fundamentals/whatis) is a cloud-based identity and access management service that your employees can use to access external resources. Microsoft Entra ID allows you to authenticate your APIs with additional security without the need to pass in API keys. Once you have set up managed identity authentication, it will authenticate through the Azure AI Service your agent is using.
103106

104107
To set up authenticating with Managed Identity:
108+
105109
1. Enable the Azure AI Service of your agent has `system assigned managed identity` enabled.
106-
![image](https://github.com/user-attachments/assets/55e3125c-ca97-43e7-80ef-d8f3cc005fe4)
107110

108-
1. Create a resource of the service you want to connect to through OpenAPI spec
111+
:::image type="content" source="../../media/tools/managed-identity-portal.png" alt-text="A screenshot showing the managed identity selector in the Azure portal." lightbox="../../media/tools/managed-identity-portal.png":::
112+
113+
1. Create a resource of the service you want to connect to through OpenAPI spec.
109114

110-
1. Assign Azure AI Service proper access to the resource
111-
1. Click "Access Control" of your resource
115+
1. Assign proper access to the resource.
116+
1. Click **Access Control** for your resource
112117

113-
1. Click "Add" and then "add role assignement" on the top
118+
1. Click **Add** and then **add role assignment** at the top of the screen.
119+
120+
:::image type="content" source="../../media/tools/role-assignment-portal.png" alt-text="A screenshot showing the role assignment selector in the Azure portal." lightbox="../../media/tools/role-assignment-portal.png":::
121+
122+
1. Select the proper role assignment needed, usually it will require at least *READER* role. Then click **Next**.
114123

115-
1. Select the proper role assignment needed, usually it will require at least READER role. Then click "Next"
124+
1. Select **Managed identity** and then click **select members**.
116125

117-
1. Select "Managed identity" and then click "select members"
126+
1. In the managed identity dropdown menu, search for **Azure AI services** and then select the AI Service of your agent.
118127

119-
1. In the Managed Identity dropdown, search for "Azure AI services" and then select the AI Service of your agent.
128+
1. Click **Finish**.
120129

121-
1. Click "Finish"
130+
1. Once the setup is done, you can continue by using the tool through the SDK or REST API. Use the tabs at the top of this article to see code samples.
122131

123-
1. Once you have it set up, you can use continue creating the tool through SDK or REST API. Please use the tabs above to navigate to your preferred ways of usage.
124132
::: zone-end
125133

126134

71.7 KB
Loading
107 KB
Loading

0 commit comments

Comments
 (0)