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 <catalinaperaltah@hotmail.com>

* remove suppression

* update spec after merge

---------

Co-authored-by: koen-mertens <138520871+koen-mertens@users.noreply.github.com>
Co-authored-by: catalinaperalta <catalinaperaltah@hotmail.com>
  • Loading branch information
3 people authored and Francisco-Gamino committed Jun 5, 2024
1 parent bcba767 commit 9be9d89
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 9be9d89

Please sign in to comment.