Amazon Web Services and Microsoft Azure have a CLI tool that developers can use to access as well as manage their various cloud services and solutions.
Download AWS CLI: https://awscli.amazonaws.com/AWSCLIV2.msi
Download AZURE CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli
For Complete Walkthrough: https://devopsden.io/article/how-to-install-aws-cli
Prerequisites for AWS and Azure CLI Prerequisite AWS CLI Azure CLI Account AWS account Azure account Access Keys/Subscription AWS Access Keys Azure subscription Operating System Windows, macOS, Linux Windows, macOS, Linux Python Required for AWS CLI v1 (Python 2.6.5+ or 3.3+) Optional (bundled Python version available) Installation Package managers (pip, Homebrew), direct download Package managers (pip, Homebrew), installation scripts Permissions Necessary IAM permissions Necessary account permissions
Useful Azure CLI Commands Manage Resource Groups and Template Deployments Command Description az group create
Create a new resource group. az group delete
Delete a resource group. az group deployment
Manage Azure Resource Manager deployments. az group deployment cancel
Cancel a currently running template deployment. az group deployment create
Start a deployment. az group deployment delete
Delete a deployment.
Authentication Command Description az login
Log in to Azure. az logout
Log out of Azure.
Account Management Command Description az account show
Display the details of the current subscription.
Virtual Machines Command Description az vm create
Create a new virtual machine. az vm delete
Delete a virtual machine. az vm start
Start a stopped virtual machine. az vm stop
Stop a running virtual machine. az vm list
List all virtual machines in a subscription. az vm show
Show details of a specific virtual machine.
Storage Accounts Command Description az storage account create
Create a new storage account. az storage account delete
Delete a storage account. az storage account list
List all storage accounts in a subscription.
Networking Command Description az network vnet create
Create a virtual network. az network vnet delete
Delete a virtual network. az network vnet list
List virtual networks. az network nsg create
Create a network security group. az network nsg delete
Delete a network security group. az network nsg list
List network security groups.
Azure Kubernetes Service (AKS) Command Description az aks create
Create a new Azure Kubernetes Service (AKS) cluster. az aks delete
Delete an Azure Kubernetes Service (AKS) cluster. az aks list
List Azure Kubernetes Service (AKS) clusters. az aks get-credentials
Get access credentials for an AKS cluster.
Azure SQL Database Command Description az sql server create
Create a new SQL server. az sql server delete
Delete a SQL server. az sql server list
List SQL servers. az sql db create
Create a new SQL database. az sql db delete
Delete a SQL database. az sql db list
List SQL databases.
Azure App Services Command Description az webapp create
Create a new web app. az webapp delete
Delete a web app. az webapp list
List web apps. az webapp start
Start a web app. az webapp stop
Stop a web app.
Monitoring and Management Command Description az monitor metrics list
List the metric values for a resource. az monitor alert create
Create a new alert rule. az monitor alert delete
Delete an alert rule.
Useful AWS CLI Commands Authentication Command Description aws configure
Configure AWS CLI with your credentials and settings. aws sts get-caller-identity
Get details about the IAM user or role whose credentials are used to call the API.
Account Management Command Description aws iam list-users
List all IAM users in the account. aws iam create-user
Create a new IAM user. aws iam delete-user
Delete an IAM user.
S3 (Simple Storage Service) Command Description aws s3 ls
List all S3 buckets. aws s3 mb s3://<bucket-name>
Create a new S3 bucket. aws s3 rb s3://<bucket-name>
Delete an S3 bucket. aws s3 cp <source> <destination>
Copy files to and from S3 buckets. aws s3 sync <source> <destination>
Sync files and directories to and from S3 buckets.
EC2 (Elastic Compute Cloud) Command Description aws ec2 describe-instances
List all EC2 instances. aws ec2 start-instances --instance-ids <instance-id>
Start an EC2 instance. aws ec2 stop-instances --instance-ids <instance-id>
Stop an EC2 instance. aws ec2 terminate-instances --instance-ids <instance-id>
Terminate an EC2 instance. aws ec2 create-key-pair --key-name <key-name>
Create a new key pair.
RDS (Relational Database Service) Command Description aws rds describe-db-instances
List all RDS instances. aws rds create-db-instance
Create a new RDS instance. aws rds delete-db-instance --db-instance-identifier <db-instance-id>
Delete an RDS instance. aws rds start-db-instance --db-instance-identifier <db-instance-id>
Start an RDS instance. aws rds stop-db-instance --db-instance-identifier <db-instance-id>
Stop an RDS instance.
IAM (Identity and Access Management) Command Description aws iam list-users
List all IAM users. aws iam create-user --user-name <user-name>
Create a new IAM user. aws iam delete-user --user-name <user-name>
Delete an IAM user. aws iam list-roles
List all IAM roles. aws iam create-role
Create a new IAM role. aws iam delete-role --role-name <role-name>
Delete an IAM role.
Lambda Command Description aws lambda list-functions
List all Lambda functions. aws lambda create-function
Create a new Lambda function. aws lambda delete-function --function-name <function-name>
Delete a Lambda function.
CloudFormation Command Description aws cloudformation create-stack --stack-name <stack-name> --template-body <template-body>
Create a new stack. aws cloudformation delete-stack --stack-name <stack-name>
Delete a stack. aws cloudformation describe-stacks
List all stacks.
SQS (Simple Queue Service) Command Description aws sqs create-queue --queue-name <queue-name>
Create a new SQS queue. aws sqs delete-queue --queue-url <queue-url>
Delete an SQS queue. aws sqs list-queues
List all SQS queues.
SNS (Simple Notification Service) Command Description aws sns create-topic --name <topic-name>
Create a new SNS topic. aws sns delete-topic --topic-arn <topic-arn>
Delete an SNS topic. aws sns list-topics
List all SNS topics.
CloudWatch Command Description aws cloudwatch list-metrics
List CloudWatch metrics. aws cloudwatch put-metric-alarm
Create or update an alarm and associate it with the specified metric. aws cloudwatch delete-alarms --alarm-names <alarm-names>
Delete specified alarms.
Automate common tasks using Azure and AWS CLI commands Task Azure CLI AWS CLI Create VM azure vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --admin-username azureuser
aws ec2 run-instances --image-id ami-0abcdef1234567890 --count 1 --instance-type t2.micro --key-name MyKeyPair
List Resources azure resource list --resource-group myResourceGroup
aws resourcegroupstaggingapi get-resources
Upload to Storage azure storage blob upload --container-name mycontainer --file myfile.txt --name myfile.txt
aws s3 cp myfile.txt s3://mybucket/myfile.txt
Monitor Logs azure monitor activity-log list --resource-group myResourceGroup
aws logs filter-log-events --log-group-name my-log-group
Delete Resource azure resource delete --resource-group myResourceGroup --name myResource
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0
Sample Scripts Azure Script to Create and List VMs: #!/bin/bash
# Create a VM
az vm create \
--resource-group myResourceGroup \
--name myVM \
--image UbuntuLTS \
--admin-username azureuser
# List all VMs
az vm list --output table
AWS Script to Create and List EC2 Instances: #!/bin/bash
# Create an EC2 instance
aws ec2 run-instances \
--image-id ami-0abcdef1234567890 \
--count 1 \
--instance-type t2.micro \
--key-name MyKeyPair
# List all EC2 instances
aws ec2 describe-instances --output table
Common Issues with Microsoft Azure and AWS CLI Commands Issue Azure CLI Resolution AWS CLI Resolution Authentication Errors Ensure az login
is successful and check az account show
Verify aws configure
settings and IAM permissions Command Not Found Ensure Azure CLI is installed and the path is set correctly Confirm AWS CLI installation and check the PATH environment variable Insufficient Permissions Check role assignments and access policies with az role assignment list
Review IAM policies and roles using aws iam list-roles
Network Issues Verify network connectivity and configure proxies if needed Check VPC, security groups, and internet connectivity Rate Limits Implement retry logic in scripts and check Azure subscription limits Use exponential backoff in scripts and monitor AWS service limits Resource Not Found Double-check resource names and IDs; use az resource list
Verify resource IDs and names; use aws resourcegroupstaggingapi get-resources
Invalid Parameters Refer to Azure CLI documentation for correct parameters Use AWS CLI help (aws <command> help
) for correct syntax Timeouts Increase timeout settings with --timeout
option in commands Adjust timeout settings in AWS CLI configuration
Thank You
Read More
https://devopsden.io/article/what-is-microsoft-azure
Follow us on
https://www.linkedin.com/company/devopsden/