How to enable/disable local authentication (access keys) on Azure Cognitive Services resources

The Azure Portal doesn’t provide a way to toggle the use of access keys for the various Azure Cognitive Services (such as Document Intelligence). Instead, you have to do this via the command line (assuming you don’t already have other Infrastructure as Code (such as Bicep or Terraform) configuring these services.

You can toggle the access key using the following Azure CLI command (using the az rest command).

az rest --method patch --url https://management.azure.com/subscriptions/0ec6c427-1234-5678-9012-fd9656157157/resourceGroups/rg-azure-search-openai-demo/providers/Microsoft.CognitiveServices/accounts/cog-di-jtqxnsnapxria?api-version=2024-10-01 --body "{'properties': {'disableLocalAuth': 'false'}}"

You will need to provide the resource ID of the service and then specify if you want to enable or disable local authentication (which is what access keys map to).

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *