How to configure system and user-assigned managed identities on an Azure VM using Azure CLI

Step by step instructions for configuring system and user-assigned managed identities on an Azure VM using Azure CLI.