It can add consistency and speed to deployment. Any deployment or VM creation using portal clicks can lead to human error and slower than code. With code, it is also easy to figure out what is actually done and go through the configuration setup again.
Many experts recommend code to work on the production environment because code can help to revisit configuration and redeploy the same configuration easily. It is also helpful when creating down-level environments such as DEV/QA with small changes.
Tools for Azure Programming
Azure CLI
Azure CLI(Command-Line Interface) is a cross-platform command-line tool that covers all azure resources to work with. The installation steps of Azure CLI can be found here.
PowerShell
PowerShell can interact with Azure using module Azure PowerShell Az Module. We have two options for PowerShell:
- Windows PowerShell: It is for Windows OS
- PowerShell Core: It is cross-platform so can be used on Windows, Linux, macOS and Container image
CloudShell
It is a browser-based interactive shell to manage Azure resources. With CloudShell, you can get PowerShell and Azure CLI with CloudShell without any installation or configuration on your machine. The CloudShell can be launched after logging in Azure Account so no need to worry about managing credentials for CloudShell. CloudShell works along with Azure Drive. Azure Drive contains a file system which represents Azure resources, it is very useful to navigate and discover services. Azure Drive can be passed into PowerShell cmdlets to manage operations or resources. It is important to note regarding data persistence:
-
- The timeout for inactivity in CloudShell is 20 minutes
- Data between sessions is not persistent because of the timeout, so we need to store our script in the environment. CloudShell uses Azure Files as a backend store which can be used to store data and scripts.