In on-premises networks, the firewall drew the boundary and identity lived behind it. In Azure and Google Cloud, that boundary is gone: every API call is authenticated, and the identity making the call is the control. A single over-permissioned service account or a forgotten owner-level role can expose an entire subscription or project. This guide covers the IAM practices that hold up in both clouds, and the mistakes that quietly undo them.
Why cloud IAM differs from a traditional directory
Cloud IAM is policy-based and API-driven. Instead of group membership granting access to a file share, you attach a role binding to a resource, and that binding is evaluated on every request. Permissions are inherited down a hierarchy — management groups and subscriptions in Azure, organizations, folders, and projects in Google Cloud — so a broad grant at the top applies everywhere below it.
The second difference is machine identity. Workloads, pipelines, and functions all need credentials. If those credentials are long-lived secrets stored in configuration, they become the easiest path into your environment. Most cloud IAM hardening is really about removing that path.
Four principles that apply to both clouds
- Least privilege: grant the smallest role that lets the task succeed, at the narrowest scope that covers the resource.
- No standing privilege: administrative access should be activated on demand, time-bound, and logged.
- No long-lived secrets: prefer platform-issued identities over keys, passwords, and tokens you store yourself.
- Reviewable by default: if you cannot list who has access to a resource in one query, you cannot govern it.
Azure: Entra ID, RBAC, and managed identities
Microsoft Entra ID (formerly Azure Active Directory) is the identity provider; Azure RBAC controls access to Azure resources. Keep the two separate in your head — a user can exist in Entra ID without any Azure role assignment, and that is the correct default.
Assign roles at the resource group or resource level rather than the subscription, and prefer built-in role definitions over the broad Contributor and Owner roles. Owner also grants the ability to assign roles, which makes it effectively a privilege-escalation role.
For workloads, use managed identities. They are issued and rotated by the platform, so there is no secret in your code or pipeline.
az vm identity assign -g myResourceGroup -n myVM
az role assignment create \
--assignee <principal-id> \
--role "Storage Blob Data Reader" \
--scope /subscriptions/<sub-id>/resourceGroups/myResourceGroup
For human administrators, enable Microsoft Entra Privileged Identity Management (PIM) so eligible assignments must be activated, optionally with approval and a justification. Pair it with Conditional Access policies that require compliant devices or multifactor authentication for privileged roles, and keep at least two break-glass accounts excluded from those policies and monitored.
Google Cloud: roles, service accounts, and federation
Google Cloud IAM binds a member to a role on a resource. Avoid the basic roles (Owner, Editor, Viewer) — they are legacy and far too broad. Use predefined roles, and write custom roles only when nothing predefined fits.
gcloud projects add-iam-policy-binding my-project \
--member="serviceAccount:[email protected]" \
--role="roles/storage.objectViewer"
Service accounts are both an identity and a resource, which is why they are a common escalation path: anyone who can act as a service account inherits its permissions. Restrict the roles/iam.serviceAccountTokenCreator and roles/iam.serviceAccountUser roles carefully, and prefer short-lived impersonation over downloaded keys.
For workloads running outside Google Cloud — another cloud, or a CI system such as GitHub Actions — use workload identity federation instead of service account keys. To prevent key creation entirely at the organization level, apply the organization policy constraint constraints/iam.disableServiceAccountKeyCreation.
Two more tools are worth adopting early: IAM Recommender, which analyzes actual usage and suggests narrower roles, and VPC Service Controls, which creates a perimeter around sensitive services to limit data exfiltration even if a credential leaks.
Step-by-step hardening plan
- Inventory identities. Export all role assignments and IAM policies in both clouds. Include service principals, managed identities, service accounts, and any external or guest accounts.
- Eliminate standing owner-level access. Convert permanent assignments to eligible ones in PIM, and remove basic roles in Google Cloud in favor of predefined roles.
- Move workloads to platform identities. Replace stored secrets with managed identities in Azure and workload identity federation in Google Cloud. Rotate and delete any keys you cannot yet remove.
- Reduce scope. Push assignments down to resource groups or individual resources. Apply IAM conditions or deny policies where a role is still broader than needed.
- Turn on the audit trail. Enable Entra sign-in and audit logs, Azure Activity Log export, and Google Cloud Admin Activity and Data Access audit logs to a central, write-protected destination.
- Alert on IAM changes. Role assignment creation, policy binding changes, key creation, and service account impersonation should all generate a notification, not just a log line.
- Schedule access reviews. Quarterly at minimum for privileged roles, and on every offboarding. Automate revocation so a leaver's access does not survive their last day.
Common mistakes
- Using groups as a shortcut for everything. Groups help, but a group with Owner at the tenant root is just a slower way to over-permission everyone.
- Trusting the console view. Inherited permissions from a parent scope do not always appear where you expect. Query the effective policy, not the page you are looking at.
- Leaving service account keys in CI secrets. They rarely expire, are hard to attribute, and are frequently copied into logs and artifacts.
- Ignoring non-human identities at offboarding. Service principals and service accounts created for a project outlive the project more often than anyone expects.
- Reviewing access without usage data. Use IAM Recommender and Azure activity data to see what was actually used before deciding what to remove.
Checklist
- Every privileged role is eligible, time-bound, and approved rather than permanently assigned.
- No basic roles (Owner, Editor, Viewer) remain in production Google Cloud projects.
- Workloads authenticate with managed identities or workload identity federation, not stored keys.
- Service account key creation is blocked by organization policy, with documented exceptions.
- Assignments are scoped to resource groups or resources, not subscriptions or organizations, unless justified.
- IAM changes, key creation, and impersonation events are logged centrally and alerted on.
- Break-glass accounts exist, are excluded from Conditional Access, and are monitored.
- Access reviews run on a schedule and are tied to your joiner-mover-leaver process.





