Is there any way to fetch Subscription Keys for Microsoft Cognitive Services APIs through API call/CURL/HTTP request? Currently I have to hard code the keys in my Application to use the services.
1 Answer 1
Yes, you can do this. See the List Keys API at https://learn.microsoft.com/en-us/rest/api/cognitiveservices/cognitiveservicesaccounts#CognitiveServicesAccounts_ListKeys.
POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys?api-version=2016年02月01日-preview
Which returns JSON:
{ "key1": "xxxx", "key2": "xxxxx" }
You can also do this via Powershell using Get-AzureRmCognitiveServicesAccountKey
Both of these methods require you to authenticate with the Azure REST API which you can read more about at https://learn.microsoft.com/en-us/rest/api/.
Comments
Explore related questions
See similar questions with these tags.