Courseiva
AI-102Chapter 2 of 16Objective 1.2

Managing Azure AI Resources and Security

Managing Azure AI resources and security means controlling who can use your AI services, how they use them, and keeping everything safe from unauthorised access. For the AI-102 exam, you must understand how to create AI resources, protect them with keys and tokens, and set permissions so the right people and applications have the right level of access. This chapter gives you the foundational knowledge to handle that responsibility.

12 min read
Intermediate
Updated Jul 24, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Managing Azure AI Resources and Security

The Apartment Building Security Desk Analogy

A secure apartment building's front desk is the central hub for managing access and resources. The building has many units (AI services) like a gym, a laundry room, and a rooftop lounge. Each resident (an application or user) needs a specific key card (an API key) to enter the building. The security guard at the front desk is like Azure's resource management layer. They do not let anyone just walk in; every resident must show their key card at the entrance. The guard also keeps a log of who enters and leaves, which is like Azure Monitor logging every API call. The building manager (an Azure administrator) sets the rules for which key cards work on which doors. For example, a cleaner might only have access to the laundry room and hallways, not the rooftop lounge. This is exactly how Azure Role-Based Access Control (RBAC) works: you assign the right permissions (the right key) to the right person or app. If a resident loses their key card, the manager deactivates it immediately and issues a new one. In Azure, if a key is compromised, you regenerate it in the Azure Portal, instantly blocking the old one. The entire system runs on trust: you trust the building's management to keep the rules up to date and the logs secure. This daily scenario of managing physical keys and access in a building maps precisely to managing digital keys, permissions, and security for AI resources in Azure.

How It Actually Works

When you use any Azure AI service, such as Azure OpenAI Service or Azure AI Search, you are essentially renting computing power and intelligence from Microsoft. You must manage the 'who' and 'how' of access to these rented resources. This whole area is called 'Managing Azure AI Resources and Security'.

First, let us define the core term: an Azure AI Resource. This is a specific instance of a service you create in your Azure subscription. For example, you might create a 'Cognitive Services' resource to get access to language understanding APIs. Each resource lives in a 'Resource Group', which is like a folder that holds all the related parts of a project.

Every Azure AI resource comes with two types of authentication: Key-Based and Microsoft Entra ID (formerly Azure Active Directory). - Key-Based Authentication: When you create an AI resource, Azure generates two secret keys (like two passwords). Your application sends one of these keys in every request to prove it is allowed to use the service. These keys are simple but risky because if someone steals a key, they can use your service until you regenerate it. - Microsoft Entra ID Authentication: This is the modern, more secure method. Instead of a static key, your application requests a temporary token from Microsoft Entra ID (the identity service). This token is valid for a short time (e.g., one hour) and is unique to your app. It is like getting a visitor pass at the apartment building that expires after your meeting.

Azure Role-Based Access Control (RBAC) is the system for setting fine-grained permissions. You assign 'roles' to users, groups, or applications. For AI resources, a common role is 'Cognitive Services Contributor', which lets someone create and manage resources but not access the data. Another role is 'Cognitive Services User', which lets them call the APIs but not change the underlying resource. This separation means a developer can use the AI model (User role) without being able to accidentally delete the resource (Contributor role).

Azure Policy is another security tool. It is a rule that enforces how resources can be created and used. For example, you could create a policy that forces all AI resources to be in a specific region (like West Europe) or to always have encryption enabled. This prevents mistakes and ensures compliance with company rules.

Network security is also crucial. You can restrict access to your AI resource so only requests from a specific Virtual Network or IP address range are allowed. This is called a 'Private Endpoint'. It makes your AI resource invisible to the public internet, like a secret entrance to a building that only specific people know about.

Finally, monitoring and logging. Azure Monitor collects data on every request to your AI resource, including who made the call, from where, and what the result was. Diagnostic settings let you send these logs to storage, a log analytics workspace, or an event hub for analysis. This helps detect unusual activity, like a sudden spike in requests from a foreign IP address, which might indicate a key being used maliciously.

