how do i secure my Azure AI Foundry deployed models.

Sen0299 120 Reputation points
2026-07-02T10:10:45.08+00:00

Hi,

how do i secure my Azure AI Foundry deployed models. I use AI models via API access. I would like it to be secure with available options. I mean can you guide on both free option, its limitation and paid options as well

Foundry Models
Foundry Models

A catalog of AI models in Microsoft Foundry that you can discover, compare, and deploy using Azure’s built‑in tools for evaluation, fine‑tuning, and inference


Answer accepted by question author
Karnam Venkata Rajeswari 5,255 Reputation points Microsoft External Staff Moderator
2026-07-09T05:20:21.6666667+00:00

Hello @Sen0299 ,

Thank you for your patience while we were working on this

Please check if the following response helps-

API keys can be regenerated without deleting or recreating the Azure AI Foundry resource or the deployed model endpoint. The endpoint URL remains unchanged throughout the process, and only the selected API key is replaced. Azure AI resources provide two API keys (Key 1 and Key 2) specifically to support secure key rotation with minimal or no service interruption.

If the Regenerate option is not visible, it is important to note that API key management is performed on the underlying Azure AI Services or Azure OpenAI resource that backs the Azure AI Foundry project. In many scenarios, the Azure AI Foundry portal allows viewing or copying the endpoint and existing API key, while key regeneration is managed from the associated Azure resource in the Azure portal.

Please follow the below steps to regenerate an API key

  1. Sign in to the Azure portal.
  2. Open the Azure AI Services or Azure OpenAI resource associated with the Azure AI Foundry project.
  3. Navigate to Resource Management > Keys and Endpoint.
  4. Locate Key 1 and Key 2.
  5. Select Regenerate for the key that needs to be rotated.

The deployment, endpoint, and model remain available throughout this process. Only the selected API key changes.

To help avoid service interruptions during key rotation, the following approach is recommended:

  • Ensure applications are currently using Key 1.
  • Regenerate Key 2.
  • Update applications to use the newly generated Key 2.
  • Verify that authentication is successful and all traffic is using the new key.
  • Regenerate Key 1 after confirming the transition.
  • Continue alternating between the two keys during future rotations.

Please note that once an API key is regenerated, the previous key value becomes invalid immediately. Any applications still using the old key will receive authentication failures (typically HTTP 401 Unauthorized). Rotating one key at a time helps minimize the risk of downtime.

For environments that require automated key management, API keys can also be regenerated by using:

  • Azure CLI
  • Azure PowerShell
  • Azure Resource Manager (ARM) REST APIs

It is also worth noting that Azure AI resource API keys do not have a built-in expiration date. As a security best practice, consider:

  • Using Microsoft Entra ID authentication where supported.
  • Using Managed Identity for Azure-hosted applications.
  • Applying Azure RBAC with least-privilege permissions.
  • Storing API keys securely in Azure Key Vault.
  • Implementing a regular key rotation process.

These practices help reduce reliance on long-lived shared secrets while strengthening the overall security posture.

If the Regenerate option is still not available after following the above steps, the following checks may help identify the cause:

  • Confirm that the Azure portal is being used, as API key regeneration is managed on the underlying Azure AI resource rather than the model deployment page in Azure AI Foundry.
  • Verify that the correct Azure AI Services or Azure OpenAI resource is selected.
  • Confirm that the signed-in account has sufficient Azure RBAC permissions to view and regenerate resource keys.
  • Determine whether authentication is configured to use API keys or Microsoft Entra ID, as environments using identity-based authentication may rely less on API key management.

The following references might be helpful , please check them out

Please let us know if the response was helpful

 

Thank you

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author
Karnam Venkata Rajeswari 5,255 Reputation points Microsoft External Staff Moderator
2026-07-02T10:29:55.6966667+00:00

Hello @Sen0299 ,

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

Securing Azure AI Foundry deployed models accessed through APIs is best handled through a layered approach. The most effective path is to begin with identity and access controls, then add network protection, monitoring, content safety and API governance based on workload sensitivity and production requirements.

