Practice Exams:

Microsoft AZ-104: Managed Identities in Azure

Cloud & Architecture

A managed identity removes a stored application secret, but successful Azure authorization still depends on workload ownership, token audience, narrow permissions, and a repeatable way to diagnose failures. A workload that successfully obtains a token can still be denied by the target service because the identity lacks the required data-plane role. Troubleshooting must separate credential storage, identity assignment, token acquisition, and resource authorization. Before assigning another role, determine whether the failure is token audience, a missing data-plane permission, or a scope mismatch; each needs a different correction.

On this page
  1. Decide which workload is allowed to act
  2. System-assigned identities track one resource’s lifetime
  3. User-assigned identities serve controlled reuse and preprovisioning
  4. Understand how an identity obtains a token
  5. Give services the correct data-plane permission
  6. Design role assignments and ownership as lifecycle records
  7. Troubleshoot failures in the order they can occur
  8. Judge success by removed secret ownership and bounded authority

Decide which workload is allowed to act

An application that retrieves a document from Azure Storage needs to authenticate as something. In older deployments, that often meant a connection string containing an account key, a client secret in a configuration store, or a certificate loaded by the application process. Those arrangements can work, but each creates a credential inventory that must be protected, rotated, and kept consistent across deployment slots. Managed identity changes the problem: the Azure-hosted resource acquires an identity managed through Microsoft Entra rather than keeping its own reusable secret. Replacing stored secrets with managed identity is only half of a Microsoft AZ-104 deployment; the workload must also receive the precise resource permissions it needs.

The security benefit is not permission by default. Suppose a scheduled Function reads one blob container and pushes a message to a queue. Those are two distinct operations, potentially at two different scopes. Enabling identity on the Function gives it a principal; administrators must still grant appropriate data-plane roles and verify both requests. The same care used in Azure RBAC scope design applies to applications as well as people.

A useful first exercise is to write down the caller, target resource, operation, and expected error when access is intentionally removed. This turns a vague requirement such as “the app needs storage” into auditable permission design. It also prevents an easy mistake: assigning subscription Contributor and mistaking a successful call for evidence that the security arrangement is correct.

System-assigned identities track one resource’s lifetime

Consider an Azure virtual machine dedicated to a single nightly import. A system-assigned managed identity is attached directly to that VM. When the VM is deleted, the associated service principal is deleted with it; the identity does not become an independent platform asset that somebody must maintain indefinitely. This is a sensible match when the workload and identity should share one lifecycle.

That connection has deployment consequences. A principal does not exist until the resource is created with its identity enabled, so a role assignment targeting that principal requires the identity to be available first. Infrastructure-as-code pipelines must account for this dependency instead of assuming that a role assignment referencing an as-yet-unknown principal can always succeed in the same operation. It is worth inspecting the deployment graph before diagnosing a failure as an Azure outage.

System-assigned identities are also useful for limiting accountability. If an application and an auxiliary job require different permissions, placing both behind one broadly privileged identity hides that difference. A separate identity for each eligible resource lets logs and permission reviews describe what that resource actually needs, though the target service’s audit capabilities still determine how much detail appears in its records.

User-assigned identities serve controlled reuse and preprovisioning

A user-assigned managed identity is a resource of its own. It can be created before application deployment and associated with multiple supported Azure resources. That enables an infrastructure team to preconfigure a principal, grant permissions, and then attach it to a workload as instances are rebuilt. Microsoft distinguishes its independent lifecycle from the system-assigned model in its managed identity guidance.

This flexibility helps a blue-green deployment. If old and new instances temporarily need the same authorized access during cutover, attaching one appropriately scoped user-assigned identity can avoid permission gaps from creating and removing several principals. It can also work for a fleet that performs one tightly defined function under common ownership. But reuse should be deliberate, not a default that silently grants one team’s access to every workload sharing the identity.

A compromise is to group identities by specific workload function and privilege boundary. Do not reuse an identity across a public API, a finance batch processor, and a diagnostic jump box merely because all three live in the same subscription. Those components have different exposure and incident-response needs. An incident involving one consumer must not automatically authorize the same identity to operate in unrelated systems.

Understand how an identity obtains a token

The managed identity endpoint or supported SDK obtains a Microsoft Entra access token for a requested audience, commonly called the resource or scope. The application then presents that token to the destination service. An identity configured correctly for Key Vault cannot simply present a token intended for another audience and expect Key Vault to accept it. Token acquisition, token audience, and destination authorization are separate steps.

Many Azure SDKs can use a managed identity without embedding a secret or writing a custom token-request client. During development, the same SDK might use a developer’s signed-in identity rather than the production managed identity. That convenience can conceal deployment mistakes: a local test succeeds under a privileged human account, then the production application receives 403 Forbidden with its narrower permissions. Review the principal actually used by each environment, not merely the code path that creates the SDK client.