In short, managing Azure AI resources is about controlling creation (using Resource Groups and Policies), controlling access (using Keys, Microsoft Entra ID, and RBAC), protecting the network (using Private Endpoints), and watching for problems (using Monitor and Logs). The AI-102 exam tests your knowledge of each of these components.

This diagram shows the main components of managing an Azure AI resource: authentication, network security, RBAC, policy, and monitoring.

Walk-Through

1

Create a Resource Group

You first create a Resource Group in a specific Azure region (e.g., 'West Europe'). This acts as a container for all AI resources belonging to one project. It helps organise resources, manage billing, and apply policies at the group level.

2

Create the AI Resource

Inside the Resource Group, you create the specific AI service (e.g., 'Cognitive Services' or 'Azure OpenAI'). You choose a globally unique name, a pricing tier, and the same region. Azure generates two API keys automatically for the resource.

3

Configure Authentication Method

You decide whether the application will use API keys or Microsoft Entra ID authentication. For production apps, you set up a managed identity and grant it the appropriate RBAC role (e.g., 'Cognitive Services User'). This step eliminates the need to store keys.

4

Set Up Network Security

You configure network access. For the highest security, you create a Private Endpoint linked to your Virtual Network. Alternatively, you can set IP firewall rules to allow only specific public IP addresses. This step ensures only trusted networks can reach your resource.

5

Apply Azure Policies for Compliance

You create or assign an Azure Policy that enforces rules like 'AI resources must have encryption enabled' or 'must be in West Europe'. This prevents unauthorised or non-compliant resource creation. The policy is applied at the Resource Group or Subscription level.

6

Enable Monitoring and Logging

You enable Diagnostic Settings on the AI resource to send metrics and logs to a Log Analytics workspace. You set up alerts for unusual activity (e.g., high request volumes). This step provides visibility and helps detect security incidents.

7

Rotate Keys and Review Access Regularly

If using keys, you regenerate them on a schedule (e.g., every 90 days) using the Azure Portal or CLI. You also periodically review the 'Access control (IAM)' blade to remove unused or excessive RBAC assignments. This ongoing step maintains security over time.

What This Looks Like on the Job

Consider a healthcare company, 'MediChain', that builds an application to help doctors answer clinical questions. They use Azure OpenAI Service to power a chatbot. The IT team must secure this resource because the chatbot handles sensitive patient data.

Step one: The lead architect creates an Azure Resource Group called 'rg-medichain-openai' in the West Europe region. She creates an Azure OpenAI resource inside this group. She immediately checks the 'Keys and Endpoint' blade in the Azure Portal and copies the first key into a secure key vault (Azure Key Vault). She never puts the key directly in the application code.

Step two: She configures authentication. She decides to use Microsoft Entra ID authentication instead of keys for the application. She registers the chatbot application in Microsoft Entra ID and gives it a 'managed identity' (a secure, automated identity for the app). She then grants that managed identity the 'Cognitive Services OpenAI User' role on the Azure OpenAI resource. Now the app can get a token automatically without any hardcoded keys.

Step three: Network security. The chatbot must only be accessed from within MediChain's corporate network. So, she enables the 'Private Endpoint' feature for the Azure OpenAI resource. This creates a private IP address inside MediChain's Virtual Network. Now no one on the public internet can even see the OpenAI resource, let alone call it.

Step four: She applies an Azure Policy that forces all AI resources in the company to have a specific tag 'Environment: Production' and must be in West Europe. This prevents developers from accidentally creating resources in other, less secure regions.

Step five: Monitoring. She enables diagnostic settings to send all logs to Azure Log Analytics. She sets up an alert rule that fires if more than 1000 requests come from a single IP address in one hour, which could indicate an attack. She also sets up a monthly review of who has RBAC roles on the resource, using the 'Access control (IAM)' blade in the Azure Portal.

What does the IT professional actually do day-to-day? They check logs for errors, regenerate keys if an employee leaves the company, review alert rules, and update Azure Policies as new compliance requirements come in. They also use the Azure CLI or PowerShell to automate these tasks, for example running a script that rotates all keys every 90 days. This real-world scenario shows that managing AI resources is a continuous cycle of applying security best practices, monitoring, and adjusting.

How AI-102 Actually Tests This