Following are the suggested approaches-

  1. Strengthening authentication and access control The first layer is to control which identities can access the model endpoint. Recommended actions:
    1. Use Entra ID authentication and Managed Identity wherever supported, instead of relying only on API keys.
    2. Apply least-privilege RBAC, granting only the permissions required for inference or resource access.
    3. Avoid broad roles such as Owner or Contributor unless administration access is required.
    4. If API keys are still required:
      • Store them securely in Azure Key Vault.
      • Rotate keys regularly.
      • Avoid placing keys in source code, client-side applications, configuration files, or logs.
      This reduces the risk of leaked credentials, but it is still important to note that RBAC and identity controls restrict access; they do not fully prevent misuse by an already-authorized caller.
  2. Restricting network exposure After access control, the next layer is limiting where API calls can originate. Recommended actions:
    1. Replace All networks access with Selected Networks/IP allow lists where possible.
    2. For production or sensitive workloads, configure Private Endpoint / Private Link.
    3. Disable public network access when private access is required.
    4. Validate DNS and connectivity after Private Endpoint configuration.
    Selected Networks helps reduce exposure, but the public endpoint may still exist. Private Endpoint provides stronger isolation, although it adds networking, DNS, and cost considerations.
  3. Adding content safety and abuse protection For applications accepting user-generated prompts, content and abuse controls should be included. Recommended actions:
    1. Use the default content filtering available for Azure OpenAI deployments.
    2. Add Azure AI Content Safety for stronger input/output protection.
    3. Consider Prompt Shields, jailbreak detection, and custom blocklists for public-facing or high-risk applications.
    These controls help reduce harmful content, prompt injection, and abuse risks.
  4. Using API governance for production scenarios For multiple applications, teams, or consumers, placing Azure API Management AI Gateway in front of model endpoints is recommended. This provides:
    • Centralized authentication
    • Rate limiting
    • Token quotas
    • Traffic throttling
    • Policy enforcement
    • Usage monitoring
    • Cost control
    • Optional prompt and completion logging
    This is especially useful for preventing one application or user from consuming excessive quota or causing unexpected cost increases.

As for included vs additional-cost options

The following references might be helpful , please check them out

  1. Included / foundational controls
    1. Entra ID authentication
    2. Managed Identity
    3. RBAC
    4. Selected Networks/IP restrictions
    5. Azure Monitor metrics
    6. Default content filtering for Azure OpenAI deployments
  2. Additional-cost / advanced controls
    1. Private Endpoint / Private Link
    2. Azure API Management AI Gateway
    3. Azure AI Content Safety advanced usage
    4. Log Analytics ingestion
    5. Defender for Cloud AI threat protection
    6. Azure Key Vault usage and transactions

For token usage and prompt/response visibility

Azure Monitor can show operational and token metrics such as:

  • Processed Prompt Tokens
  • Generated Completion Tokens
  • Processed Inference Tokens
  • Request volume
  • Latency
  • Availability

These metrics help with usage tracking and consumption analysis.

However, Azure AI Foundry deployment metrics do not automatically provide a built-in portal view of every historical prompt and completion sent through a resource API key. Metrics show usage and performance data, not full request and response bodies by default

If actual prompt and response text must be captured for auditing or troubleshooting, practical options include:

  1. Implement application-level logging before and after model calls, with sensitive data redaction.
  2. Route calls through Azure API Management AI Gateway and enable LLM logging to capture prompts, completions, model details, and token usage.
  3. For supported agent scenarios, enable Foundry Tracing to capture prompt content, conversation history, inputs, outputs, token details, and tool activity Detailed prompt and response logging may contain sensitive information, so access control, retention, redaction, and compliance review should be applied before enabling it

As a data privacy note,for models sold by Azure in Azure AI Foundry, prompts, completions, embeddings, and training data are not available to other customers, are not available to OpenAI or other model providers, and are not used to train foundation models without permission or instruction.

These are the suggested Implementation steps in order

  1. Configure Entra ID / Managed Identity.
  2. Apply least-privilege RBAC.
  3. Restrict access using Selected Networks/IP allow lists.
  4. Enable Azure Monitor metrics.
  5. Add Content Safety controls where applicable.
  6. Configure Private Endpoint and disable public access for sensitive workloads.
  7. Place Azure API Management AI Gateway in front of the model endpoint.
  8. Add Defender for Cloud and advanced monitoring where required.

With these controls in place, the model deployment can be secured at the identity, network, monitoring, governance and data-protection layers while still allowing the required API-based access.

The following references might be helpful , please check them out

Please let us know if the response was helpful

 

Thank you

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Newest
  1. Sen0299 120 Reputation points
    2026-07-02T10:53:48.7333333+00:00

    Hi, Thanks for the detailed response it was helpful. In the Azure foundry is there any way to regenerate the API key without deleting the resource and recreating the end point ? I'am unable to find this functionality. Please guide.

    Was this answer helpful?

    1 person found this answer helpful.
    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.