Microsoft Azure · Delivery

Security Best Practices

Most cloud incidents come from configuration mistakes, not clever hacking. A short checklist prevents the common ones.

Advanced 5 min Lesson 27 of 28
0/28 in Microsoft Azure
On this page · 5 min · Advanced

Learning objectives#

  • Secure identities with MFA and least privilege
  • Remove secrets with managed identities and Key Vault
  • Reduce network exposure
  • Use Defender for Cloud recommendations

Explanation#

Identity is the new perimeter: require MFA, use groups and least-privilege roles, and review access regularly.

Remove credentials from code with managed identities; keep unavoidable secrets in Key Vault.

Reduce exposure: disable public access on databases and storage, use private endpoints, restrict management ports and enforce HTTPS/TLS 1.2+.

Microsoft Defender for Cloud scores your security posture and lists prioritised recommendations. Azure Policy can enforce rules automatically.

Code example: Quick hardening commands#

ShellQuick hardening commands Illustrative
az webapp update -g rg-shop-prod -n app-shop-api --https-only true
az webapp config set -g rg-shop-prod -n app-shop-api --min-tls-version 1.2 --ftps-state Disabled
az storage account update -g rg-shop-prod -n stshop12345 --allow-blob-public-access false --allow-shared-key-access false
az sql server update -g rg-shop-prod -n sql-shop --set publicNetworkAccess=Disabled   # after adding a private endpoint
az security assessment list --query "[?status.code=='Unhealthy'].displayName" -o tsv | head -n 10
Expected output
The app accepts only HTTPS with TLS 1.2+, FTP deployment is off, storage requires Entra ID, the database is private, and the top Defender for Cloud findings are listed.

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. Force HTTPS and modern TLS on the web app.
  2. Disable FTP, which sends credentials in clear text.
  3. Block anonymous and key-based storage access.
  4. Make SQL private once a private endpoint exists.
  5. Review outstanding Defender recommendations.

Real-world use case#

Before launch, a team walks through this checklist and fixes every high-severity Defender for Cloud recommendation.

Common mistakes#

Owner role for daily work

Use Contributor or narrower roles; use Privileged Identity Management for temporary elevation.

Secrets in source control

Scan repositories (GitHub secret scanning) and rotate anything leaked immediately.

Best practices#

  • MFA for every account
  • Managed identities instead of secrets
  • Private endpoints and no public data stores
  • Act on Defender for Cloud recommendations

Remember this#

Identity first: MFA + least privilege.

No secrets: managed identity + Key Vault.

Nothing public that does not need to be.

Practice exercise#

Your task: List three settings you would check on a production storage account.

Show solution
Text Illustrative
1. Public blob access disabled
2. Shared key access disabled (Entra ID only)
3. Minimum TLS 1.2 and secure transfer required (plus soft delete enabled)

Mini quiz#

Security Best Practices quizMultiple choice Question 1 of 1

Which service gives a security score and prioritised recommendations?

Score so far: 0/0

Want more? Practise all Microsoft Azure MCQs · Microsoft Azure interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.