Home › Studies › SC-500 › Secure Compute › Container Security

Container Security

Defender for Containers · AKS access, identity and hardening · Azure Container Registry · Azure Container Instances · Azure Container Apps

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

Defender for Containers

Defender for Containers is a cloud-native solution that monitors and protects containerized assets: Kubernetes clusters, nodes, workloads, registries and images, across multicloud and on-premises environments. It covers five domains: security posture management, vulnerability assessment, run-time threat protection, software supply chain protection, and deployment and monitoring.

CapabilityAgentlessNeeds in-cluster components
Image vulnerability assessmentYesNo
Kubernetes posture assessmentYesNo
Runtime threat detectionNoYes
Control plane threat detectionYesNo

Components on AKS

Runtime protection

Data plane hardening (misconfiguration prevention)

  1. Enable Defender for Containers on the subscription. It deploys Azure Policy for Kubernetes automatically when automatic provisioning is on.
  2. If it was turned off, remediate the recommendation Azure Kubernetes Service clusters should have the Azure Policy add-on for Kubernetes installed with Fix.
  3. Wait for recommendations (this can take up to 30 minutes). Microsoft components such as the Defender sensor sit in kube-system and aren't flagged as noncompliant.
  4. Configure parameters where required: for example Container images should be deployed from trusted registries only needs a list of trusted registries, and unconfigured resources show as unhealthy. Use fully qualified image names in exclusions.
  5. Policies evaluate in audit mode by default. To enforce, set the effect to Deny on the recommendation's Take action tab (or Manage effect and parameters on the standard). Example: block privileged containers.

Vulnerability assessment

AKS: control plane access and identity

By default the Kubernetes API server uses a public IP address and an FQDN. Limit it with authorized IP ranges, or make the cluster private. Network access and authorization are separate controls: network access doesn't grant permissions to the pipeline identity.

ControlWhat it doesLimits
API server authorized IP rangesOnly the listed ranges can reach the public API server; other requests are blocked.Up to 200 ranges (API Server VNet Integration supports up to 2,000). Standard SKU load balancer only. Not usable with private clusters. Rules can take up to two minutes to propagate.
Private clusterAPI server gets internal (RFC1918) IPs; traffic between the API server and node pools stays on the private network (Private Link and a private endpoint).Authorized ranges don't apply to the private endpoint. Needs Standard Load Balancer. No Azure DevOps Microsoft-hosted agents. Deleting or modifying the private endpoint breaks the cluster.

Authentication and authorization

AKS RBAC roleAccess
Azure Kubernetes Service RBAC ReaderRead-only on most objects in a namespace. Can't view Secrets (reading them would allow privilege escalation).
Azure Kubernetes Service RBAC WriterRead/write on most objects in a namespace. Can access Secrets and run Pods as any ServiceAccount in the namespace.
Azure Kubernetes Service RBAC AdminAdmin within a namespace, including creating roles and role bindings. No write on resource quota or the namespace itself.
Azure Kubernetes Service RBAC Cluster AdminSuper-user access to any resource in all namespaces.

Workload identity

AKS: node, network, workload and secret security

AreaFacts
NodesNode authorization is enabled by default on AKS 1.24+ clusters. Nodes sit on a private subnet with no public IPs; SSH is enabled by default and reachable only on the internal IP (disabling SSH is in preview). Gen2 node VMs support Trusted Launch.
NetworkAKS manages the NIC-level NSG. With your own subnet, don't modify it; add subnet-level NSGs instead and don't block load balancer access, control plane communication or egress. Use Kubernetes network policies to limit pod-to-pod traffic.
PolicyInstall the Azure Policy add-on for AKS to apply built-in policies and initiatives.
ImagesImage Cleaner removes unused vulnerable images. Optional on AKS Standard (--enable-image-cleaner, default interval one week, minimum 24 hours, maximum three months); no Windows node pools or virtual nodes.
SecretsKubernetes Secrets are namespaced and kept in etcd; AKS supports customer-managed keys for etcd encryption at rest. The Key Vault provider for the Secrets Store CSI Driver mounts secrets, keys and certificates and supports autorotation.

Azure Container Registry