The AI-102 exam tests 'Manage Azure AI resources, security, and governance' in about 15-20% of the total questions. You will see multiple-choice and case study questions. Here is what they specifically test.

First, they love to test the difference between 'Key-based authentication' and 'Microsoft Entra ID authentication'. A typical trap question describes a scenario: 'Your application must use temporary tokens that expire. Which authentication method should you use?' The correct answer is Microsoft Entra ID. The trap is a distractor that says 'Use keys and regenerate them frequently' — that is not a built-in feature of keys, you must write custom code to do that.

Second, they test 'Role-Based Access Control (RBAC)'. You must memorise the most common built-in roles for AI services:

Cognitive Services Contributor: Full access to create, read, update, delete the resource. Cannot call APIs.

Cognitive Services User: Can call APIs but cannot change the resource.

Cognitive Services OpenAI Contributor: For Azure OpenAI resources specific roles.

Question pattern: 'A developer needs to call the Azure AI Translate API but should not be able to delete the resource. Which role should you assign?' Answer: Cognitive Services User.

Third, they test 'Azure Policy'. They will ask: 'You need to ensure all Cognitive Services resources are created in a specific region. What should you create?' Answer: An Azure Policy with a 'location' condition.

Fourth, they test 'Network Security'. They focus on: - 'Private Endpoint': Used to make the resource accessible only from a Virtual Network. - 'Firewall rules' / IP restrictions: Used to allow only specific public IP addresses.

Trap: They might say 'Enable a Service Endpoint' — a Service Endpoint is different (exposes the resource to the whole VNet without a private IP). The correct answer for most secure access is a Private Endpoint.

Fifth, they test 'Key management'. They will ask: 'You suspect a key has been compromised. What should you do?' Answer: Regenerate the key in the Azure Portal (or using CLI). The trap is 'Delete the resource and recreate it' — that is overkill and loses all settings.

Sixth, they test 'Monitor and Logging'. You must know to enable 'Diagnostic Settings' to send logs to Log Analytics. A question might say: 'You want to see who called your AI resource and what data they sent. What should you enable?' Answer: Diagnostic settings for 'Audit' and 'AllMetrics' categories.

Finally, they test 'Resource Groups'. A question: 'Where must you create a new Cognitive Services resource?' Answer: Inside a Resource Group. The trap is 'Inside a subscription directly' — resources always live in a resource group.

To pass this section, practise the Microsoft Learn modules on 'Secure Cognitive Services' and use the Azure Portal to create and configure a real Cognitive Services resource. Do not just read — click the buttons.

Key Takeaways

Every Azure AI resource requires authentication: use Microsoft Entra ID (tokens) for applications and API keys only as a fallback.

Role-Based Access Control (RBAC) uses roles like 'Cognitive Services User' to grant API access and 'Contributor' to manage the resource itself.

Azure Policy enforces rules on resource creation (e.g., mandatory location), while RBAC controls permissions on existing resources.

A Private Endpoint makes your AI resource invisible to the public internet, offering the highest level of network security.

Regenerating an API key in the Azure Portal immediately invalidates the old key, so you must update all applications using that key.

Diagnostic settings must be enabled to send logs to Log Analytics for monitoring who calls your AI resource and what data they send.

Always store API keys in Azure Key Vault, never in application code or configuration files.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

API Key Authentication

Uses a static, long-lived secret string.

Easy to set up for simple scenarios.

Less secure because the key can be stolen and reused indefinitely.

Microsoft Entra ID Authentication

Uses short-lived tokens that expire (e.g., one hour).

Requires setup of a managed identity and role assignment.

More secure because tokens cannot be reused after expiry.

RBAC Contributor Role

Grants full management access to the resource (create, delete, configure).

Does NOT allow calling the AI APIs directly.

Suitable for administrators who need to set up and maintain the resource.

RBAC User Role

Grants access to call the AI APIs and read results.

Does NOT allow changing the resource itself.

Suitable for developers who only need to consume the AI service.

Private Endpoint

Creates a private IP address for the AI resource inside your VNet.

Fully removes the resource from the public internet.

More secure, but requires more configuration.

