Azure Core Concepts
Understand Azure's fundamental concepts: subscriptions, resource groups, regions, and how they work together.
What you'll accomplish
Clear understanding of Azure architecture and resource organization
Prerequisites
- Azure account created
- Azure CLI installed
Azure Resource Hierarchy
Azure organizes resources in a hierarchy:
Management Groups (optional)
└── Subscriptions
└── Resource Groups
└── Resources (VMs, databases, apps)
Understanding this hierarchy is essential for managing Azure effectively.
Subscriptions
A Subscription is the billing and access boundary.
What a Subscription Provides
| Aspect | Description |
|---|---|
| Billing | Separate invoice, payment method |
| Access control | RBAC applied at subscription level |
| Limits | Service quotas and limits |
| Isolation | Resources in different subscriptions are isolated |
Common Subscription Patterns
Organization
├── Subscription: Production
│ └── Production resources
├── Subscription: Development
│ └── Development/testing resources
└── Subscription: Sandbox
└── Experimentation
Managing Subscriptions
bash# List subscriptions az account list --output table # Set active subscription az account set --subscription "Production" # Get current subscription az account show --query name --output tsv
Resource Groups
A Resource Group is a container for related resources.
Key Characteristics
- Logical grouping - Group resources that share lifecycle
- Region-based - Resource group has a location
- Deletion - Delete group = delete all resources
- Access control - Apply RBAC at group level
- Tags - Apply tags to all resources
Best Practices
# By application and environment
myapp-production-rg
myapp-staging-rg
myapp-development-rg
# By component
myapp-web-rg
myapp-database-rg
myapp-storage-rg
# By lifecycle
myapp-persistent-rg (database, storage)
myapp-compute-rg (VMs, app services - can recreate)
Managing Resource Groups
bash# Create resource group az group create --name myapp-prod-rg --location eastus # List resource groups az group list --output table # Show resources in group az resource list --resource-group myapp-prod-rg --output table # Delete resource group (and all resources!) az group delete --name myapp-prod-rg --yes --no-wait # Export template (Infrastructure as Code) az group export --name myapp-prod-rg > template.json
Tags
Organize resources with metadata:
bash# Tag resource group az group update --name myapp-prod-rg --tags Environment=Production Team=Backend # Tag individual resource az resource tag --tags Environment=Production --ids RESOURCE_ID # Find resources by tag az resource list --tag Environment=Production --output table
Regions and Availability
Azure Regions
Azure has 60+ regions worldwide:
bash# List all regions az account list-locations --output table
Common Regions
| Region | Location | Notes |
|---|---|---|
eastus | Virginia, USA | Lowest cost, most services |
eastus2 | Virginia, USA | Paired with Central US |
westus2 | Washington, USA | US West |
westeurope | Netherlands | European workloads |
northeurope | Ireland | GDPR-friendly |
southeastasia | Singapore | Asia Pacific |
Availability Zones
Zones provide high availability within a region:
Region: East US
├── Zone 1 (separate datacenter)
├── Zone 2 (separate datacenter)
└── Zone 3 (separate datacenter)
Not all regions have availability zones.
Region Pairs
Azure pairs regions for disaster recovery:
| Region | Paired Region |
|---|---|
| East US | West US |
| West Europe | North Europe |
| Southeast Asia | East Asia |
Azure Services Overview
Compute Services
| Service | Best For | Management |
|---|---|---|
| App Service | Web apps, APIs | Fully managed |
| Container Apps | Microservices, containers | Serverless |
| Functions | Event-driven code | Serverless |
| Virtual Machines | Full control needed | Self-managed |
| AKS | Kubernetes workloads | Managed K8s |
Storage Services
| Service | Best For |
|---|---|
| Blob Storage | Files, images, backups |
| File Storage | Shared file systems |
| Queue Storage | Message queuing |
| Table Storage | NoSQL key-value |
Database Services
| Service | Type |
|---|---|
| Azure SQL | Managed SQL Server |
| Cosmos DB | Global NoSQL |
| PostgreSQL | Managed PostgreSQL |
| MySQL | Managed MySQL |
Azure Resource Manager (ARM)
ARM is the deployment and management layer for Azure.
How ARM Works
User/Script → ARM → Resource Providers → Resources
│
├── Authentication (Azure AD)
├── Authorization (RBAC)
└── Deployment (Templates)
Resource Providers
Each service has a resource provider:
| Provider | Service |
|---|---|
Microsoft.Web | App Service, Functions |
Microsoft.Compute | VMs, Disks |
Microsoft.Storage | Storage accounts |
Microsoft.Sql | Azure SQL |
Microsoft.ContainerRegistry | Container Registry |
bash# Register provider az provider register --namespace Microsoft.Web # Check registration az provider show --namespace Microsoft.Web --query registrationState
Identity and Access Management
Azure Active Directory (Azure AD)
Azure AD is the identity service:
- User authentication
- Application registration
- Multi-factor authentication
- Single sign-on
Role-Based Access Control (RBAC)
RBAC controls who can do what:
Principal (Who) + Role (What) + Scope (Where)
Built-in Roles
| Role | Description |
|---|---|
| Owner | Full access, including managing access |
| Contributor | Create and manage resources |
| Reader | View resources only |
| User Access Admin | Manage user access |
Service-Specific Roles
| Role | Scope |
|---|---|
| Website Contributor | Web apps |
| SQL DB Contributor | SQL databases |
| Storage Blob Data Contributor | Blob storage |
| Virtual Machine Contributor | VMs |
Managing RBAC
bash# List role assignments for resource group az role assignment list --resource-group myapp-prod-rg --output table # Assign role az role assignment create \ --assignee [email protected] \ --role "Contributor" \ --resource-group myapp-prod-rg # Remove role az role assignment delete \ --assignee [email protected] \ --role "Contributor" \ --resource-group myapp-prod-rg
Service Principals
For applications and automation:
bash# Create service principal az ad sp create-for-rbac --name "myapp-deploy" # Output includes: # - appId (client ID) # - password (client secret) # - tenant
Managed Identities
Avoid storing credentials by using managed identities.
System-Assigned Identity
Created and managed by Azure:
bash# Enable on App Service az webapp identity assign --name myapp --resource-group myapp-rg
User-Assigned Identity
Created by you, can be shared:
bash# Create identity az identity create --name myapp-identity --resource-group myapp-rg # Assign to App Service az webapp identity assign \ --name myapp \ --resource-group myapp-rg \ --identities myapp-identity
Grant Access
bash# Grant storage access to managed identity az role assignment create \ --assignee IDENTITY_PRINCIPAL_ID \ --role "Storage Blob Data Contributor" \ --scope /subscriptions/.../resourceGroups/.../providers/Microsoft.Storage/storageAccounts/mystorageacct
Networking Basics
Virtual Networks (VNet)
Private networks in Azure:
bash# Create VNet az network vnet create \ --name myapp-vnet \ --resource-group myapp-rg \ --address-prefix 10.0.0.0/16 \ --subnet-name default \ --subnet-prefix 10.0.1.0/24
Subnets
Subdivisions of VNets:
bash# Create subnet az network vnet subnet create \ --name app-subnet \ --resource-group myapp-rg \ --vnet-name myapp-vnet \ --address-prefixes 10.0.2.0/24
Network Security Groups (NSG)
Control inbound/outbound traffic:
bash# Create NSG az network nsg create --name myapp-nsg --resource-group myapp-rg # Add rule to allow HTTP az network nsg rule create \ --nsg-name myapp-nsg \ --resource-group myapp-rg \ --name AllowHTTP \ --priority 100 \ --access Allow \ --protocol Tcp \ --direction Inbound \ --destination-port-ranges 80
Quotas and Limits
Azure enforces limits per subscription:
bash# View compute quotas az vm list-usage --location eastus --output table # View network quotas az network list-usages --location eastus --output table
Request Quota Increase
- Go to Subscriptions → Usage + quotas
- Select the quota to increase
- Click Request increase
- Submit with business justification
Cost Management
View Costs
bash# Get resource costs (preview) az consumption usage list \ --start-date 2024-01-01 \ --end-date 2024-01-31 \ --output table
Cost-Saving Options
| Option | Savings | Commitment |
|---|---|---|
| Reserved Instances | Up to 72% | 1-3 years |
| Spot VMs | Up to 90% | Can be evicted |
| Dev/Test Pricing | Up to 55% | Dev subscriptions |
| Hybrid Benefit | Up to 40% | Existing licenses |
Putting It Together
A typical deployment structure:
Subscription: Production
└── Resource Group: myapp-prod-rg
├── App Service Plan: myapp-plan
│ └── App Service: myapp-web
├── Azure SQL Server: myapp-sql
│ └── Database: myapp-db
├── Storage Account: myappstorage
│ └── Container: uploads
└── Key Vault: myapp-secrets
├── Secret: DatabasePassword
└── Secret: APIKey
bash# Create complete setup RESOURCE_GROUP="myapp-prod-rg" LOCATION="eastus" # Create resource group az group create --name $RESOURCE_GROUP --location $LOCATION # Create App Service plan az appservice plan create \ --name myapp-plan \ --resource-group $RESOURCE_GROUP \ --sku B1 \ --is-linux # Create web app az webapp create \ --name myapp-web \ --resource-group $RESOURCE_GROUP \ --plan myapp-plan \ --runtime "NODE:20-lts" # Create storage account az storage account create \ --name myappstorage \ --resource-group $RESOURCE_GROUP \ --sku Standard_LRS # Create Key Vault az keyvault create \ --name myapp-secrets \ --resource-group $RESOURCE_GROUP \ --location $LOCATION
Note
Checkpoint: Create a resource group, understand how subscriptions and resource groups work together, and list your current Azure resources using az resource list.