Authentication methodUseNotes
Individual Microsoft Entra identityInteractive push/pull by developers (az acr login)Token valid for 3 hours; Azure RBAC applies.
Service principalUnattended CI/CD and external pullsAzure RBAC applies; password default expiry 1 year.
Managed identityUnattended push/pull from Azure servicesAzure RBAC applies; only from services that support managed identities.
Admin userSingle user testing; portal deploy to ACI or Container AppsDisabled by default; full push and pull; one account with two regenerable passwords; no RBAC.
Token-based repository permissionsRepository-scoped tokensNon-Entra: doesn't support Entra RBAC role assignments.

Roles and permissions

Network access

SettingFacts
DefaultA registry accepts connections over the internet from hosts on any network.
IP network rules (firewall)Premium tier; up to 200 IP access rules; configured on the public endpoint and don't apply to private endpoints. Set the default action to Deny, then add rules; rules take a few minutes.
Private endpoint (Private Link)Premium tier. DNS zone privatelink.azurecr.io to resolve the registry FQDN to the private IP. Azure DevOps managed agents aren't supported: use a self-hosted agent.
Disable public network accessOverrides all firewall configurations. Trusted services such as Defender for Cloud can reach the registry only if a bypass setting is enabled. With an approved private endpoint, you can't list repositories and tags from outside the VNet.

Encryption, anonymous pull and signing

Azure Container Instances and Container Apps

Azure Container Instances (ACI)

Azure Container Apps

AreaFacts
Network typeDefault Azure network is public; to use NSGs, Application Gateway, Azure Firewall or private endpoint access you provide your own VNet, with a subnet used only by the environment. The network type can't be changed after creation.
Environment typeWorkload profiles (default): UDRs, NAT Gateway egress, private endpoints, subnet at least /27. Consumption only (legacy): none of those, subnet at least /23.
AccessibilityExternal: public virtual IP. Internal: no public endpoints, internal load balancer; public network access can't be changed to accept internet traffic. To create private endpoints, set public network access to Disabled.
IP restrictionsAllow or Deny rules in CIDR (IPv4). No rules means all inbound traffic is allowed. All rules must be the same type; delete existing deny rules before adding allow rules.
Client certificates (mTLS)clientCertificateMode: require, accept or ignore. PKCS12 certificates from a trusted CA or self-signed.
Managed identityOne system-assigned identity plus multiple user-assigned. Adding or changing an identity doesn't restart the app or create a revision. Can authenticate to a private ACR without a username and password. Init containers can't use managed identities in consumption-only and dedicated workload profile environments.
SecretsScoped to the app, not a revision. Changing a secret creates no revision and doesn't affect existing revisions: deploy a new revision or restart. Prefer Key Vault references over direct values in production. Roles with wildcard actions (Container Apps Contributor, Operator, Jobs Contributor and Operator) can read secret values via listSecrets; use a custom role to omit it.
Built-in auth (Easy Auth)Secures an external-ingress app with no code; same system as App Service. Providers: Microsoft identity platform, Facebook, GitHub, Google, X and OpenID Connect.

The Container Apps edge proxy terminates TLS. Outbound through NAT Gateway or another proxy is supported only in a workload profile environment.

CLI and PowerShell

TaskAzure CLIPowerShell
Create an AKS cluster with API server authorized IP rangesaz aks create --resource-group myResourceGroup --name myAKSCluster --vm-set-type VirtualMachineScaleSets --load-balancer-sku standard --api-server-authorized-ip-ranges 73.140.245.0/24 --generate-ssh-keysNew-AzAksCluster -ResourceGroupName myResourceGroup -Name myAKSCluster -NodeVmSetType VirtualMachineScaleSets -LoadBalancerSku Standard -ApiServerAccessAuthorizedIpRange '73.140.245.0/24' -GenerateSshKey
Update authorized IP rangesaz aks update --resource-group myResourceGroup --name myAKSCluster --api-server-authorized-ip-ranges 73.140.245.0/24Set-AzAksCluster -ResourceGroupName myResourceGroup -Name myAKSCluster -ApiServerAccessAuthorizedIpRange '73.140.245.0/24'
Disable authorized IP rangesaz aks update --resource-group myResourceGroup --name myAKSCluster --api-server-authorized-ip-ranges ""Set-AzAksCluster -ResourceGroupName myResourceGroup -Name myAKSCluster -ApiServerAccessAuthorizedIpRange ''
Create a private AKS clusteraz aks create --name <private-cluster-name> --resource-group <private-cluster-resource-group> --load-balancer-sku standard --enable-private-cluster --generate-ssh-keys-
Enable Azure RBAC for Kubernetes on an AKS Standard clusteraz aks update --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --enable-azure-rbac-
Sign in to a registry as your Entra identityaz acr login --name <acrName>Connect-AzContainerRegistry
Get a registry access token without Dockeraz acr login --name <acrName> --expose-token-
Enable the registry admin useraz acr update -n <acrName> --admin-enabled trueUpdate-AzContainerRegistry -Name <acrName> -ResourceGroupName myResourceGroup -EnableAdminUser
Enable anonymous pullaz acr update --name myregistry --anonymous-pull-enabled-
Deny registry access from all networks by defaultaz acr update --name myContainerRegistry --default-action Deny-
Disable public network access to a registryaz acr update --name myContainerRegistry --public-network-enabled false-
Assign a system-assigned identity to a container appaz containerapp identity assign --name myApp --resource-group myResourceGroup --system-assigned-

