Scenario Questions
Real-world Azure for DevOps situations and how to reason through them in an interview
Identity, Access and Governance
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q1 A new developer joins and needs to deploy to the dev resource group only. How do you give access?
Beginner
Situation read β Access should come from group membership, at the smallest useful scope, and never touch prod.
What I'd do β
- Add the developer to the existing Entra group
grp-shop-dev-contributors(create it once if missing) - Make sure that group holds Contributor on the dev RG only:
az role assignment create --assignee-object-id <groupObjectId> --assignee-principal-type Group \ --role Contributor --scope /subscriptions/<sub>/resourceGroups/rg-shop-dev - Developer runs
az logout && az login, thenaz group show -n rg-shop-devto confirm - For prod, they get nothing by default; read access comes later through a separate reader group
Why β Group-based access survives team changes, keeps the subscription under the role assignment limit, and makes access reviews readable.
Interview tip β Say "groups, not users, at the lowest scope" before naming any role.
Q2 Your GitHub Actions workflow uses a client secret stored in a repo secret. Security wants it gone. What do you do?
Beginner
Situation read β A long-lived secret in CI is the most common Azure credential leak. Replace it with workload identity federation.
What I'd do β
- Add a federated credential to the existing app registration (or switch to a user-assigned identity):
az ad app federated-credential create --id <appId> --parameters '{ "name":"gh-main","issuer":"https://token.actions.githubusercontent.com", "subject":"repo:devopsshack/shop:ref:refs/heads/main","audiences":["api://AzureADTokenExchange"]}' - Update the workflow:
permissions: id-token: write, contents: readandazure/login@v2withclient-id,tenant-id,subscription-idonly - Run the workflow and confirm
az account showworks - Delete the client secret:
az ad app credential delete --id <appId> --key-id <keyId>and remove the repo secret
Why β Federated tokens live minutes, are bound to a repo and branch or environment, and there is nothing to rotate or leak.
Interview tip β Mention binding the subject to a protected GitHub environment for prod.
Q3 Auditors ask "who has Owner on production, and why?" How do you answer and fix it?
Intermediate
Situation read β Standing Owner access is the finding. You need an inventory now and PIM going forward.
What I'd do β
- Inventory, including inherited assignments:
az role assignment list --role Owner --scope /subscriptions/<prod-sub> --include-inherited \ --query "[].{who:principalName, type:principalType, scope:scope}" -o table - Expand groups and identify service principals with Owner (pipelines rarely need it)
- Convert human Owner assignments to PIM-eligible with approval, MFA and a 2β4 hour activation limit
- Replace pipeline Owner with Contributor plus a constrained
Role Based Access Control Administratorcondition if it must assign roles - Schedule quarterly access reviews on the privileged groups
Why β PIM gives auditors a justification and approval trail per activation, and drops the attack surface to near zero most of the time.
Interview tip β "Zero standing access to prod" is the phrase to use.
Q4 A VM application needs to read blobs from one container. How do you set up access without keys?
Intermediate
Situation read β Managed identity plus a data-plane role scoped to the container.
What I'd do β
- Enable a system-assigned identity:
az vm identity assign -g rg -n vm-app - Grant the data role at container scope:
az role assignment create --assignee <principalId> --role "Storage Blob Data Reader" \ --scope "/subscriptions/<sub>/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/stshop/blobServices/default/containers/reports" - In code use
DefaultAzureCredential; on the VM test withaz login --identity && az storage blob list --account-name stshop -c reports --auth-mode login - Disable shared key access on the account once nothing uses keys
Why β No secret anywhere, access scoped to one container, and access is revoked by removing one role assignment.
Interview tip β Point out --auth-mode login; without it the CLI tries account keys.
Q5 Teams keep creating resources in random regions and without tags. How do you stop it?
Beginner
Situation read β Governance belongs in Azure Policy at management group scope, not in a wiki.
What I'd do β
- Assign built-in "Allowed locations" (and "Allowed locations for resource groups") with
centralindiaandsouthindiaon the landing zones management group - Assign "Require a tag on resource groups" for
owner,env,costcenter - Assign "Inherit a tag from the resource group if missing" (Modify) for each tag, then remediate existing resources:
az policy remediation create -n inherit-owner --policy-assignment inherit-owner-tag \ --resource-discovery-mode ReEvaluateCompliance - Start new deny policies in
Auditfor a week, review compliance, then switch toDeny
Why β Policy enforces at ARM for every tool, so portal clicks, CLI and Terraform are all covered.
Interview tip β Rolling out deny policies via audit first shows you care about not breaking teams.
Q6 A contractor needs temporary read access to logs for two weeks. How do you handle it?
Beginner
Situation read β External, time-boxed, read-only. Use B2B guest access with an expiring assignment.
What I'd do β
- Invite the contractor as a guest (or via an access package in Entra ID Governance with a 14-day expiry)
- Grant
Log Analytics Readeron the workspace, or better, a PIM-eligible assignment with an end date - Require MFA for guests through Conditional Access
- Set a calendar check and an access review on the guest's group
Why β Time-limited assignments clean themselves up; manual removal is what gets forgotten.
Interview tip β Name "access packages" if the company has Entra ID Governance.
Q7 You need to let an app team create their own role assignments for their identities, without giving them Owner.
Advanced
Situation read β Delegated, constrained role assignment through an ABAC condition.
What I'd do β
- Assign the team group
Role Based Access Control Administratoron their RG with a condition limiting roles and principal types:(the GUIDs are AcrPull and Key Vault Secrets User)az role assignment create --assignee-object-id <teamGroupId> --assignee-principal-type Group \ --role "Role Based Access Control Administrator" --scope <rgId> \ --condition "((!(ActionMatches{'Microsoft.Authorization/roleAssignments/write'})) OR (@Request[Microsoft.Authorization/roleAssignments:RoleDefinitionId] ForAnyOfAnyValues:GuidEquals {7f951dda-4ed3-4680-a7ca-43fe172d538d, 4633458b-17de-408a-b874-0445c86b69e6}))" \ --condition-version 2.0 - Test that assigning Owner fails and AcrPull succeeds
- Document the allowed role list in the platform docs
Why β Teams self-serve the common grants, and escalation to Owner or Contributor is impossible.
Interview tip β Explaining conditional delegation separates senior answers from "just give them Owner".
Q8 Someone deleted a production resource group last night. How do you find out who, and prevent it?
Intermediate
Situation read β Activity Log answers who; locks and RBAC prevent the repeat.
What I'd do β
- Query the Activity Log at subscription level (the RG is gone):
az monitor activity-log list --offset 2d \ --query "[?operationName.value=='Microsoft.Resources/subscriptions/resourceGroups/delete'].{who:caller, when:eventTimestamp, rg:resourceGroupName}" -o table - Restore from IaC plus data backups (Azure Backup, storage soft delete, SQL long-term retention)
- Add
CanNotDeletelocks on prod RGs holding state - Remove standing write access in prod; move humans to PIM
Why β Locks stop accidents by anyone, including Owners, without blocking normal updates.
Interview tip β Mention that you rebuilt from code; it proves IaC was real.
Q9 You have 40 subscriptions and need consistent diagnostic logging for Key Vaults everywhere. How?
Intermediate
Situation read β DeployIfNotExists policy at management group scope plus remediation.
What I'd do β
- Assign the built-in initiative for resource logging to Log Analytics (category group
audit) at the top landing-zone management group, parameterised with the central workspace ID - Give the assignment a managed identity with
Log Analytics ContributorandMonitoring Contributor - Create remediation tasks for existing vaults
- Check compliance:
az policy state summarize --management-group lz
Why β New vaults in any subscription get logging automatically, and compliance is visible in one dashboard.
Interview tip β Call out the managed identity on the assignment; DINE fails silently without its roles.
Q10 A partner company's engineers need to manage resources in your tenant regularly. B2B or Lighthouse?
Advanced
Situation read β Regular, multi-person, cross-tenant management. Lighthouse fits better than individual guests.
What I'd do β
- Agree on the roles (Contributor on specific RGs, never Owner) and their Entra group in the partner tenant
- Deploy a Lighthouse registration definition and assignment via ARM/Bicep in our subscription, with eligible (PIM) authorizations for elevated roles
- Confirm actions appear in our Activity Log with the partner's identities
- Review delegations quarterly; remove by deleting the registration assignment
Why β Partner engineers keep their own identities and MFA, we never manage their accounts, and access is defined as code.
Interview tip β Note that Lighthouse cannot delegate Owner, which auditors like.
Q11 Your Terraform pipeline needs to create role assignments, but it only has Contributor. What do you change?
Intermediate
Situation read β Contributor excludes Microsoft.Authorization/roleAssignments/write. Give the minimum extra right.
What I'd do β
- Add
Role Based Access Control Administratorfor the pipeline identity at the RG scope, with a condition restricting assignable roles (AcrPull, Key Vault Secrets User, Network Contributor) - Do not grant Owner or User Access Administrator unrestricted
- Re-run the pipeline and check that the
azurerm_role_assignmentresources succeed - Record the exception in the platform's RBAC register
Why β Pipelines that can grant any role are a privilege escalation path for anyone who can edit the pipeline.
Interview tip β Ask "who can change the pipeline?" β that person effectively holds the pipeline's rights.
Q12 You must prevent anyone from creating public IPs in corp subscriptions, except the hub firewall.
Intermediate
Situation read β Deny policy with a scoped exemption.
What I'd do β
- Assign a deny policy on
Microsoft.Network/publicIPAddressesat thecorpmanagement group - Create a policy exemption for the hub connectivity RG:
az policy exemption create -n hub-fw-pip --policy-assignment <assignmentId> \ --exemption-category Waiver --scope /subscriptions/<conn-sub>/resourceGroups/rg-hub \ --description "Azure Firewall needs a public IP" - Verify with a test
az network public-ip createin a spoke; expectRequestDisallowedByPolicy
Why β Exemptions are documented and auditable, unlike carving the hub out with ad hoc exclusions.
Interview tip β Mention AKS and App Gateway also want public IPs; design ingress before you deny.
Q13 A developer's laptop was stolen. They had az login sessions and kubeconfigs. What do you do?
Advanced
az login sessions and kubeconfigs. What do you do?Situation read β Revoke sessions centrally, and check whether any static credentials were on the device.
What I'd do β
- Revoke the user's refresh tokens:
az rest --method post --url https://graph.microsoft.com/v1.0/users/<id>/revokeSignInSessions - Reset password, re-register MFA, mark device lost in Intune
- If AKS clusters still have local accounts, rotate cluster certificates:
az aks rotate-certs -g rg -n aks(causes API downtime; plan it) - Rotate any secrets the user had locally (storage keys, SP secrets)
- Review sign-in and Activity Logs for activity after the theft time
Why β Entra-backed access dies with the session; static credentials (admin kubeconfig, keys) don't. That is the argument for disabling local accounts.
Interview tip β Use this to argue for --disable-local-accounts on every cluster.
Q14 Two teams share a subscription and keep breaking each other's resources. What do you propose?
Intermediate
Situation read β The subscription is the isolation unit; RGs plus RBAC are a stopgap.
What I'd do β
- Short term: separate RGs per team, Contributor only on their own RG, Reader on the rest
- Medium term: vend one subscription per team per environment through the landing-zone process
- Move resources with
az resource movewhere supported, or redeploy from IaC - Shared things (hub network, DNS) stay in platform subscriptions
Why β Separate subscriptions isolate quotas, cost, RBAC and blast radius; RG-level separation still shares limits and subscription-level operations.
Interview tip β Say "subscription per application per environment" as the target state.
Q15 Security wants all Azure resource changes in prod to go through code. How do you enforce it?
Advanced
Situation read β Remove human write paths, keep a break-glass path, and detect drift.
What I'd do β
- Give humans Reader in prod; write roles only via PIM with approval for emergencies
- Pipelines deploy with federated identities from protected branches and environments with approvals
- For Bicep, use deployment stacks with
--deny-settings-mode denyWriteAndDelete, excluding the pipeline and break-glass identities - Nightly drift detection (
terraform plan -detailed-exitcodeorwhat-if) that opens a ticket on changes - Alert on Activity Log writes in prod by any caller that isn't the pipeline identity
Why β Enforcement plus detection: PIM handles emergencies, everything else is reviewed in PRs.
Interview tip β Always keep a break-glass path in the answer; "nobody can change prod" is not a real design.
Q16 A managed identity needs to call Microsoft Graph to read group memberships. How do you grant it?
Advanced
Situation read β Graph application permissions for managed identities can't be granted in the portal UI; use the Graph API.
What I'd do β
- Find the Graph service principal and the
GroupMember.Read.Allapp role ID:graphSp=$(az ad sp show --id 00000003-0000-0000-c000-000000000000 --query id -o tsv) roleId=$(az ad sp show --id 00000003-0000-0000-c000-000000000000 \ --query "appRoles[?value=='GroupMember.Read.All'].id" -o tsv) - Create the app role assignment (needs a Privileged Role Administrator or equivalent):
az rest --method post --url "https://graph.microsoft.com/v1.0/servicePrincipals/<miObjectId>/appRoleAssignments" \ --body "{\"principalId\":\"<miObjectId>\",\"resourceId\":\"$graphSp\",\"appRoleId\":\"$roleId\"}" - Get a token for
https://graph.microsoft.comin the app and test
Why β Graph rights are directory permissions, not Azure RBAC; Contributor on anything doesn't help.
Interview tip β Distinguishing Graph permissions from RBAC is a strong signal.
Q17 Finance wants cost per team, but resources aren't tagged consistently. What do you do?
Intermediate
Situation read β Fix tagging going forward with policy, backfill with remediation, and use RG/subscription structure as a fallback.
What I'd do β
- Define the tag schema (
costcenter,owner,env) - Require tags on RGs, inherit to resources with Modify policies, and remediate
- Enable tag inheritance in Cost Management settings so usage records pick up RG tags
- Build a Cost Management view grouped by
costcenter, scheduled export for finance - Report untagged spend as its own line so owners feel the pressure
Why β Tags on RGs plus inheritance is far less work than tagging every resource by hand.
Interview tip β Mention shared costs (hub firewall) need an allocation rule, not tags.
Q18 A Global Administrator leaves the company. What must be checked beyond disabling the account?
Advanced
Situation read β Admins accumulate hidden access: app ownership, secrets, elevated root access, personal subscriptions.
What I'd do β
- Disable the account and revoke sessions
- Check whether they used "elevate access" (User Access Administrator at root
/) and remove it:az role assignment list --scope / --role "User Access Administrator" - Find app registrations they own and credentials they created; rotate those secrets
- Check subscriptions where they are Account Admin or billing owner; transfer billing ownership
- Review PIM eligible assignments and Conditional Access exclusions they added
Why β Root-scope access and owned apps survive account disablement in practice, because other systems still trust those secrets.
Interview tip β "Elevate access at root scope" is the detail most candidates miss.
Q19 You want app teams to get compliant AKS clusters without writing Terraform themselves. How?
Advanced
Situation read β Platform engineering problem: golden path module plus self-service.
What I'd do β
- Build an internal Terraform module wrapping AVM's AKS module with our defaults (Overlay + Cilium, Entra RBAC, workload identity, monitoring, policy add-on, maintenance windows)
- Expose it through a self-service flow: a PR to a "clusters" repo with a small
tfvarsfile, or Azure Deployment Environments catalog items - CI runs plan, policy checks (Checkov, Azure Policy at deploy), platform approval, apply
- Flux extension bootstraps each new cluster with baseline platform components
Why β Teams get speed, the platform team keeps control, and every cluster is built the same way.
Interview tip β Name the golden path idea and the guardrails, not just the tool.
Q20 An Azure Policy in Deny mode suddenly blocks an urgent production fix. What do you do?
Intermediate
Situation read β Don't delete the assignment. Create a narrow, expiring exemption and fix the root cause.
What I'd do β
- Read the policy assignment ID from the
RequestDisallowedByPolicyerror - Create an exemption scoped to the single resource or RG with
--expires-ona day or two out - Ship the fix, then decide whether the policy or the deployment needs changing
- Feed it back: policy authors add the case to tests; app team adjusts templates
Why β Exemptions keep the audit trail and expire on their own; deleted assignments tend to stay deleted.
Interview tip β Mention --expires-on; it shows you've done this under pressure before.
Networking Design
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q21 Design the network for a new three-tier app in Central India that must be private except for the web front end.
Intermediate
Situation read β Spoke VNet peered to the hub, App Gateway WAF as the only public entry, private endpoints for data.
What I'd do β
- Allocate
10.21.0.0/20from IPAM; subnets:snet-agw(/24),snet-app(/23),snet-pe(/24),snet-dataif needed - Application Gateway v2 with WAF in
snet-agw, public frontend, backends insnet-app - App tier on VMSS or AKS in
snet-app, NSG allowing 443 only fromsnet-agw - Database and Key Vault via Private Endpoints in
snet-pe, Private DNS zones linked from the hub - UDR
0.0.0.0/0to the hub firewall onsnet-app(not onsnet-agw, which needs direct internet for its control traffic)
Why β One public surface with WAF, east-west and egress inspected, PaaS never exposed publicly.
Interview tip β Mention that Application Gateway v2's subnet must not get a default route to an NVA unless you use its private-only deployment.
Q22 Spoke A can't talk to spoke B, both peered to the hub. What design change makes it work?
Beginner
Situation read β Peering is not transitive. Route through the hub firewall.
What I'd do β
- On each spoke's subnets, add a UDR for the other spoke's CIDR (or a supernet like
10.0.0.0/8) with next hop the firewall private IP - Enable
allowForwardedTrafficon the hub-to-spoke peerings - Add firewall network rules allowing the required flows AβB
- Verify with
az network watcher show-next-hopand a test connection
Why β The firewall becomes the transit point, and every cross-spoke flow is explicitly allowed and logged.
Interview tip β Offer Virtual WAN or AVNM mesh as alternatives when there are many spokes.
Q23 Workloads must reach Azure SQL privately, including from on-prem over ExpressRoute. How do you set it up?
Advanced
Situation read β Private Endpoint plus hybrid DNS is the whole problem.
What I'd do β
- Create a Private Endpoint for the SQL server in the spoke
snet-pewith a DNS zone group toprivatelink.database.windows.net(zone lives in the connectivity subscription, linked to the hub) - Deploy DNS Private Resolver in the hub with an inbound endpoint
- On-prem DNS conditionally forwards
database.windows.netto the resolver inbound IP - Set the SQL server
publicNetworkAccessto Disabled - Test from on-prem:
nslookup sql-shop.database.windows.netreturns10.x
Why β The endpoint gives the private IP; the DNS chain makes clients use it. Forwarding the public zone (not only privatelink) keeps the CNAME chain intact.
Interview tip β Most real outages here are DNS, so lead with the DNS design.
Q24 You need all outbound traffic from AKS to go through Azure Firewall. How do you do it?
Advanced
Situation read β UDR outbound type with firewall rules for AKS dependencies.
What I'd do β
- Create the route table on the AKS subnet:
0.0.0.0/0β firewall private IP - On the firewall: application rule with FQDN tag
AzureKubernetesService, plus rules for your ACR, MCR (mcr.microsoft.com,*.data.mcr.microsoft.com), Ubuntu/Azure Linux update endpoints, monitoring endpoints, and a network rule allowing TCP 443 to the API server (service tagAzureCloud.<region>) plus UDP 123 for NTP - Create the cluster with
--outbound-type userDefinedRouting --vnet-subnet-id <subnetId> - For inbound to public Services, add a DNAT rule on the firewall (asymmetric routing otherwise) or use an internal LB behind App Gateway
Why β Central egress control and logging, with a known egress IP for partners.
Interview tip β Mention asymmetric routing for inbound public LBs; it's the classic gotcha.
Q25 A partner needs to whitelist a single egress IP from your App Service and AKS workloads. How?
Intermediate
Situation read β NAT Gateway with a static public IP (or firewall egress) on the subnets.
What I'd do β
- Create a public IP prefix or single IP and a NAT Gateway; associate it with the AKS node subnet and App Service integration subnet
- App Service: enable VNet integration and route all outbound through the VNet
- AKS: create or update with
--outbound-type userAssignedNATGateway - Confirm with
curl -s ifconfig.mefrom a pod and from the App Service Kudu console
Why β A NAT Gateway gives a deterministic egress IP and avoids SNAT exhaustion.
Interview tip β Mention it is a per-subnet, per-zone resource; plan zone redundancy accordingly.
Q26 You're asked to expose an internal API to a customer's Azure tenant without VNet peering. How?
Advanced
Situation read β Private Link Service: publish your service behind a Standard internal LB; they create a Private Endpoint to it.
What I'd do β
- Put the API behind an internal Standard Load Balancer (AKS: Service annotations for internal LB plus
service.beta.kubernetes.io/azure-pls-create: "true") - Create a Private Link Service on the LB frontend with NAT IPs from a dedicated subnet
- Share the PLS alias with the customer; set auto-approval for their subscription or approve manually
- They create a Private Endpoint in their VNet; traffic arrives via NAT IPs
Why β No overlapping-CIDR problems, no peering, one-way connectivity, and the customer reaches only that one service.
Interview tip β Note that you see the NAT IPs as sources; use PROXY protocol v2 if you need the original client.
Q27 Users worldwide hit your app hosted in Central India and complain about latency. What do you put in front?
Beginner
Situation read β Global anycast entry with edge caching: Front Door.
What I'd do β
- Create Front Door Standard (Premium if you need Private Link to origin or managed WAF rule sets)
- Origin group pointing to the App Gateway or App Service; health probe on
/health - Caching rules for static paths, compression on
- WAF policy attached, custom domain with managed certificate, then DNS cutover
- Lock the origin to accept only Front Door:
AzureFrontDoor.Backendservice tag plus check theX-Azure-FDIDheader
Why β TLS terminates near users, static content comes from the edge, and dynamic traffic rides the Microsoft backbone.
Interview tip β Always mention origin lock-down; otherwise attackers bypass the WAF.
Q28 You must allow developers SSH to Linux VMs without public IPs or SSH keys.
Beginner
Situation read β Bastion plus Entra login extension, RBAC-controlled.
What I'd do β
- Deploy Azure Bastion Standard in the hub (
AzureBastionSubnet, native client support enabled) - Install the extension:
az vm extension set --publisher Microsoft.Azure.ActiveDirectory --name AADSSHLoginForLinux -g rg --vm-name vm-app - Grant
Virtual Machine User Login(orAdministrator Login) to the dev group on the RG - Connect:
az network bastion ssh -n bas-hub -g rg-hub --target-resource-id <vmId> --auth-type AAD
Why β Access follows Entra groups and Conditional Access, nothing to rotate, nothing exposed.
Interview tip β Mention JIT VM access in Defender for Servers as the alternative when Bastion isn't available.
Q29 An application needs to call Key Vault, Storage and ACR privately from a spoke. How do you structure Private DNS for many spokes?
Advanced
Situation read β Central private DNS zones in the connectivity subscription, linked once to the hub, resolved via the DNS resolver.
What I'd do β
- Create one zone per service type centrally:
privatelink.vaultcore.azure.net,privatelink.blob.core.windows.net,privatelink.azurecr.io - Link them to the hub VNet; spokes use the hub resolver inbound IP (or the firewall DNS proxy) as their DNS server
- Use Azure Policy (DeployIfNotExists) to create DNS zone group records automatically when spokes create Private Endpoints
- Deny creation of
privatelink.*zones in spokes by policy to avoid split-brain
Why β One zone per service tenant-wide avoids duplicate zones that resolve differently in different places.
Interview tip β "Duplicate privatelink zones" is the root cause of most enterprise PE DNS incidents.
Q30 You need to inspect and filter outbound HTTPS by URL, not just domain. What do you choose?
Advanced
Situation read β URL filtering inside HTTPS needs TLS inspection: Azure Firewall Premium.
What I'd do β
- Deploy Azure Firewall Premium with a Premium Firewall Policy
- Create an intermediate CA certificate in Key Vault; grant the firewall's managed identity access
- Distribute the root CA to clients (VMs, AKS node trust stores via image or daemonset)
- Enable TLS inspection on application rules, then URL-based rules and IDPS
- Exclude categories you must not inspect (banking, health) and pinned-cert destinations
Why β Without decrypting, the firewall only sees SNI and can filter by FQDN, not path.
Interview tip β Mention certificate-pinning breakages and privacy exclusions.
Q31 Your App Gateway WAF in Prevention mode starts blocking a legitimate checkout POST. How do you handle it?
Intermediate
Situation read β False positive. Find the rule, add a narrow exclusion, keep Prevention on.
What I'd do β
- Query the firewall log:
AzureDiagnostics | where Category == "ApplicationGatewayFirewallLog" and action_s == "Blocked" | where requestUri_s has "/checkout" | project TimeGenerated, ruleId_s, details_message_s, details_data_s - Identify the rule (for example a SQLi rule matching a field
comments) - Add an exclusion on the WAF policy for that request body field and rule, or a per-URI policy for
/checkout - Replay the request; confirm blocks stop and other traffic is still inspected
Why β Narrow exclusions preserve protection; switching the whole WAF to Detection removes it.
Interview tip β Say you'd never disable an entire rule group for one field.
Q32 How would you connect two Azure regions and on-prem with redundancy?
Advanced
Situation read β Two hubs, ExpressRoute with diverse circuits, VPN as backup, global peering or Virtual WAN between hubs.
What I'd do β
- Hub per region (Central India, South India) each with ExpressRoute gateway connected to two circuits in different peering locations
- S2S VPN on each hub as a backup path
- Hub-to-hub global peering with UDRs, or Virtual WAN hubs with transitive routing
- BGP weights/AS-path prepending so each region prefers its local path
- Test failover by disabling circuits during a maintenance window
Why β Every single failure (circuit, gateway, region) leaves a working path.
Interview tip β Mention testing; a backup path that was never exercised often fails.
Q33 A team needs Container Apps with private access to a database. How do you set up networking?
Intermediate
Situation read β Container Apps environment injected into a VNet subnet, internal or external ingress, DB via Private Endpoint.
What I'd do β
- Create a dedicated subnet (
/27minimum for workload profiles environments) delegated toMicrosoft.App/environments - Create the environment with
--infrastructure-subnet-resource-idand--internal-onlyif no public ingress is needed - Database Private Endpoint in the same VNet, Private DNS zone linked
- Connect the app with managed identity where the DB supports Entra auth
- If internal-only, create a Private DNS zone for the environment's default domain pointing to its static IP
Why β Workload profiles environments support UDRs and NAT Gateway, so egress control works like the rest of the spoke.
Interview tip β Mention the environment's own DNS zone for internal-only setups; it's often forgotten.
Q34 A large VNet is running out of IPs because of AKS. What are your options?
Advanced
Situation read β Pod IPs are eating the VNet. Move pods off VNet IPs.
What I'd do β
- Migrate to Azure CNI Overlay:
az aks update -g rg -n aks --network-plugin-mode overlay --pod-cidr 192.168.0.0/16(supported upgrade from flat Azure CNI and kubenet; nodes reimage) - If staying on VNet IPs, switch to dynamic pod IP allocation with separate pod subnets
- Add another address space to the VNet (
az network vnet update --address-prefixes) for new node pools - Reduce
maxPodson pools that don't need 30+
Why β Overlay cuts VNet IP use to just nodes, typically freeing thousands of addresses.
Interview tip β Mention the IP math, nodes Γ (maxPods + 1), to show you understand the cause.
Q35 You need DNS names like api.devopsshack.com to fail over between regions automatically.
Intermediate
api.devopsshack.com to fail over between regions automatically.Situation read β HTTP traffic: Front Door priority routing. Non-HTTP: Traffic Manager priority profile.
What I'd do β
- Front Door origin group with primary (priority 1) and secondary (priority 2) origins, health probes every 30s
- Custom domain
api.devopsshack.comCNAME to the Front Door endpoint - For TCP services, a Traffic Manager profile with priority routing and endpoint monitoring, CNAME to
*.trafficmanager.net - Test failover by stopping the primary origin and timing recovery
Why β Health-probed global routing removes humans from the failover path.
Interview tip β Mention DNS TTLs when using Traffic Manager; clients cache answers.
Q36 You must block a known malicious IP range from all public endpoints quickly.
Intermediate
Situation read β Block at the edge first (Front Door or App Gateway WAF custom rule), then NSGs if needed.
What I'd do β
- Add a WAF custom rule with
IPMatchand action Block at priority 1 on the WAF policy - For non-HTTP endpoints, add an NSG deny rule at low priority number or an AVNM security admin rule across VNets
- Confirm blocks in WAF logs
- Remove or review the rule after the incident
Why β WAF policies apply to every attached listener instantly; editing many NSGs by hand is slow.
Interview tip β Mention rate-limit custom rules for the next time.
Q37 An on-prem app needs to reach a VM in a spoke, but the connection hangs. Route tables look fine. What's your design checklist?
Intermediate
Situation read β Hybrid connectivity spans gateways, peerings, UDRs, firewall and NSGs. Walk the path.
What I'd do β
- Hub-spoke peering:
allowGatewayTransiton hub side,useRemoteGatewayson spoke side - On-prem routing: the spoke CIDR is advertised over BGP (check
az network vnet-gateway list-advertised-routes) - If traffic goes via the firewall, the
GatewaySubnetroute table must send the spoke CIDR to the firewall, and the spoke must return via the firewall (symmetry) - NSG on the spoke subnet allows the on-prem source range
- Firewall rule allows the flow; check firewall logs for drops
Why β Asymmetric routing (in via firewall, out direct) is the usual silent hang.
Interview tip β Draw the path out loud: on-prem β gateway β firewall β spoke and back.
Q38 You need Application Gateway to serve 30 different hostnames with TLS. How do you manage certificates?
Intermediate
Situation read β Key Vault-referenced certificates on multi-site listeners, auto-renewed.
What I'd do β
- Give App Gateway a user-assigned identity with
Key Vault Secrets Useron the vault - Store certificates in Key Vault (auto-renew via integrated CA or import from ACME tooling)
- Reference them on listeners with the versionless secret ID, so App Gateway polls and picks up renewals
- Use wildcard certs where hostnames share a domain to reduce count
Why β Versionless Key Vault references remove manual cert uploads and expired-cert outages.
Interview tip β Mention App Gateway checks Key Vault periodically (every 4 hours) for new versions.
Q39 Management asks for network traffic visibility across all VNets. What do you enable?
Beginner
Situation read β VNet flow logs plus Traffic Analytics, enforced by policy.
What I'd do β
- Enable VNet flow logs on each VNet to a regional storage account
- Turn on Traffic Analytics into the central Log Analytics workspace (10-minute interval)
- Use the built-in policy to deploy flow logs for all VNets in a region
- Build workbooks for top talkers, denied flows and internet exposure
Why β Flow logs show allowed and denied flows; Traffic Analytics turns them into queryable, geo-enriched data.
Interview tip β Mention NSG flow logs are being retired in favour of VNet flow logs.
Q40 A DDoS attack hit a competitor. Leadership asks what protects your public endpoints.
Intermediate
Situation read β Layered answer: infrastructure DDoS protection is on by default; L3/L4 enhanced protection and L7 WAF are choices.
What I'd do β
- Explain default infrastructure protection covers every public IP at platform scale
- For critical apps, enable DDoS Network Protection on the VNet (or DDoS IP Protection per IP) for adaptive tuning, attack telemetry, rapid response and cost protection
- Front Door + WAF with rate limiting and bot protection for L7 floods
- Alert on the
IfUnderDDoSAttackmetric for protected public IPs
Why β Network-layer DDoS and application-layer floods need different controls.
Interview tip β Mention the cost: DDoS Network Protection is a significant monthly fee, so justify it per workload.
AKS and Containers
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q41 You're asked to build a production AKS cluster. Walk through your key decisions.
Intermediate
Situation read β The interviewer wants the decisions and trade-offs, not a single command.
What I'd do β
- Tier and zones: Standard tier, node pools across zones 1, 2, 3
- Networking: Azure CNI Overlay with Cilium dataplane, custom VNet subnet, UDR or NAT Gateway egress
- Identity: Entra integration, Azure RBAC, local accounts disabled, workload identity + OIDC issuer
- Pools: tainted system pool (3 Γ D4s_v5), autoscaling user pools, Spot pool for batch
- Add-ons: Key Vault CSI, monitoring + Managed Prometheus, Azure Policy, app routing or App Gateway for Containers
- Upgrades: auto-upgrade
patchchannel andNodeImageOS channel inside maintenance windows - Delivery: ACR with
AcrPullfor kubelet identity, GitOps via Flux
Why β Each choice is hard to change later (networking, zones) or critical for security (identity).
Interview tip β Call out which choices are immutable after creation; that's what interviewers probe.
Q42 A team wants to deploy a new microservice to AKS that reads a database password. How do you wire secrets?
Beginner
Situation read β Key Vault + CSI driver + workload identity; no secrets in git or plain Kubernetes Secrets.
What I'd do β
- Store the secret:
az keyvault secret set --vault-name kv-shop -n db-password --value ... - Create a user-assigned identity, grant
Key Vault Secrets Useron the vault, add a federated credential forsystem:serviceaccount:shop:orders-sa - Create the ServiceAccount with
azure.workload.identity/client-idannotation - Create a
SecretProviderClasswithclientID,keyvaultName,tenantIdand the object list - Mount it in the Deployment (
csivolume, driversecrets-store.csi.k8s.io), with pod labelazure.workload.identity/use: "true"
Why β One identity per workload, revocable in Azure, auditable in Key Vault logs.
Interview tip β Mention Entra auth to the DB itself to avoid the password entirely.
Q43 You need to upgrade a production AKS cluster from 1.31 to 1.33. Plan it.
Advanced
Situation read β Two minor hops, deprecated API checks, PDB review, staged rollout.
What I'd do β
- Check removed APIs for 1.32 and 1.33 (use
kubentorpluto detect-helm, and the AKS deprecated API detection in the portal) - Upgrade dev and staging clusters first and run tests
- Prod:
az aks upgrade --control-plane-only --kubernetes-version 1.32.x, then node pools one by one with--max-surge 33% - Watch:
kubectl get nodes -w, events, error rates - Repeat for 1.33
- Have PDBs that allow at least one disruption, and quota for surge nodes
Why β Control plane first, nodes after, one minor at a time is the only supported path, and staging catches API removals.
Interview tip β Mention quota for surge nodes; upgrades fail on it more than people expect.
Q44 Pods need to scale on Service Bus queue length, not CPU. How?
Advanced
Situation read β KEDA, via the AKS add-on, with workload identity to read queue metrics.
What I'd do β
- Enable KEDA:
az aks update -g rg -n aks --enable-keda - Give a user-assigned identity
Azure Service Bus Data Owner(needed to read message counts) on the namespace, federate it to the KEDA operator service account (system:serviceaccount:kube-system:keda-operator) - Create a
TriggerAuthenticationwithpodIdentity: provider: azure-workloadand the identity client ID - Create a
ScaledObjectwith anazure-servicebustrigger,queueName,messageCount: "50",minReplicaCount: 0
Why β Workers scale with backlog, including down to zero, which saves cost on idle queues.
Interview tip β Mention KEDA creates an HPA under the hood; don't define your own HPA on the same deployment.
Q45 You need to run a GPU workload on an existing AKS cluster. What do you do?
Intermediate
Situation read β Separate GPU user node pool, tainted, scaled to zero when idle.
What I'd do β
- Check quota for the GPU family (
az vm list-usage -l centralindia | grep -i NC) - Add the pool:
az aks nodepool add -g rg --cluster-name aks -n gpu --node-vm-size Standard_NC4as_T4_v3 --node-taints sku=gpu:NoSchedule --enable-cluster-autoscaler --min-count 0 --max-count 3 - Install the NVIDIA device plugin (or GPU Operator) if the AKS GPU image doesn't handle it
- Workloads request
nvidia.com/gpu: 1with a matching toleration
Why β Taints keep regular pods off expensive GPUs; min 0 stops paying when idle.
Interview tip β Mention GPU quota is often zero by default and needs a request.
Q46 A noisy application keeps starving other workloads on shared nodes. How do you fix it?
Beginner
Situation read β Missing requests/limits and namespace controls.
What I'd do β
- Set requests and limits on the noisy deployment based on observed usage (Container Insights or Prometheus)
- Add a
ResourceQuotaandLimitRangeon its namespace - Enforce "containers must have limits" with Azure Policy or Deployment Safeguards
- If still noisy, move it to a dedicated node pool with taints and node affinity
Why β The scheduler and autoscaler only reason about requests; limits contain bursts.
Interview tip β Mention priority classes for critical workloads.
Q47 You must move an AKS workload from one cluster to a new cluster with zero downtime.
Advanced
Situation read β Blue/green at cluster level, traffic switched at the edge.
What I'd do β
- Build the new cluster from IaC, bootstrap with the same GitOps repo path
- Re-create workload identities' federated credentials for the new cluster OIDC issuer (each cluster has its own issuer URL)
- Deploy the workload; validate via a separate hostname
- Shift traffic with Front Door weights (10% β 50% β 100%) or Traffic Manager
- Keep the old cluster for a rollback window, then decommission
Why β Cluster replacement is safer than in-place upgrades for big changes (networking, OS SKU).
Interview tip β The OIDC issuer detail shows you've actually done a workload identity migration.
Q48 Developers want to pull images from Docker Hub in AKS, and builds keep hitting rate limits. What do you do?
Beginner
Situation read β Mirror public images into ACR.
What I'd do β
- Import needed base images:
az acr import -n acrshop --source docker.io/library/python:3.12-slim --image base/python:3.12-slim - Or set up an ACR cache rule (artifact cache) so
acrshop.azurecr.io/docker/library/pythonpulls through - Update Dockerfiles and manifests to use ACR paths
- Add Azure Policy allowing images only from
acrshop.azurecr.io
Why β No rate limits, faster pulls in-region, and one place to scan images.
Interview tip β Mention ACR Tasks base-image triggers to keep these mirrors patched.
Q49 You need to give a developer read-only kubectl access to one namespace.
Beginner
Situation read β With Azure RBAC enabled, assign a built-in role at namespace scope.
What I'd do β
- Assign the role:
AKS_ID=$(az aks show -g rg -n aks --query id -o tsv) az role assignment create --assignee [email protected] \ --role "Azure Kubernetes Service RBAC Reader" --scope "$AKS_ID/namespaces/shop" az role assignment create --assignee [email protected] \ --role "Azure Kubernetes Service Cluster User Role" --scope "$AKS_ID" - Developer runs
az aks get-credentialsandkubectl get pods -n shop - Confirm
kubectl get pods -n kube-systemis forbidden
Why β The Cluster User role allows downloading kubeconfig; the RBAC Reader role defines what they can see.
Interview tip β Mention both roles; missing Cluster User Role is a common confusion.
Q50 Your AKS bill doubled. Where do you look?
Intermediate
Situation read β Usually nodes (autoscaler, oversized pools), Log Analytics ingestion, or networking.
What I'd do β
- Cost analysis by meter for the node RG and the workspace
- Check autoscaler events and node count history; look for pods with huge requests preventing scale-down (
kubectl top, Container Insights) - Check Log Analytics usage:
Usage | where TimeGenerated > ago(30d) | summarize sum(Quantity) by DataType - Enable AKS cost analysis add-on for per-namespace allocation
- Fixes: right-size requests, Spot for batch, reservations for baseline, filter or Basic-plan container logs
Why β Data drives the fix; guessing leads to cutting the wrong thing.
Interview tip β Always mention Log Analytics; it's the AKS cost surprise nobody budgets for.
Q51 You need different teams to share one AKS cluster safely. How do you set up multi-tenancy?
Advanced
Situation read β Soft multi-tenancy: namespaces with RBAC, quotas, network policies, and policy enforcement.
What I'd do β
- Namespace per team per environment, Azure RBAC roles at namespace scope bound to team groups
ResourceQuotaandLimitRangeper namespace- Default-deny
NetworkPolicy(Cilium) per namespace, explicit allow for ingress controller and shared services - Pod Security Admission
restrictedlabels, Azure Policy for allowed registries - Separate workload identities per team; Key Vault per team
- Dedicated node pools with taints for teams with special needs
Why β Each layer limits a different blast radius: access, resources, network, runtime.
Interview tip β Say when you'd give separate clusters instead: hostile tenants or strict compliance boundaries.
Q52 A stateful service on AKS uses Azure Disks. A zone goes down. What happens and how do you design for it?
Advanced
Situation read β LRS disks are zonal; the pod can't reschedule to another zone with its volume.
What I'd do β
- Explain: pod stays Pending (
volume node affinity conflict) until the zone returns - Design fix: ZRS disks via a custom StorageClass (
skuName: Premium_ZRS), which can attach in any zone - Or app-level replication (a database operator with replicas per zone) using LRS disks
- Back up with Azure Backup for AKS or Velero
Why β Zone-redundant storage or replication is what makes stateful pods survive a zone loss.
Interview tip β "Volume node affinity conflict" is the phrase that shows you've hit it.
Q53 Container images must be scanned and only signed images may run in prod. How do you build it?
Advanced
Situation read β Scan in CI and registry, sign after build, verify at admission.
What I'd do β
- CI: Trivy scan, fail on critical CVEs with fixes available
- Sign with Notation using a certificate in Key Vault:
notation sign --plugin azure-kv --id <keyId> acrshop.azurecr.io/shop/web@sha256:... - Defender for Containers scans ACR images continuously
- Install Ratify on AKS with Azure Policy (the signature verification policy) to deny unsigned images
- Restrict registries to
acrshop.azurecr.iovia policy
Why β Signing proves an image came from your pipeline; admission control enforces it.
Interview tip β Sign by digest, not tag; tags are mutable.
Q54 You need to expose three services from AKS on one public IP with TLS. What do you use?
Beginner
Situation read β An ingress controller with host or path routing.
What I'd do β
- Enable the app routing add-on:
az aks approuting enable -g rg -n aks - Create Ingress resources with
ingressClassName: webapprouting.kubernetes.azure.comand host rules - Store certs in Key Vault, integrate with
az aks approuting update --enable-kv --attach-kv <kvId>, reference via annotationkubernetes.azure.com/tls-cert-keyvault-uri - DNS A records pointing at the ingress public IP (or Azure DNS integration via
az aks approuting zone add)
Why β One LB frontend, managed controller lifecycle, certificates rotated from Key Vault.
Interview tip β Mention Gateway API as the forward-looking choice.
Q55 An AKS node pool needs a different VM size. What's the safe way?
Intermediate
Situation read β VM size is mostly immutable on a pool; add a new pool and migrate.
What I'd do β
- Add a new pool with the target size, same labels/taints, across zones
- Cordon old nodes:
kubectl cordon -l agentpool=apps - Drain gradually:
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data, respecting PDBs - Verify pods are healthy on the new pool, then
az aks nodepool delete -n apps - For the default/system pool in Terraform, set
temporary_name_for_rotationand let azurerm rotate it
Why β Workloads move gradually with PDB protection; no in-place risk.
Interview tip β Newer AKS supports resizing some pools in place, but the add-and-migrate pattern works everywhere.
Q56 Your team wants to adopt GitOps on AKS. What do you set up?
Intermediate
Situation read β Flux extension or Argo CD, a repo structure per environment, CI only updates image tags.
What I'd do β
- Repo layout:
apps/base,apps/overlays/{dev,prod},clusters/{dev,prod}with Kustomizations - Install Flux via
az k8s-configuration flux create(or Argo CD via Helm) - CI builds and pushes, then opens a PR bumping the image tag in the overlay (or Flux image automation)
- Prod changes require PR approval; Flux reconciles every few minutes and reports drift
Why β Git becomes the deployment audit log, and CI no longer needs cluster credentials.
Interview tip β Highlight that CI loses kube credentials, a security win.
Q57 You need to run a nightly batch job that must not affect web pods.
Intermediate
Situation read β CronJob on a Spot pool, isolated by taints.
What I'd do β
- Add a Spot user pool with autoscaler min 0
- Create a
CronJobwithtolerationsforkubernetes.azure.com/scalesetpriority=spot:NoSchedule, anodeSelectorfor the pool,concurrencyPolicy: Forbid,backoffLimit - Make the job idempotent and checkpoint progress so evictions are survivable
- Alert on job failures via Container Insights (
KubeEventsor job status)
Why β Cheap, isolated capacity that scales to zero after the job.
Interview tip β Mention eviction handling; Spot without retries is a bug waiting.
Q58 How would you migrate from Container Apps to AKS (or the reverse) for a service?
Advanced
Situation read β Same container image; the difference is runtime config, identity, networking and scaling definitions.
What I'd do β
- Inventory: env vars, secrets (Key Vault refs), scaling rules (KEDA triggers map 1:1), ingress, Dapr components
- Translate to Kubernetes manifests or Helm: Deployment, Service, Ingress, ScaledObject, SecretProviderClass
- Recreate the managed identity federation for AKS workload identity
- Run both in parallel behind Front Door and shift traffic by weight
- Decommission after a soak period
Why β Container images are portable; platform glue isn't, so map it deliberately.
Interview tip β Mention KEDA is in both platforms, which makes scaling rules portable.
Q59 An app on AKS must call an Azure OpenAI or Storage API using its own identity. Set it up end to end.
Advanced
Situation read β Workload identity with a data-plane role on the target.
What I'd do β
az aks update -g rg -n aks --enable-oidc-issuer --enable-workload-identity(if not already)az identity create -g rg -n id-orders; grantStorage Blob Data Contributor(orCognitive Services OpenAI User) on the target- Federate:
az identity federated-credential create --identity-name id-orders -g rg --name aks-orders --issuer $(az aks show -g rg -n aks --query oidcIssuerProfile.issuerUrl -o tsv) --subject system:serviceaccount:shop:orders-sa --audiences api://AzureADTokenExchange - ServiceAccount annotated with the client ID, pod labelled
azure.workload.identity/use: "true" - Code uses
DefaultAzureCredential()
Why β No secrets, per-workload identity, works with every Azure SDK.
Interview tip β Note that changing the SA name or namespace breaks the federation subject.
Q60 Leadership asks whether you should run your database inside AKS. What's your answer?
Intermediate
Situation read β Usually no: managed databases are cheaper to operate for most teams.
What I'd do β
- Default to Azure Database for PostgreSQL Flexible Server or Azure SQL: zone-redundant HA, backups, PITR, patching
- Consider in-cluster only with an operator (CloudNativePG), skills on the team, zone-redundant storage and tested backups
- Compare cost including people time, not just compute
Why β Databases need backup, failover and patching discipline that managed services give you for free.
Interview tip β Ask "who gets paged when the in-cluster database fails over at 3 a.m.?"
Q61 You need an AKS cluster with no public egress at all for compliance. How?
Advanced
Situation read β Network isolated cluster: private cluster, private ACR as the bootstrap source, no outbound internet.
What I'd do β
- Premium ACR with Private Endpoint and an artifact cache rule for MCR
- Create the cluster with
--bootstrap-artifact-source Cache --bootstrap-container-registry-resource-id <acrId> --outbound-type none --enable-private-cluster - Private Endpoints for Key Vault, monitoring (Azure Monitor Private Link Scope)
- Node OS updates via node image upgrades only (no package mirrors from the internet)
Why β Nodes pull all bootstrap images from your registry, so nothing reaches the internet.
Interview tip β Mention AMPLS for monitoring; Container Insights needs a private path too.
Q62 A security team wants to know which pods talk to what. How do you provide it on AKS?
Advanced
Situation read β Network observability at pod level.
What I'd do β
- Enable Advanced Container Networking Services (with Cilium): Hubble flow logs and network metrics,
az aks update --enable-acns - Send flow metrics to Managed Prometheus, view in Grafana dashboards
- Use Hubble CLI/UI for live flows per namespace and dropped flows from network policies
- Feed this into default-deny network policy design
Why β You can't write good network policies without knowing current flows.
Interview tip β Connect observability to enforcement; that's the senior framing.
Q63 A Windows .NET Framework app must run on AKS. What changes?
Intermediate
Situation read β Windows node pool alongside Linux system pool.
What I'd do β
- Add a Windows pool:
az aks nodepool add -g rg --cluster-name aks -n win22 --os-type Windows --os-sku Windows2022 - Pool names for Windows max 6 characters
- Use
nodeSelector: kubernetes.io/os: windowson Windows workloads; ensure Linux workloads select Linux - Build images on
mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022matching the node OS version - Plan for larger images and slower pulls
Why β Windows containers must match the host OS version and need explicit scheduling.
Interview tip β Mention Azure CNI is required (kubenet doesn't support Windows).
Q64 You need to rotate the TLS certificate used by your AKS ingress without downtime.
Intermediate
Situation read β If the cert lives in Key Vault with CSI or app routing integration, rotation is a new version.
What I'd do β
- Import or let Key Vault renew the certificate (new version)
- The CSI driver with rotation enabled (or app routing's Key Vault sync) updates the synced Secret
- The ingress controller reloads the cert from the updated Secret
- Verify:
openssl s_client -connect shop.devopsshack.com:443 -servername shop.devopsshack.com | openssl x509 -noout -dates
Why β Versionless references and rotation polling avoid manual secret edits.
Interview tip β cert-manager with Let's Encrypt is a valid alternative; mention either.
Q65 A developer kubectl edited a production Deployment during an incident. How do you prevent drift going forward?
Intermediate
kubectl edited a production Deployment during an incident. How do you prevent drift going forward?Situation read β Humans need break-glass, not routine write access.
What I'd do β
- Developers get
Azure Kubernetes Service RBAC Readerin prod namespaces - Writes only through GitOps (Flux reverts manual changes on reconcile)
- Break-glass via a PIM-eligible group with
RBAC Writer - Alert on
kube-audit-adminlogs for writes by human users in prod
Why β GitOps makes the repo the truth; manual edits get reverted and are visible in audit.
Interview tip β Mention the follow-up: the incident fix must be committed to git.
CI/CD and IaC
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q66 Design a GitHub Actions pipeline that builds an image, pushes to ACR and deploys to AKS with no secrets.
Intermediate
Situation read β OIDC to a user-assigned identity with AcrPush and namespace-scoped AKS rights.
What I'd do β
- Identity
id-shop-ciwith federated credentialrepo:org/shop:environment:prod; roles:AcrPushon ACR,Azure Kubernetes Service Cluster User Roleon the cluster,Azure Kubernetes Service RBAC Writeron the namespace - Workflow:
permissions: id-token: write,azure/login@v2,az acr buildordocker build+az acr login+ push, tag with${{ github.sha }} - Deploy job with
environment: prod(approval),az aks get-credentials,kubelogin convert-kubeconfig -l azurecli,kubectl applyorhelm upgrade --install kubectl rollout statusas the gate
Why β Zero stored secrets, environment approvals gate prod, identity has only what it needs.
Interview tip β Use immutable tags (git SHA), never latest, in deployment manifests.
Q67 Your organisation uses Azure DevOps. Set up a secure deployment pipeline to AKS.
Intermediate
Situation read β WIF service connections, environments with checks, templates.
What I'd do β
- Create an ARM service connection with workload identity federation, scoped to the app RG, not granted to all pipelines
- Docker registry service connection for ACR (also WIF-backed)
- Environment
shop-prodwith approvals and branch control (refs/heads/main) - Pipeline:
Docker@2buildAndPush, then adeploymentjob toshop-produsingAzureCLI@2orKubernetesManifest@1 - Extend from a platform template that adds scanning stages
Why β Approvals and checks live on the resources, so a modified pipeline can't skip them.
Interview tip β Mention checks on the service connection itself, not only the environment.
Q68 You need to promote the same image from dev to staging to prod. How do you design it?
Intermediate
Situation read β Build once, promote by digest.
What I'd do β
- Build and push once with tag
sha-<commit>; record the digest - Deploy to dev automatically; run tests
- Promote to staging and prod by changing only the manifest/values reference (GitOps PR or pipeline stage), same digest
- Optionally
az acr importbetween dev and prod registries to keep prod registry isolated
Why β Rebuilding per environment can produce different artifacts; promoting the same digest means what you tested is what you ship.
Interview tip β Say "build once, deploy many" and "by digest".
Q69 Terraform state for prod is in a storage account accessible with account keys. Harden it.
Intermediate
Situation read β State contains secrets and is the keys to the kingdom. Entra auth, network isolation, recovery.
What I'd do β
- Backend
use_azuread_auth = true; grantStorage Blob Data Contributoron the container to the pipeline identity only az storage account update --allow-shared-key-access false- Enable blob versioning and soft delete;
CanNotDeletelock on the account - Private Endpoint (with private agents) or network rules limiting access
- Separate state per environment, separate identities per environment
Why β Versioning recovers from corrupted state, RBAC limits who can read secrets in state, locks stop deletion.
Interview tip β Mention state contains secrets in plaintext; that's why it's guarded.
Q70 Your team wants to move from ARM JSON templates to Bicep. How do you migrate?
Beginner
Situation read β Bicep compiles to ARM, so migration is mechanical and low risk.
What I'd do β
az bicep decompile -f azuredeploy.jsonfor each template- Clean up: modules, parameter types, remove generated noise, use symbolic references
- Run
az deployment group what-ifagainst existing environments; expect no changes - Switch pipelines to Bicep, keep the same deployment names and scopes
Why β What-if confirms the Bicep version describes the same resources before any deployment.
Interview tip β Mention decompile is "best effort"; review the output.
Q71 A pipeline needs to deploy to dev, test and prod in different subscriptions. How do you handle identities?
Advanced
Situation read β One identity per environment, each federated to its environment.
What I'd do β
- Three user-assigned identities, each with roles only in its subscription
- Federated credentials:
repo:org/shop:environment:dev,...:test,...:prod - Each workflow job sets
environment:and uses that environment'sAZURE_CLIENT_ID(stored as environment variables in GitHub) - Prod environment has required reviewers and branch restrictions
Why β A compromised dev job can't touch prod, because it can never get the prod token.
Interview tip β Environment-scoped federation is the key phrase.
Q72 The Terraform plan for a small change shows the AKS cluster will be replaced. What do you do?
Advanced
Situation read β Stop. Find the ForceNew attribute before anything else.
What I'd do β
- Read the plan line marked
# forces replacement - Common causes: provider upgrade changing defaults, case differences in IDs, changed
default_node_poolimmutable fields,dns_prefix, network profile - Fix: revert the field, add
temporary_name_for_rotationfor node pool changes, or uselifecycle { ignore_changes = [...] }for externally-managed fields - Add
prevent_destroy = trueon the cluster resource in prod - Re-run plan; proceed only when it shows in-place updates
Why β Replacing a cluster means downtime, new OIDC issuer, new IPs and lost PVs.
Interview tip β Mention prevent_destroy; it's a cheap seatbelt.
Q73 Portal changes keep drifting from Terraform. How do you get control back?
Intermediate
Situation read β Detect, decide, prevent.
What I'd do β
- Nightly
terraform plan -detailed-exitcodejob; exit code 2 posts the diff to the team channel - For each drift: codify in Terraform or revert by applying
- Reduce human write access in prod; PIM for emergencies
- Azure Policy deny/modify for the properties people keep changing (TLS version, public access)
Why β Detection alone doesn't stop drift; removing the write path does.
Interview tip β Mention terraform apply -refresh-only for accepting harmless drift into state.
Q74 You need a reusable pipeline for 50 microservices in Azure DevOps. How do you design it?
Intermediate
Situation read β Central template repo with extends templates, versioned.
What I'd do β
platform/pipeline-templatesrepo withbuild.yml,deploy-aks.yml,service.yml(extends template), tagged releases- Each service's
azure-pipelines.ymlis ~15 lines: resource reference to the template at a tag, parameters (service name, chart path) - Environments require the template via "Required template" check
- Roll out template changes by bumping the tag per service or with a bot PR
Why β One place to add security scanning or change deploy logic, enforced for prod.
Interview tip β Pinning to a tag avoids breaking 50 pipelines at once.
Q75 A deployment to App Service must have zero downtime and instant rollback.
Beginner
Situation read β Deployment slots.
What I'd do β
- Deploy to the
stagingslot (azure/webapps-deploy@v3withslot-name: staging) - Smoke test the staging URL
- Swap:
az webapp deployment slot swap -g rg -n app-shop --slot staging - Rollback: swap again
- Mark environment-specific settings as slot settings
Why β Swap warms instances before switching traffic and keeps the previous version ready in the other slot.
Interview tip β Mention swap with preview for multi-phase validation.
Q76 You must run Terraform against a private AKS cluster and private Key Vault from CI.
Advanced
Situation read β Hosted runners can't reach private endpoints. Need private runners.
What I'd do β
- Self-hosted runners/agents in a VNet with line of sight (Managed DevOps Pools for Azure DevOps, or GitHub-hosted runners with Azure private networking, or self-hosted runners on VMSS/ACA jobs)
- DNS resolution of privatelink zones from that VNet
- Same OIDC identities; no change to auth
- For one-off kubectl,
az aks command invokefrom hosted runners
Why β Private endpoints mean network access is required in addition to identity.
Interview tip β Mention GitHub's Azure private networking for hosted runners; few candidates know it.
Q77 You need to deploy infrastructure and application in one pipeline but with separate approvals.
Intermediate
Situation read β Separate stages, environments and identities.
What I'd do β
- Stage
infra-plan(Reader identity), output plan artifact - Stage
infra-applytargeting environmentinfra-prodwith platform team approval (Contributor identity) - Stage
app-deploytargeting environmentshop-prodwith app team approval (namespace-scoped identity) - Skip
infra-applywhen the plan has no changes (set an output variable fromterraform plan -detailed-exitcode)
Why β Different owners approve different risks, and each stage has only the rights it needs.
Interview tip β Conditional infra stages keep pipelines fast.
Q78 A PR changes an NSG to open port 22 to the internet. How do you catch it automatically?
Beginner
Situation read β Static analysis in PR, policy at deploy.
What I'd do β
- Run Checkov or Trivy config scanning in PR builds; both flag
0.0.0.0/0on 22/3389 - Make the check required in branch policies
- Azure Policy deny for management ports from Internet as a backstop
- Defender for Cloud recommendation alerts if anything slips through
Why β Shift left for fast feedback, enforce at ARM for certainty.
Interview tip β "Defence in depth for IaC: PR scan, policy, runtime detection."
Q79 How do you manage secrets needed by Terraform (like a DB admin password)?
Intermediate
Situation read β Avoid passing secrets around; generate and store in Key Vault, or avoid passwords.
What I'd do β
- Use
random_passwordto generate, write to Key Vault withazurerm_key_vault_secret, consumers read from Key Vault - Better: Entra-only auth on Azure SQL/PostgreSQL so no admin password exists
- Mark variables
sensitive = true; know they still land in state - Use ephemeral resources/write-only arguments (Terraform 1.10+/1.11+) where the provider supports them to keep secrets out of state
Why β Every secret in variables ends up in logs, state or both unless you design against it.
Interview tip β Mention state encryption and access as the remaining risk.
Q80 You need to apply Azure Policy definitions themselves as code. How?
Intermediate
Situation read β Policy-as-code repo, deployed by pipeline, tested in a sandbox management group.
What I'd do β
- Store definitions, initiatives and assignments in git (Bicep, Terraform
azurerm_policy_definition, or the EPAC tool) - Pipeline deploys to a test management group first, runs compliance checks
- Promote to production management groups with approval
- New deny policies start in Audit (or with
enforcementMode: DoNotEnforce)
Why β Policies can break every team at once; they deserve the same review and staging as code.
Interview tip β enforcementMode: DoNotEnforce lets you see impact without blocking.
Q81 A Helm deployment to AKS fails halfway and leaves the release in pending-upgrade. How do you make the pipeline robust?
Advanced
pending-upgrade. How do you make the pipeline robust?Situation read β Use atomic upgrades and a clear rollback.
What I'd do β
helm upgrade --install shop ./chart -n shop --atomic --timeout 10m --wait(--rollback-on-failurein Helm 4)- If stuck:
helm history shop -n shop, thenhelm rollback shop <rev> -n shop - Serialise deployments per environment (concurrency group in GitHub, exclusive lock check in Azure DevOps)
- Add readiness probes so
--waitreflects real health
Why β Atomic rollbacks avoid half-deployed releases; serialisation avoids two pipelines fighting.
Interview tip β Concurrency control is often the actual root cause.
Q82 Developers want ephemeral environments per PR on Azure. How do you build it?
Advanced
Situation read β Namespace per PR on a shared AKS cluster (cheap) or RG per PR (more isolation).
What I'd do β
- On PR open: create namespace
pr-123, deploy with Helm using the PR image, ingress hostpr-123.dev.devopsshack.com - Backing services: shared dev database with a per-PR schema, or containers in the namespace
- Comment the URL on the PR
- On PR close:
helm uninstalland delete the namespace; nightly cleanup of orphaned namespaces by label age
Why β Reviewers test real deployments; namespaces keep cost low.
Interview tip β Mention cleanup automation; orphaned environments are the cost trap.
Q83 Your pipeline's Azure login works on main but fails on pull requests. Why, and what should you do?
Intermediate
main but fails on pull requests. Why, and what should you do?Situation read β The federated subject differs on PRs (repo:org/repo:pull_request), and that's often intentional.
What I'd do β
- Decide whether PRs should have Azure access at all (plan-only, Reader)
- If yes, add a separate federated credential for
pull_requeston a Reader-only identity - Never give PR workflows deploy identities; forks can submit PRs
Why β PR code is untrusted until merged; its token should not deploy anything.
Interview tip β Saying "PRs get a read-only identity" shows security thinking.
Q84 How do you test Bicep or Terraform modules before teams consume them?
Advanced
Situation read β Static checks, then real deployments in a test subscription.
What I'd do β
- Static:
bicep lint/ PSRule for Azure,terraform validate,tflintwith azurerm ruleset, Checkov - Unit-ish:
terraform testwithcommand = planassertions - Integration:
terraform testwithcommand = applyin a sandbox subscription, assertions on outputs, auto-destroy - Publish versioned releases (Bicep registry, git tags) only after tests pass
Why β Module bugs multiply across every consumer; tests catch them once.
Interview tip β Mention PSRule for Azure; it maps to Well-Architected rules.
Q85 A deployment must be gated on error rate after release. How do you automate rollback?
Advanced
Situation read β Progressive delivery with metrics analysis.
What I'd do β
- Use Argo Rollouts or Flagger on AKS with a canary strategy
- Analysis template querying Managed Prometheus (or App Insights via a web metric) for 5xx rate and p95 latency
- Steps: 10% β analysis 5 minutes β 50% β analysis β 100%; abort and roll back on failure
- Pipeline only updates the image; rollout controller handles promotion
Why β Automated, metric-driven rollback is faster than a human watching dashboards.
Interview tip β Define the SLO-based thresholds before the tooling.
Reliability, Cost and Migration
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q86 A key customer wants a 99.99% SLA for an app currently in a single region. What do you propose?
Advanced
Situation read β Composite SLA math says single-region with several dependencies won't reach four nines.
What I'd do β
- Calculate current composite SLA (Front Door Γ App Gateway Γ AKS Γ SQL)
- Propose active-active or active-passive across two regions behind Front Door
- Zone-redundant everything within each region
- Data: Azure SQL failover groups or Cosmos DB multi-region
- Prove it with failover drills and measure RTO/RPO
Why β Parallel regions multiply failure probabilities, raising the composite SLA above any single region.
Interview tip β Do the SLA math out loud; interviewers love it.
Q87 You need to define RTO and RPO for a workload and build DR. Walk through it.
Intermediate
Situation read β Business decides RTO/RPO; you choose the pattern that meets them at acceptable cost.
What I'd do β
- Agree targets with the business (for example RTO 1 hour, RPO 15 minutes)
- Pattern: backup-restore (hours), pilot light (tens of minutes), warm standby (minutes), active-active (seconds)
- For RTO 1h/RPO 15m: warm standby in South India, IaC ready, SQL geo-replication, GZRS storage, ACR geo-replication
- Runbook and a scheduled DR drill
Why β Cost scales with tighter targets; matching pattern to target avoids overspending.
Interview tip β Mention Azure Site Recovery for VM-based workloads.
Q88 Monthly Azure spend is 30% over budget. What's your 30-day plan?
Intermediate
Situation read β Find the top spenders, take quick wins, then commit.
What I'd do β
- Cost analysis grouped by service and RG; top 10 meters
- Quick wins: delete unattached disks, idle public IPs, stopped-but-allocated VMs, old snapshots; shut down dev at night (AKS stop, VM auto-shutdown)
- Right-size via Advisor recommendations; reduce Log Analytics ingestion
- Commit: reservations/savings plans for stable baseline
- Budgets with alerts per team; tag-based showback
Why β Cleanup gives immediate savings; commitments give the largest durable discount.
Interview tip β Quantify: "Removed X, saved Y per month."
Q89 You're migrating an app from AWS to Azure. How do you plan it?
Intermediate
Situation read β Map services, rebuild IaC, migrate data, cut over with rollback.
What I'd do β
- Inventory and map: EKSβAKS, ECRβACR, RDSβAzure Database for PostgreSQL, S3βBlob, Secrets ManagerβKey Vault, ALBβApp Gateway, Route 53βAzure DNS
- Rebuild IaC in Terraform azurerm; don't translate CloudFormation literally
- Identity: IRSA β workload identity; IAM policies β RBAC data roles
- Data: Azure Database Migration Service or logical replication for PostgreSQL; AzCopy for S3 to Blob (
azcopy copy 'https://s3.amazonaws.com/bucket' 'https://acct.blob.core.windows.net/c' --recursive) - Cut over with low DNS TTLs; keep AWS running for rollback
Why β Services map closely; identity and networking differ most and need redesign, not translation.
Interview tip β Mention subnets spanning AZs and RG structure as design differences.
Q90 Dev and test environments run 24/7. How do you cut their cost?
Intermediate
Situation read β Schedule them off outside working hours.
What I'd do β
- AKS:
az aks stopnightly via a scheduled pipeline or Automation runbook; or scale user pools to zero - VMs: auto-shutdown schedules (
az vm auto-shutdown -g rg -n vm --time 2000), deallocate not just stop - Smaller SKUs and Free tier AKS in dev
- Log Analytics daily cap in dev workspaces
- Azure Dev/Test pricing on eligible subscriptions
Why β Non-prod is idle about 70% of the week; scheduling is the cheapest big win.
Interview tip β "Stopped" in the OS still bills; "deallocated" doesn't.
Q91 A region-wide Azure incident is affecting your primary region. What do you do?
Advanced
Situation read β Confirm, decide on failover with data-loss trade-off, execute the runbook.
What I'd do β
- Confirm via Service Health and your own probes; open the incident bridge
- Estimate impact and Microsoft's ETA; decide against your RTO
- Fail over: Front Door shifts automatically if probes fail; manually fail over SQL failover group and storage if needed (accept RPO)
- Scale up the secondary region
- After recovery, fail back deliberately, then run a post-incident review
Why β A clear decision point (RTO vs ETA) avoids both panic failovers and waiting too long.
Interview tip β Mention customer-initiated storage failover loses data written after last sync.
Q92 You're asked to cut Log Analytics costs by half without losing important data.
Intermediate
Situation read β Find the biggest tables, then filter, move to cheaper plans or reduce retention.
What I'd do β
Usage | where TimeGenerated > ago(30d) | summarize GB=sum(Quantity)/1000 by DataType | top 10 by GB- Container Insights: filter namespaces, disable stdout for chatty ones, lower collection interval in the DCR
- Move verbose tables (
ContainerLogV2) to the Basic plan - DCR transformations to drop debug lines
- Commitment tier if daily volume is above 100 GB
Why β A few tables are usually the majority of cost.
Interview tip β Quote the query; it shows you've actually done it.
Q93 An important VM keeps getting "unexpectedly rebooted". How do you make the workload resilient?
Intermediate
Situation read β Single VMs fail. Check Resource Health, then remove single points of failure.
What I'd do β
- Resource Health and Activity Log for platform-initiated events (host maintenance, hardware)
- Short term: Scheduled Events handling in the app, maintenance configuration for controlled windows
- Long term: two or more VMs across zones (VMSS Flexible) behind a Load Balancer
- Azure Backup and Site Recovery for DR
Why β No single VM SLA covers application availability; redundancy does.
Interview tip β Mention Scheduled Events give 15 minutes notice for most maintenance.
Q94 Your company is moving to Azure from on-prem VMware. What migration approach do you take?
Advanced
Situation read β Assess, choose a strategy per app (rehost/replatform/refactor), migrate in waves.
What I'd do β
- Azure Migrate discovery and assessment (sizing, cost, dependencies)
- Group apps into waves by dependency
- Rehost with Azure Migrate server migration (or Azure VMware Solution for a fast lift)
- Replatform easy wins: databases to managed services, web apps to App Service
- Landing zone first: networking, identity, policy, monitoring
Why β Waves reduce risk; landing zone first avoids rework.
Interview tip β Mention the "6 Rs" briefly and pick per app.
Q95 A team wants to use Azure SQL. How do you ensure it's production ready?
Intermediate
Situation read β HA, backups, security, monitoring.
What I'd do β
- Zone-redundant configuration on Business Critical or General Purpose (where supported)
- Failover group to a secondary region if DR is needed
- Entra-only authentication, managed identity for apps, Private Endpoint, public access disabled
- Backup retention and long-term retention set; test a PITR restore
- Diagnostic settings, Defender for SQL, alerts on DTU/vCore, storage and deadlocks
Why β The defaults are good but not production-grade for every requirement.
Interview tip β "Entra-only auth" removes SQL passwords entirely.
Q96 You need to reduce compute cost for a stable AKS workload by 40%. Options?
Intermediate
Situation read β Right-size first, then commit and use cheaper capacity.
What I'd do β
- Right-size requests (VPA recommendations or Prometheus data); bin-pack with fewer, larger nodes
- Arm (
Dpsv5) or AMD SKUs where images support it - 3-year reservations or savings plan for baseline nodes
- Spot pool for interruptible work
- Autoscaler profile tuned for faster scale-down
Why β Over-requested pods waste the most; commitments then discount what remains.
Interview tip β Right-size before buying reservations; otherwise you lock in waste.
Q97 A third-party audit asks how you prove encryption and access controls on Azure data.
Beginner
Situation read β Show policies, compliance reports and logs.
What I'd do β
- Azure Policy compliance for encryption, TLS, public access settings
- Defender for Cloud regulatory compliance dashboard (for example ISO 27001, PCI DSS)
- Key Vault and storage diagnostic logs showing who accessed what
- RBAC exports and PIM activation history
- Microsoft's own audit reports from the Service Trust Portal for the platform side
Why β Auditors want evidence, not descriptions; policy compliance and logs are evidence.
Interview tip β Mention the shared responsibility split.
Q98 You inherit an Azure estate with no IaC. How do you bring it under control?
Advanced
Situation read β Inventory, prioritise, import incrementally, lock down.
What I'd do β
- Inventory with Azure Resource Graph:
az graph query -q "Resources | summarize count() by type, resourceGroup" - Prioritise prod critical resources
- Export with
aztfexportper RG; clean up into modules; import blocks - Achieve "no changes" plan, then make the pipeline the only write path
- Policy for guardrails; drift detection
Why β Importing is incremental; a clean plan proves code matches reality before you depend on it.
Interview tip β Mention Resource Graph; it's the fastest way to see everything.
Q99 App Service instances keep running out of SNAT ports when calling external APIs. What do you design?
Advanced
Situation read β Outbound connection churn exhausts the limited SNAT allocation per instance.
What I'd do β
- Fix the app: reuse HTTP clients (connection pooling,
HttpClientFactoryin .NET), keep-alive - VNet integration with NAT Gateway for large SNAT capacity
- Private Endpoints for Azure services so traffic doesn't use SNAT
- Monitor "SNAT Port Exhaustion" in App Service diagnostics
Why β Code fixes reduce demand; NAT Gateway raises supply.
Interview tip β Always mention connection reuse first.
Q100 Leadership wants a "cloud-agnostic" setup across Azure and AWS. How do you respond?
Advanced
Situation read β Portability has a cost; target portability where it matters.
What I'd do β
- Clarify the goal: avoid lock-in, regulatory, negotiating power or real multi-cloud resilience
- Portable layers: containers, Kubernetes, Terraform, OpenTelemetry, GitOps
- Accept native managed services (databases, identity) where they save the most operational effort, behind clean interfaces
- Estimate the cost of lowest-common-denominator design vs exit cost
Why β Full cloud-agnosticism means not using the best features of either cloud.
Interview tip β Lead with the business goal, then the trade-off.