Skip to content

Commit

Permalink
Add Entra ID OAuthe2 token support (Azure#29032)
Browse files Browse the repository at this point in the history
* Add AAD OAuthe2 token support

* EntraIdToken

* Update specification/ai/HealthInsights/HealthInsights.OpenAPI/service.tsp

Co-authored-by: catalinaperalta <[email protected]>

* remove suppression

* update spec after merge

---------

Co-authored-by: koen-mertens <[email protected]>
Co-authored-by: catalinaperalta <[email protected]>
  • Loading branch information
3 people authored Jun 3, 2024
1 parent 92a02c9 commit cd47418
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ using TypeSpec.Versioning;
endpoint: url,
}
)
@useAuth(AzureKey)
@useAuth(AzureKey | EntraIdToken)
namespace AzureHealthInsights;

@doc("The secret key for your Azure Cognitive Services subscription.")
model AzureKey
is ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key">;

@doc("The Microsoft Entra Id Flow")
model EntraIdToken
is Azure.Core.AadOauth2Auth<["https://cognitiveservices.azure.com/.default"]>;

#suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107"
enum ApiVersion {
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
v2024_04_01: "2024-04-01",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
"security": [
{
"AzureKey": []
},
{
"EntraIdToken": [
"https://cognitiveservices.azure.com/.default"
]
}
],
"securityDefinitions": {
Expand All @@ -45,6 +50,16 @@
"description": "The secret key for your Azure Cognitive Services subscription.",
"name": "Ocp-Apim-Subscription-Key",
"in": "header"
},
"EntraIdToken": {
"type": "oauth2",
"description": "The Microsoft Entra Id Flow",
"flow": "accessCode",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"scopes": {
"https://cognitiveservices.azure.com/.default": ""
},
"tokenUrl": "https://login.microsoftonline.com/common/oauth2/token"
}
},
"tags": [
Expand Down

0 comments on commit cd47418

Please sign in to comment.