Exam Tips

Tick each tip once you can answer it without looking.

“Defender for Containers: which capabilities need no in-cluster components” → Image vulnerability assessment, Kubernetes posture assessment and control plane threat detection; only runtime threat detection needs components.. Trap: Runtime threat detection needs the Defender sensor (DaemonSet).

“Block privileged containers from being created on AKS” → Azure Policy for Kubernetes (add-on) with the policy effect set to Deny.. Trap: Policies evaluate in audit mode by default, so they only report until the effect is set to Deny.

“Non-Azure Kubernetes cluster needs Defender for Containers components” → Connect it with Azure Arc-enabled Kubernetes.. Trap: Inbound connectivity to the cluster isn't required; connections are outbound-only.

“Registry image shows no vulnerability findings and hasn't been used for months” → Pull it (or run it): images not pushed or pulled in 30 days aren't in the daily rescan.. Trap: Registry vulnerability assessment also needs Registry access enabled.

“Limit the public AKS API server to office IPs” → API server authorized IP ranges (up to 200, Standard load balancer, not with private clusters).. Trap: A private cluster is the other option; it isn't combined with authorized ranges.

“AKS API server must have no public endpoint” → Private cluster (--enable-private-cluster); resolve the private zone via 168.63.129.16.. Trap: Authorized IP ranges apply only to the public API server.

“Pipeline reaches a private cluster; hosted agents fail” → Self-hosted agent or Managed DevOps Pool with network reach to the private endpoint.. Trap: Azure DevOps Microsoft-hosted agents aren't supported with private clusters.

“Entra users get Kubernetes permissions from Azure role assignments” → Azure RBAC for Kubernetes authorization (--enable-azure-rbac), on top of managed Entra integration.. Trap: Entra integration alone gives Kubernetes RBAC bindings, and it can't be disabled afterward.

“Pods must call Key Vault without stored credentials” → Microsoft Entra Workload ID with the OIDC issuer enabled and a federated credential (max 20 per managed identity).. Trap: The virtual nodes add-on isn't supported.

“Private-network-only registry, firewall rules ignored for private clients” → Premium tier private endpoint; IP rules apply to the public endpoint only.. Trap: Disabling public access overrides the firewall; trusted services need the bypass setting.

“Customer-managed key for ACR” → Premium, only at registry creation, user-assigned identity, RSA key; can't be disabled later.. Trap: Elliptic-curve keys aren't supported, and content trust doesn't work in such a registry.

“Anonymous pull enabled but one repository must stay private” → Not possible: it applies to all repositories; keep that registry authenticated-only.. Trap: Repository-scoped permissions don't stop anonymous pulls.

“Registry admin user” → Disabled by default, single shared account with full push and pull, no RBAC.. Trap: It is needed for portal deployment to ACI or Container Apps, but use it only when necessary.

“Identity must pull images but not list the catalog” → Container Registry Repository Reader (optionally with ABAC conditions).. Trap: The Catalog Lister role lists all repositories and doesn't support ABAC.

“ACI in a virtual network has no outbound internet” → NAT gateway for outbound connectivity (the only supported configuration).. Trap: Public IPs and DNS labels aren't supported for groups in a virtual network.

“Container Apps secret changed but the app still uses the old value” → Deploy a new revision or restart the existing one.. Trap: Changing a secret doesn't create a revision or change existing ones.

“Container Apps: allow only office IPs and later add a deny rule” → Not allowed: all IP restriction rules must be the same type.. Trap: No rules at all means all inbound traffic is allowed.

Sources

Checked against Microsoft Learn on November 13, 2026.

← Server & VM SecurityApp Platform Security →