Error when connection to Azure OpenAI ""AuthenticationtypeDisable" message "Key based authentication is disable for this resource"."

System Administrator 0 Reputation points
2025-12-31T04:43:44.2566667+00:00

I am connecting to Azure OpenAI but suddently from Dec 30, it shows the error "AuthenticationtypeDisable" message "Key based authentication is disable for this resource".
When checking Microsoft Foundry**| Azure OpenAI,** I noticed "API key authentication is disabled"
But can't enable it again.
Please help to suggest how we can fix it.
My connection like this:
const endpoint =

"https://admin-m99nsvyo-eastus2.cognitiveservices.azure.com/openai/.....................";

const apiKey = "..........................................";

User's image

User's image

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
{count} votes

1 answer

Sort by: Most helpful
  1. SRILAKSHMI C 12,905 Reputation points Microsoft External Staff Moderator
    2025-12-31T08:41:45.9433333+00:00

    Hello System Administrator,

    Welcome to Microsoft Q&A and Thank you for reaching out.

    This behavior is expected and due to a security configuration change, not a service outage or SDK issue.

    What is happening

    Your Azure OpenAI resource now has API key authentication disabled, which is why requests using apiKey are failing with:

    AuthenticationTypeDisabled – Key based authentication is disabled for this resource

    When this setting is disabled, all API key–based requests are rejected, even if the key itself is valid. This commonly happens when the resource is configured to use Microsoft Entra ID (Azure AD) authentication only, which is now the recommended and more secure approach.

    Why you can’t re-enable API keys

    If the “API key authentication is disabled” toggle cannot be turned back on in Azure AI Foundry or the Azure portal, it usually means one of the following applies:

    An Azure Policy enforces keyless (Entra ID–only) authentication

    The resource was created or migrated with AAD-only authentication enforced

    You don’t have Owner-level permissions to override the policy

    In these cases, the portal intentionally prevents re-enabling API keys.

    Recommended fix: switch to keyless (Entra ID) authentication

    Since key-based auth is disabled, you should update your application to use Microsoft Entra ID authentication.

    Steps:

    Assign the appropriate role (for example, Cognitive Services OpenAI User) to your identity on the Azure OpenAI resource.

    Use an Azure Identity credential (Managed Identity or Service Principal).

    Authenticate using the scope:

    https://cognitiveservices.azure.com/.default
    

    JavaScript example:

    const { DefaultAzureCredential } = require("@azure/identity");
    const { OpenAIClient } = require("@azure/openai");
    
    const endpoint = "https://<your-resource-name>.cognitiveservices.azure.com/";
    const credential = new DefaultAzureCredential();
    
    const client = new OpenAIClient(endpoint, credential);
    

    This approach works both locally (via Azure CLI login or service principal) and in Azure-hosted environments (via Managed Identity).

    Also check

    Ensure your user or managed identity has access to the Azure OpenAI resource.

    Make sure you are using the correct Azure OpenAI endpoint.

    If you must use API keys, check whether a subscription-level policy is enforcing keyless authentication (this requires Owner access to change or exempt).

    Please refer this Use Azure OpenAI without keys

    I Hope this helps. Do let me know if you have any further queries.

    Thank you!

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.