Tokens and authorizations are not necessarily refreshed instantly. Microsoft’s managed identities FAQ describes infrastructure caching and explains why permission changes can take time to take effect. Repeatedly deleting and recreating role assignments while waiting can create more uncertainty. Record the principal ID, target scope, operation, and propagation window before deciding that a configuration change failed.

Give services the correct data-plane permission

A storage account illustrates why management access and workload data access should not be conflated. An Azure management role can allow someone to change account settings without directly granting the application permission to read a blob through Entra-based data authorization. For ordinary blob access, a suitably scoped data role is generally more precise than broad management access. Legacy Shared Key paths complicate the picture because certain management permissions can retrieve keys that grant indirect data access.

For an application that only lists files in one container, the relevant identity and authorization decision belongs at the container or another justified narrow scope. Use a separate principal with a distinct role if another job needs to delete data. A service-specific authorization model may apply in addition to Azure RBAC, so do not infer support from the fact that a service is hosted in Azure. Where possible, check the target documentation before deciding that managed identity alone is sufficient.

Network controls are another independent gate. A valid token cannot overcome a storage firewall that denies the application’s network path. If a private endpoint is required, private DNS and routing must lead to it correctly. A successful sign-in in Entra proves neither reachability nor permission to complete the storage operation. Test those boundaries separately so that troubleshooting remains precise.

Design role assignments and ownership as lifecycle records

An identity should have an owner, an associated workload, a declared list of allowed services, and an expected retirement event. For system-assigned identities, removal is normally tied to deletion of the parent resource. User-assigned identities need an explicit retirement process because deleting one consumer does not remove the independent identity resource or its other associations.

An overlooked user-assigned identity may retain powerful access long after the service it originally supported has gone away. Conversely, deleting a shared identity as part of one team’s cleanup can interrupt other consumers. An operator needs to know which workloads currently reference the identity and which role assignments will survive a change. A simple dependency inventory is often more useful than a complicated naming convention.

Troubleshoot failures in the order they can occur

Imagine a Function that has been assigned a user-assigned identity and is supposed to read a configuration secret. First verify that the Function is associated with the intended identity rather than a similarly named principal. Next confirm that code or SDK configuration selects the correct identity and requests a token for the intended service. Only then inspect the role or access-policy permissions at the destination. If those checks pass, examine network restrictions, private name resolution, and resource-specific errors.

The diagnostic sequence prevents a common detour. A timeout reaching a private endpoint is not repaired by granting Owner. An incorrect token audience is not repaired by opening a firewall. A valid token with insufficient target permissions is not repaired by regenerating a secret that the workload does not use. Log the operation, error, principal identity, resource ID, and timestamp so the next investigator can follow evidence rather than undo a colleague’s unrelated change.

A small lab can make each condition observable. Start with a disposable Azure workload and a target it cannot access. Enable the appropriate identity, add the minimum permission, and verify success. Remove the permission and observe the specific failure after propagation. Finally, block the allowed network route and compare that symptom with the authorization failure. Delete the lab resources and review whether any user-assigned identity or role assignment remains.

Judge success by removed secret ownership and bounded authority

Moving from a connection string to managed identity does not automatically make an architecture secure. A user-assigned identity with subscription-wide privileges that is shared by many applications is still a high-impact credential boundary, even if no developer can download its reusable password. The design is stronger when the principal has a narrow purpose, its permitted operations are explicit, and its associations are reviewable.

The durable operational improvement is that teams stop distributing long-lived application secrets as normal configuration. They can devote more attention to who invokes a service, what it is authorized to do, which path it uses, and how quickly permissions can be removed after an incident. Those are the decisions to document, test, and revisit when the workload changes.

Continue learning

Related guides

Azure RBAC: Separate Roles from ScopeTrace principal assignments, inherited scope, and effective Azure RBAC.Azure RBAC Design for Platform TeamsDelegate platform access with scoped roles and least privilege.Microsoft Entra Groups, Roles, and Access ReviewsGovern Entra membership, directory roles, and access reviews.

Related Posts

• Microsoft AZ-104: What Azure Administrators Actually Do

• Unlocking Cloud Potential: A Beginner’s Journey into Microsoft Azure Certifications

• Unveiling Microsoft Azure: The Future of Intelligent Cloud Solutions

• Microsoft AZ-104 vs. AZ-900: Which Should You Take?

• Exploring the AZ-900 Certification – Your Gateway to Cloud Computing Mastery

• Cloud Guardian: Unlocking Your Potential with Microsoft’s AZ-500

• Microsoft AZ-104: VM Availability Options

• Microsoft AZ-104: Entra Roles and Access

• Microsoft AZ-104: Azure Landing Zones

• Microsoft AZ-104: Troubleshoot Azure VMs