Cloud Certifications: AWS, Azure and Kubernetes · Course book
Chapter 3: Building on Azure
Microsoft Azure is the second-largest cloud platform, and the Azure Developer Associate certification, exam AZ-204, tests the skills a developer needs to build applications on it. Many ideas carry over directly from AWS, but the services have different names and some different designs. This chapter covers the areas the exam emphasises: hosting web applications, serverless functions, storage, connecting services together, security and monitoring, with the comparisons and small calculations that help when choosing between options.
How Azure is organised
Azure groups resources in a hierarchy. A subscription is a billing and access boundary. Inside it, every resource belongs to exactly one resource group, a folder-like container whose contents usually share a lifecycle: deleting the group deletes everything in it, which makes it easy to remove a whole test environment. Resources live in regions, as in AWS, and many regions contain several availability zones.
Developers work with Azure through the portal, through the Azure CLI, whose commands begin with az, through PowerShell, and through SDKs for languages such as C#, Python, Java and JavaScript. Infrastructure can be described in templates, either the JSON-based ARM format or Bicep, a more readable language that compiles to it.
| Need | AWS service | Azure service |
|---|---|---|
| Host a web app without managing servers | Elastic Beanstalk | App Service |
| Run code on events, serverless | Lambda | Azure Functions |
| Store files and objects | S3 | Blob Storage |
| Globally distributed NoSQL database | DynamoDB | Cosmos DB |
| Message queue | SQS | Service Bus queues, Storage queues |
| Store container images | ECR | Azure Container Registry |
| Store secrets and keys | Secrets Manager, KMS | Key Vault |
| Application monitoring | CloudWatch, X-Ray | Azure Monitor, Application Insights |
Hosting web applications
Azure App Service hosts web applications and APIs written in common languages, or packaged as containers, without you managing servers. Apps run on an App Service plan, which defines the region, the size of the underlying machines and the number of instances. Several apps can share one plan, and therefore its cost. Plans can scale up, to bigger machines, or scale out, to more instances, and autoscale rules can add instances when, for example, average processor use stays above 70 percent.
A standout feature is deployment slots. A slot is a separate live copy of the app with its own address, such as a staging slot alongside production. You deploy the new version to staging, test it there, and then swap the slots: the staging copy becomes production in one step, already warmed up, and if something goes wrong a second swap puts the old version back.
For containers there are lighter options. Azure Container Instances runs a single container quickly with no cluster to set up, suitable for short tasks. Azure Container Registry stores images, and can build them in the cloud. For larger systems, Azure Container Apps and Azure Kubernetes Service run many containers with scaling and orchestration.
Azure Functions
Azure Functions is Azure's serverless compute service. Each function has exactly one trigger, the event that starts it, such as an HTTP request, a timer, a new message in a queue or a new file in Blob Storage. Functions can also have bindings, declarative connections to other services that remove boilerplate code: an input binding hands the function data, such as a document from Cosmos DB, and an output binding writes the function's result somewhere, such as a queue, with no client code to write.
Functions run under one of several hosting plans. The Consumption plan scales automatically to zero and bills only for executions, but has a maximum run time and can suffer cold starts. The Premium plan keeps instances warm and allows longer runs and private networking. A Dedicated plan runs functions on an App Service plan you already pay for.
Each function app is configured through application settings, which appear to the code as environment variables, and through a host.json file that sets behaviour shared by every function in the app, such as how many queue messages to process at once. Local development uses the Azure Functions Core Tools, which run functions on your own computer with the same triggers and bindings, so code can be tested before it is deployed.
Plain functions are short-lived and stateless. Durable Functions add state and long-running workflows written as code: an orchestrator function calls activity functions in sequence or in parallel, waits for external events or for days, and its progress is saved automatically, so a workflow survives restarts. Patterns include function chaining, fan-out and fan-in, and human approval steps.
Storage and data
Blob Storage holds unstructured data in containers within a storage account. Its access tiers trade storage price against access price: Hot for frequently used data, Cool for data accessed infrequently and kept at least 30 days, and Archive, the cheapest to store, for data kept long term that can take hours to bring back online. Lifecycle management rules can move blobs between tiers automatically as they age, for example from Hot to Cool after 30 days and to Archive after a year. Access can be granted temporarily with a shared access signature, a signed link valid for a limited time and limited operations.
Cosmos DB is a globally distributed database offering several APIs, with throughput measured in request units per second, an abstraction similar to DynamoDB's capacity units. Data is spread by a partition key, which should have many distinct values, and Cosmos DB offers five consistency levels, a trade-off between freshness and speed: from strong, where every read sees the latest write, through bounded staleness, session and consistent prefix, to eventual, the fastest and least strict. The default, session consistency, guarantees that each client sees its own writes.
The difference between messages and events is worth stating precisely. A message is a request or piece of data that a sender expects a particular receiver to process, such as "charge this order", and it must not be lost. An event is a notification that something happened, such as "a file was uploaded", which any number of interested parties may react to or ignore. Service Bus and Storage queues carry messages; Event Grid and Event Hubs carry events.
Integration services connect applications. Beyond queues and events, API Management places a managed front door in front of APIs, adding authentication, rate limits and caching through policies, and Logic Apps build workflows visually from ready-made connectors.
Security and monitoring
Identities come from Microsoft Entra ID, formerly Azure Active Directory. Applications sign users in through it using standard protocols, and the Microsoft Authentication Library handles obtaining tokens. For services talking to other services, the best practice is a managed identity: Azure gives an app or function its own identity, which can be granted access to, say, a Key Vault or a storage account, with no password or key stored anywhere. Key Vault stores secrets, keys and certificates centrally, so configuration refers to vault entries rather than containing secrets.
Application Insights, part of Azure Monitor, collects requests, dependencies, exceptions and custom events from an application, shows maps of how components connect, and can run availability tests against a public address from several locations. Caching with Azure Cache for Redis, and a content delivery network for static files, round out the performance topics the exam expects.
Monitoring data is queried with the Kusto Query Language, which filters and summarises large volumes of logs in a few lines, for instance counting failed requests per minute over the last day. Alerts built on such queries notify the team when, say, the failure rate rises above a chosen level.
A quick calculation shows why scaling rules matter. If one App Service instance handles 200 requests a second comfortably and traffic peaks at 900, the plan needs 900 ÷ 200 = 4.5, so 5 instances at peak; an autoscale rule that adds instances as load rises, and removes them afterwards, avoids paying for 5 all day.
Check your understanding
- What is a resource group, and why is it convenient for test environments?
- Name the Azure equivalents of Lambda, S3 and DynamoDB.
- What happens when two deployment slots are swapped, and how is a bad release rolled back?
- What is the difference between a trigger and a binding in Azure Functions?
- Which hosting plan scales to zero, and which keeps instances warm?
- Which Blob Storage tier suits backups kept for years and rarely read? (Answer: Archive.)
- One instance handles 150 requests a second and traffic peaks at 1,000. How many instances are needed? (Answer: 1,000 ÷ 150 = 6.7, so 7.)
- Why is a managed identity safer than a connection string containing a key?
This course book is available to read online only at tech-academy.chrysolites.org.