azure — Cursor rule: Azure Well-Architected in practice
A Cursor rule that sets code and infrastructure requirements for Azure: IaC, security, cost control. Useful when your project runs on Azure.
.cursor/rules/azure.mdcWhat azure does
The rule gives the agent a frame for Azure work. Inside are requirements drawn from the Azure Well-Architected Framework (cost optimization, security, reliability, performance efficiency, operational excellence) and the Microsoft Cloud Adoption Framework for governance. The agent keeps those principles in mind while writing code and describing infrastructure.
The central demand is to define infrastructure as code rather than clicking it together. Modular Bicep or Terraform modules instead of monolithic ARM templates and one oversized file: pieces get reused and the style stays consistent. Bad and good examples sit right in the rule text, so the agent can see the target.
The rule loads from .cursor/rules/azure.mdc with a **/* scope, so it covers the whole project. If you run a multi-cloud setup, or your infrastructure already lives in a monolithic template you have no plans to touch, the rule will argue with your code — that is a reason to either move templates toward modules or narrow the rule's scope.
What it helps with
- split an Azure ARM template into Bicep modules
- check code against Well-Architected Framework principles
- move resource configuration into reusable Terraform modules
- bake security and cost optimization into the code as it is written
- bring scattered ARM templates under one style
Example prompts for the agent
- Break this ARM template into Bicep modules
- Check my code against the Azure Well-Architected Framework
- Describe this service in Terraform modules instead of one file
How to install azure
Manually: put the files in place
.cursor/rules/azure.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/azure.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/azure.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/azure.mdManually: put the files in place
.clinerules/azure.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about azure
How do I install azure in Cursor?
Create a .cursor/rules/azure.mdc file at the root of your project and paste the rule contents into it.
What does the azure rule do?
It sets requirements for building and running applications on Azure: infrastructure as code, modularity, and the principles of the Well-Architected Framework and Cloud Adoption Framework.
Which files does the rule apply to?
The scope is **/*, so it applies to the entire project.
Source text
azure.mdc · CC0-1.0
---
description: Definitive guidelines for developing, deploying, and operating applications on Azure, focusing on Well-Architected Framework principles, secure coding, and efficient resource management.
globs: **/*
---
# Azure Best Practices
This guide provides opinionated, actionable best practices for developing and operating solutions on Azure. It emphasizes the **Azure Well-Architected Framework** (Cost Optimization, Security, Reliability, Performance Efficiency, Operational Excellence) and the **Microsoft Cloud Adoption Framework** (CAF) for governance. Adhere to these standards to build robust, secure, and cost-effective cloud-native applications.
## 1. Code Organization and Structure
**Always use Infrastructure-as-Code (IaC) for Azure resource deployment.** Prefer modular, reusable components.
### 1.1. Modular IaC with Bicep or Terraform
Break down infrastructure into logical, reusable modules. This improves maintainability, reusability, and enforces consistency.
❌ BAD: Monolithic ARM templates or single large Bicep/Terraform files.
```bicep
// main.bicep - too many resources, hard to manage
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
// ... all storage config
}
resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = {
// ... all app service plan config
}
// ... many more resources
```
✅ GOOD: Modular Bicep (or Terraform modules).
```bicep
// main.bicep
module storage '
© sanjeed5 · CC0-1.0 · sanjeed5/awesome-cursor-rules-mdc