This blog explores how the AZ-900: Microsoft Azure Fundamentals certification helps developers manage cloud resources easily with its focus on the Azure Developer CLI. Read through to learn how it simplifies workflows with text commands, making automation and monitoring effortless. Also know how it boosts productivity and streamlines project management, making Azure development more efficient.
Overview of Azure Developer CLI
The Azure Developer CLI is a cross-platform command-line tool designed to facilitate various Azure development tasks. The following diagram shows the typical set-up of the Azure Developer CLI;
As shown in the diagram above, whether you are deploying applications, managing resources, or automating workflows, the Azure Developer CLI provides a unified interface to accomplish these tasks effortlessly as follows;
- Code: Developers can write and structure applications while seamlessly integrating with other Azure services and development tools. It provides a variety of templates that are useful in creating new application projects.
- Build: Azure Developer CLI allows developers to compile and package application artifacts while streamlining the entire SDLC through the mapping commands at various stages.
- Deployment: The tool provides a repeatable path to cloud deployment while simplifying the deployment of applications to multiple environments (development, testing, production) through automation. The Azure Developer CLI streamlines the entire development lifecycle by mapping commands to critical stages.
- Provision: With the Azure Developer CLI, developers can create and update Azure resources using the provisioning functionality. This allows for efficient and effective provisioning processes with the cloud environment.
- Monitor: Developers can also monitor applications running in Azure using the azd monitor capability. It provides developer-friendly monitoring commands that map closely with developer workflows. This allows developers to dedicate more time to crafting a unique code.
Using Azure Developer CLI
Installation: To get started with the Azure Developer CLI, you need to install it on your local computer. The good thing is that the tool is available for Windows, macOS, and Linux. You simply download the installer from the official Azure website or use package managers like APT for Debian-based Linux distributions and Chocolatey for Windows Operating Systems (Oss). For instance;
- For Linux
The Linux distributions; you can install the Azure CLI by running the following command:
- curl -fsSL https://aka.ms/install-azd.sh | bash
- For Windows;
For Windows environments, you simply use the following command to install;
- winget install microsoft.azd
Initial Configuration
After installing the Azure Developer CLI, the next step is to ensure that it is properly and securely configured configure by running the following command;
- azd init -t hello-azd
Once you are successfully authenticated; you can now start using the Azure Developer CLI. The functionality will show information about your subscription. This means that if you have multiple Azure subscriptions, it becomes crucial to specify which one you want to use.
Azure Developer CLI Commands
Azure Developer CLI offers an incredible number of commands that allow you to interact with the Azure cloud environment. These include the following;
Core Features of Azure Developer CLI
The beauty about the Azure Developer CLI is that it allows you to interact with virtually all the Azure resources. To explain this let us look into some of the popular commands that you can use to streamline workflows;
- Environmental management: It is important ot be able to manage Azure environments to secure effective workflows. The functionality allows you to manage resources efficiently and effectively. The following command is used in managing environments using Azure Developer CLI;
- azd env
- Deployment automation: Automating deployments is a critical aspect of modern development workflows and the Azure Developer CLI allows you to deploy applications using templates and scripts, ensuring consistency and reducing the chances of human error. The following code is used to automate web application deployments;
- azd deploy
- Monitoring and diagnostics: Keeping track of your resources and applications is vital for maintaining their health and performance. The Azure Developer CLI provides commands to monitor usage, diagnose issues, and analyze logs. For example;
- azd monitor
- Integration with CI/CD Pipelines: Azure Developer CI supports Continuous Integration and Continuous Deployment (CI/CD) practices and a variety of languages including Python and .NET. This enables developers to automatically build and deploy pipelines. The following command is used to deploy pipelines;
- azd pipeline
- Delete Azure resources: Sometimes developers are faced with the option of deleting provisioned Azure resources for their application This following Azure Developer command can delete such resources;
- azd down
Support for Workflow Customization
The following functionalities of Azure Developer CLI can be ser to further simplify the workflows though customization processes;
- Hooks: The Azure Developer CLI supports various extension points to customize your workflows and deployments. The hooks middleware allows developers to execute custom scripts before and after azd commands and service lifecycle events. Note that hooks follow a naming convention using pre and post prefixes on the matching azd command or service event name. The following are some examples;
- Prerestore and post restore: These run before and after package dependencies are restored.
- Preprovision and post provision: These run before and after Microsoft Azure resources are created.
- Predeploy and post deploy: These are programmed to run before and after the application code is deployed to Microsoft Azure.
- Service registration: You can also configure hooks to run only for specific services defined in your .yaml file. The service directory is used as the default cwd for service hooks. It refers to the same path that is defined in the azure.yaml file representing the project property of the service configuration.
- Bicep: Azure Developer CLI uses Bicep by default to generate files you can then inspect and edit. This means that if you feel there are things missing, you can adjust to the generated files before starting the deployment. The Bicep file in question:
‘azd-custom-01’
- Compose: The Azure Developer CLI compose feature enables you to progressively compose the Azure resources required for your app without manually writing Bicep code. It introduces an option to add Azure resources to your apps and is useful for developers who want to avoid writing Bicep or using an existing template. The Azure Developer CLI compose feature supports process of adding resources to the following Azure Services:
-
- Azure Container Apps
- Azure OpenAI with Microsoft Entra ID authentication
- Azure Cosmos DB for MongoDB
- Azure Cosmos DB for PostgreSQL
Azure Developer CLI Templates
Azure Developer CLI comprises a rich curated library of templates to provide developers with a starting point that fits their project’s needs and ensure a rapid and reliable transition from code to cloud as follows;
Source: Ostrowski, Savannah. “Introducing the Azure Developer CLI (Azd): A Faster Way to Build Apps for the Cloud.”
An important point to note regarding the Azure Developer CLI templates is that they all follow a structured pattern as detailed below:
- infra folder: The infra folder contains all the Bicep or Terraform infrastructure-as-code (IaC) files that azd executes to create Azure resources required to host the application such as templates. One good aspect about infra folders is that developers are not required to include these in their templates thus simplifying development workflows.
- azure.yaml file: The azure.yaml file is a configuration file that defines one or more services in a developer’s project. It then maps these services to Azure resources for deployment. For example, a developer might want to define an API service and a web front-end service. Each of these will have attributes that map them to different Azure resources for deployment.
- .azure folder: This folder contains all the configurations and variables such as deployment locations and environment aspects that exist in the Azure developer environment. The functionality facilitates the deployment of Azure resources and other subscription information throughout the developer environment.
- src folder: The src folder contains all app service code that can be deployed in the Azure environment. Note that some azd templates only provide infrastructure assets and leave the src directory empty. In this case you need to add your own application code to facilitate deployment.
Azure Developer CLI Template Contents
The following contents of the Azure Developer CLI assist in simplifying the development workflows as well;
- Development Containers: The Azure Developer CLI templates include support for development containers. These are fully featured development environments built on Docker containers. They allow developers to easily to set up consistent development environments across teams while assisting in avoiding compatibility issues.
- Pipelines as Code: Each Azure Developer CLI template contains a default CI/CD pipeline as code supporting Azure DevOps or GitHub Actions. This functionality can be further configured by running a pipeline config command. Once the pipeline is appropriately configured, developers can automatically deploy and provision new changes to the project or infrastructure any time as changes are pushed to repositories.
- Infrastructure as Code: The Azure Developer CLI templates also support Infrastructure as code (IaC) through the use of the Bicep or Terraform functionalities. The templates include core IaC modules that are used to represent a wide range of Azure services. This capability greatly reduces the effort required by developers to create and maintain IaC thereby assisting in simplifying developer workflows.
Best Practices
The following best practices should be used when using Azure Developer CLI to achieve the required results simplifying developer workflows;
- Maintain consistency in resource naming: Use a consistent naming convention for your resources to avoid confusion and make management easier. Consider including the project name, environment, and resource type in the naming conventions.
- Use secure configuration files: Leverage configuration files to store parameters and settings for your deployments. These configuration files allow developers to easily make changes as required without affecting the developer environment.
- Use modular templates: Leverage Azure Developer CLI templates to structure infrastructure and application components modularity. This action assists in enabling reusability while ensuring consistency across projects in the Azure environment.
- Automate monitoring: Incorporating monitoring functionalities such as the Azure Monitor and Application Insights into Azure Developer CLI operations allows developers to gain visibility into application performance. This allows for the effective allocation and simplification of developer workflows.
- Secure the supply chain: It is also crucial to integrate Azure Developer CLI with security features such as the Azure Key Vault and managed identities. This approach enhances security across deployments.
Conclusion
This blog talks about how Azure Developer CLI provides an effective process that streamlines developer workflows in Azure. The tool represents a crucial improvement in simplifying application and infrastructure deployment in Azure developer environments. By using all the functionalities of Azure Developer CLI, developers can reduce the time-to-market of their products while also enhancing the security and productivity aspects of their development processes. Get access to hands-on labs and sandboxes with Whizlabs cloud resources. Talk to our experts in case of queries!
- What Are AZ-800 Key Concepts for Role-Based Access? - February 18, 2025
- Simplifying Azure Dev Workflows with the Azure Developer CLI - February 7, 2025
- MD-102:Endpoint Administrator – Syllabus Update Sept 17, 2024 - September 24, 2024
- How I Successfully Passed the AI-900 Certification Exam - September 4, 2024