Shane Bartholomeusz

Technical Solutions Consultant

Meet the Azure CLI

Overview

There are numerous ways to manage your Azure resources, including the web-based Portal, the Azure Cloud Shell, API’s.

In this post I’ll be focusing on the Azure Command Line Interface (or CLI).

Azure Logo

Why Use the CLI?

While it’s easy enough to create and manage Azure resources through the web-portal. As the number of resources grow over time in your environment, it starts to become infeasible to manage.

Using the CLI gives you more control over your environment, many of the features and configuration options are not available in the web-based Portal. Therefore, the CLI is the tool of choice for many cloud infrastructure administrators.

Additionally, it also promotes repeatability by enabling you to script many of the common tasks you might perform regularly.

Installing the Azure CLI

To install it in a Windows environment, download and run the MSI installer package from Microsoft. Once completed, you can then run Azure CLI commands through the built-in Windows CMD prompt or PowerShell.

More information, including links to the MSI package can be found here:
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest

Authenticating with Azure

Once installed, you’ll need to authenticate to Azure using your Azure credentials.

Running the below command will launch a browser window prompting you to log into the Azure Portal. Following this, your command prompt session will be authenticated with Azure, enabling you to run commands against your Azure account.


az login

Sample Script


# Update for your admin password
AdminPassword=ChangeYourAdminPassword1

# Create a resource group.
az group create --name myResourceGroup --location westeurope

# Create a virtual network.
az network vnet create --resource-group myResourceGroup --name myVnet --subnet-name mySubnet

# Create a public IP address.
az network public-ip create --resource-group myResourceGroup --name myPublicIP

# Create a network security group.
az network nsg create --resource-group myResourceGroup --name myNetworkSecurityGroup

# Create a virtual network card and associate with public IP address and NSG.
az network nic create \
  --resource-group myResourceGroup \
  --name myNic \
  --vnet-name myVnet \
  --subnet mySubnet \
  --network-security-group myNetworkSecurityGroup \
  --public-ip-address myPublicIP

# Create a virtual machine. 
az vm create \
    --resource-group myResourceGroup \
    --name myVM \
    --location westeurope \
    --nics myNic \
    --image win2016datacenter \
    --admin-username azureuser \
    --admin-password $AdminPassword

# Open port 3389 to allow RDP traffic to host.
az vm open-port --port 3389 --resource-group myResourceGroup --name myVM

Output Formats

The CLI provides the following output formats:

JSON

Azure CLI JSON Screenshot

JSONC – Coloured JSON

Azure CLI JSONC Screenshot

YAML

Azure CLI YAML Screenshot

TSV – Tab Separated Values

Azure CLI TSV Screenshot

Table

Azure CLI Table Screenshot

Dynamics 365: System Forms Missing After Upgrade

What The?

After a recent Dynamics 365 upgrade we noticed that some Forms mysteriously vanished from our environment; we could not locate them after the upgrade.

Dynamics 365 logo
Continue reading

Explained: IaaS vs PaaS vs SaaS

So, What’s It All About?

When I first starting exploring the world of cloud, it took me a little while to fully understand the different cloud models available …. What does it all mean? What exactly is the different between Infrastructure as a Service (IaaS) vs Platform as a Service (PaaS) vs Software as a Service (SaaS)?

In this article we’ll take a deeper look at the differences IaaS vs PaaS vs SaaS cloud models – but without all the tech jargon!

Banner image
Continue reading

How to Pass: Azure AZ-900 Exam

Overview

The Microsoft Azure Fundamentals AZ-900 exam is the first stepping stone on the Microsoft Azure cloud certification pathway.

Having recently passed the AZ-900 exam I wanted to share my thoughts and insights in this AZ-900 Exam Study Guide to help others pass the exam.

Azure AZ-900 Badge
Continue reading

Solved: Excel 256 Row Limit in MS Flow

Problem

When processing Excel files containing over within Microsoft Flow, you might notice that only the first 256 rows will be returned …

What The? What’s Going On Here?

Microsoft Flow and Excel Logos
Continue reading

Handling Excel Dates in Microsoft Flow

Problem

Dealing with dates can be a real pain in the proverbial sometimes … and Microsoft Flow is no exception.

I recently had to bulk load some records from an Excel file into SharePoint Online using Microsoft Flow … you’d be forgiven to think that this would be a trivial task … WRONG!

Microsoft Flow and Excel Logos
Continue reading

How To: Set Azure App Service Time Zone

Background

We recently migrated a legacy .NET web service running on-premise to an Azure App Service. During testing we identified an issue with DateTime translations. Our application had a reference to DateTime.Now.

Previously, our app was running on-premise and therefore using Western Australia Standard Time (+8). However, following the migration to Azure, it was using UTC time by default, so we therefore needed to change the default time zone configuration.

In this post I’ll explain how you can update the time zone of your Azure App Service.

Azure App Service Logo
Continue reading

Hidden Dynamics 365 Diagnostics Console

Quick Tip

Dynamics 365 logo

Have you been in situations where your users are experiencing performance issues with Dynamics CRM that you cannot replicate?

Not many people know, but Dynamics CRM includes a hidden diagnostics page that enables you to troubleshoot client side issues including network performance issues and web browser compatibility issues.

Continue reading

MB2-716 Dynamics 365 Exam Guide

Overview

Having recently passed the MB2-716 Dynamics 365 Customization and Configuration exam, in this MB2-716 exam study guide I will share some of my thoughts and tips to help you pass the exam.

Dynamics 365 logo
Continue reading

How To: Backup Synology NAS to Azure Cloud

Overview

In this article we’ll look at how to configure your Synology NAS to backup your data to the Microsoft Azure cloud.

Backup Synology to Azure diagram
Continue reading
« Older posts

© 2020 Shane Bartholomeusz

Theme by Anders NorenUp ↑