Service Endpoint

Exposes the AI resource to your VNet but keeps a public IP address.

Uses firewall rules to restrict access, but the resource is still internet-accessible.

Less secure than Private Endpoint.

Azure Policy

Enforces rules at resource creation time (e.g., location, tags).

Applies to all resources in a scope (subscription, resource group).

Ensures compliance with organisational standards.

RBAC

Controls permission on existing resources (who can do what).

Assigned to specific users, groups, or applications.

Manages access rights, not creation rules.

Watch Out for These

Mistake

Using API keys is the most secure way to access Azure AI services.

Correct

API keys are less secure than Microsoft Entra ID authentication because they are long-lived static secrets that can be easily stolen. Microsoft Entra ID tokens are short-lived and more secure.

Many beginners see keys as simple passwords and assume they are secure. They do not realise that keys are like a permanent house key, while Entra ID tokens are like a hotel key card that stops working after checkout.

Mistake

Assigning the 'Contributor' role on an AI resource gives full access to the resource's data and APIs.

Correct

The 'Contributor' role lets you manage the resource (create, delete, configure) but does NOT let you call the APIs or read the data. To call APIs, you need the 'User' or 'Reader' role specific to the service.

The word 'Contributor' sounds like it includes everything, but Azure RBAC separates management from data access. This is a deliberate design to prevent accidental data leaks.

Mistake

If I delete an API key, my application will still work until the key expires.

Correct

Deleting (or regenerating) an API key invalidates it immediately. The old key stops working instantly, breaking any application using that key.

People think of keys like passwords that have a 'change effective' delay. Azure deactivates keys instantly for security reasons, so an attacker cannot use a stolen key even for a few seconds.

Mistake

Azure Policy and RBAC are the same thing because both control access.

Correct

Azure Policy enforces rules on how resources are created (e.g., only in specific regions), while RBAC controls who can do what on existing resources (e.g., who can read the logs). They serve different purposes and are used together.

Both tools have 'rules' and 'permissions', so beginners lump them together. Policy is about resource compliance at creation time; RBAC is about user permissions at access time.

Mistake

A 'Private Endpoint' and a 'Service Endpoint' are the same thing for securing AI resources.

Correct

A Private Endpoint gives a resource a private IP address inside your Virtual Network, fully removing it from the internet. A Service Endpoint only exposes the resource to the VNet but leaves it with a public IP address (though filtered). Private Endpoint is more secure.

Both names contain 'Endpoint', and both are used for network security. Beginners do not realise the key difference: Private Endpoint makes the resource truly private, while Service Endpoint is just a firewall rule on the public endpoint.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What is the difference between an API key and a token from Microsoft Entra ID?

An API key is a static, long-lived secret that you include in every request. A token from Microsoft Entra ID is short-lived (often one hour) and is obtained automatically by your application. Tokens are more secure because they expire and cannot be used if intercepted later.

How do I get a key for an Azure AI service?

After creating the Azure AI resource in the Portal, go to the 'Keys and Endpoint' blade. You will see two keys (Key1 and Key2). Copy one and store it securely in Azure Key Vault. Never put it in code.

Can I use the same API key for multiple Azure AI resources?

No. Each Azure AI resource has its own unique set of API keys. You must use the specific key for the resource you want to access. This prevents a breach of one resource from exposing another.

What does RBAC do that API keys do not?

RBAC lets you assign fine-grained permissions to individual users or applications without sharing a global secret. For example, you can give read-only API access to one developer and full management access to another. API keys give the same full access to anyone who possesses the key.

Is it safe to put the API key in a configuration file?

No. Configuration files are often stored in source control or on disk, where they can be stolen or accidentally exposed. Always use Azure Key Vault or managed identities to keep secrets secure.

How do I block a specific IP address from calling my AI resource?

Go to the 'Networking' blade of your AI resource. Under 'Firewalls and virtual networks', you can add the offending IP address to the deny list, or use an IP firewall rule to allow only specific IPs.

Terms Worth Knowing

Keep going

You've finished Managing Azure AI Resources and Security. Continue through the AI-102 study guide to build a complete picture of the exam.

Done with this chapter?