Security Best Practices
Most cloud incidents come from configuration mistakes, not clever hacking. A short checklist prevents the common ones.
On this page · 5 min · Advanced
On this page
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Advanced
- Updated
- Oct 29, 2026
Related tutorials
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#
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
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#
- Force HTTPS and modern TLS on the web app.
- Disable FTP, which sends credentials in clear text.
- Block anonymous and key-based storage access.
- Make SQL private once a private endpoint exists.
- 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#
Use Contributor or narrower roles; use Privileged Identity Management for temporary elevation.
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
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#
Which service gives a security score and prioritised recommendations?
Want more? Practise all Microsoft Azure MCQs · Microsoft Azure interview questions
My notes#
Saved in this browser.