From cd47418616e7308f2aa1797a6b2bd3750dc8f8a6 Mon Sep 17 00:00:00 2001 From: Asaf Levi <100200009+asaflevi-ms@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:28:33 +0300 Subject: [PATCH] Add Entra ID OAuthe2 token support (#29032) * Add AAD OAuthe2 token support * EntraIdToken * Update specification/ai/HealthInsights/HealthInsights.OpenAPI/service.tsp Co-authored-by: catalinaperalta * remove suppression * update spec after merge --------- Co-authored-by: koen-mertens <138520871+koen-mertens@users.noreply.github.com> Co-authored-by: catalinaperalta --- .../HealthInsights.OpenAPI/service.tsp | 7 ++++++- .../HealthInsights/stable/2024-04-01/openapi.json | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/specification/ai/HealthInsights/HealthInsights.OpenAPI/service.tsp b/specification/ai/HealthInsights/HealthInsights.OpenAPI/service.tsp index d58ea4d9417c..69e543791ba8 100644 --- a/specification/ai/HealthInsights/HealthInsights.OpenAPI/service.tsp +++ b/specification/ai/HealthInsights/HealthInsights.OpenAPI/service.tsp @@ -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; +@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", diff --git a/specification/ai/data-plane/HealthInsights/stable/2024-04-01/openapi.json b/specification/ai/data-plane/HealthInsights/stable/2024-04-01/openapi.json index 517353153cee..9e49f8375fbd 100644 --- a/specification/ai/data-plane/HealthInsights/stable/2024-04-01/openapi.json +++ b/specification/ai/data-plane/HealthInsights/stable/2024-04-01/openapi.json @@ -37,6 +37,11 @@ "security": [ { "AzureKey": [] + }, + { + "EntraIdToken": [ + "https://cognitiveservices.azure.com/.default" + ] } ], "securityDefinitions": { @@ -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": [