แก้ไข

แชร์ผ่าน


Azure CLI sample scripts

Azure CLI samples provide end-to-end scenarios for jobs to be done. This article provides an A - Z list of Azure CLI samples written for Bash environments.

Not every Azure CLI reference command is used in a sample script. For a complete list of Azure CLI commands, see the A - Z reference list. For a list of popular conceptual content for each reference group, see Azure CLI conceptual article list.

List of samples

Use these three tabs to find Azure CLI samples. List by subject area and List by reference group tabs contain the same samples. Only the sort is different. The Azure CLI samples GitHub repository tab has more samples as not every GitHub sample is used in an article.

Use this list of Azure CLI samples to find samples for the subject area that published the script. (Many Azure CLI scripts use reference commands from more than one Azure service.)

Subject area Sample name
app-service Create an App Service app with continuous deployment from an Azure DevOps repository using Azure CLI
Create an ASP.NET Core app in a Docker container in App Service from Azure Container Registry
azure-app-configuration Create an Azure App Configuration store with the Azure CLI
Delete an Azure App Configuration store with the Azure CLI
Export from an Azure App Configuration store
Import to an Azure App Configuration store
Work with key-values in an Azure App Configuration store
azure-arc Azure Resource Graph sample queries for Azure Arc-enabled Kubernetes
azure-cache-for-redis Create a Premium Azure Cache for Redis with clustering
Create an Azure Cache for Redis using the Azure CLI
Quickstart: Route Azure Cache for Redis events to web endpoint with Azure CLI
azure-devops Use Azure Devops CLI to manage variables in a variable group
azure-functions Create a function app for serverless code execution
Create a function app in a Premium plan - Azure CLI
Create a Function App in an App Service plan
Create a function app in Azure that is deployed from GitHub
Create a function app with a named Storage account connection
Create a serverless Python function app using Azure CLI
Create an Azure Function that connects to an Azure Cosmos DB
Mount a file share to a Python function app using Azure CLI
azure-monitor Create metric alert in Azure CLI
azure-signalr Create a SignalR Service
Create a SignalR Service with an App Service
Create a web app that uses SignalR Service and GitHub authentication
azure-sql-edge Install software and set up resources for the tutorial
batch CLI example: Add an application to an Azure Batch account
CLI example: Create a Batch account in Batch service mode
CLI example: Create a Batch account in user subscription mode
CLI example: Create and manage a Linux pool in Azure Batch
CLI example: Create and manage a Windows pool in Azure Batch
CLI example: Run a job and tasks with Azure Batch
cdn Create an Azure Content Delivery Network profile and endpoint using the Azure CLI
chaos-studio Use REST APIs to interact with Chaos Studio
cosmos-db Add regions, change failover priority, trigger failover for an Azure Cosmos DB account using Azure CLI
Connect an existing Azure Cosmos DB account with virtual network service endpoints using Azure CLI
Convert every Azure Cosmos DB resource from standard to autoscale throughput
Create a database and collection for API for MongoDB for Azure Cosmos DB using Azure CLI
Create a database with autoscale and shared collections for API for MongoDB for Azure Cosmos DB using Azure CLI
Create a resource lock for Azure Cosmos DB Cassandra API keyspace and table using Azure CLI
Create a resource lock for Azure Cosmos DB for Gremlin database and graph using Azure CLI
Create a resource lock for Azure Cosmos DB's API for MongoDB using Azure CLI
Create a serverless database and collection for API for MongoDB for Azure Cosmos DB using Azure CLI
Create an Azure Cosmos DB account with IP firewall using Azure CLI
Create an Azure Cosmos DB account with virtual network service endpoints using Azure CLI
Create an Azure Cosmos DB Cassandra API account, keyspace and table using Azure CLI
Create an Azure Cosmos DB Cassandra API serverless account, keyspace and table using Azure CLI
Create an Azure Cosmos DB for Gremlin account, database and graph using Azure CLI
Create an Azure Cosmos DB for NoSQL account, database and container using Azure CLI
Create an Azure Cosmos DB for NoSQL account, database, and container with autoscale
Create an Azure Cosmos DB for NoSQL serverless account, database and container using Azure CLI
Create an Azure Cosmos DB Table API account and table using Azure CLI
Create resource lock for an Azure Cosmos DB for NoSQL database and container using Azure CLI
Find an existing Azure Cosmos DB free-tier account in a subscription using Azure CLI
How to use the Azure SDK for Go with Azure Table
Quickstart: Build an API for Table app with Python SDK and Azure Cosmos DB
Throughput (RU/s) operations with Azure CLI for a database or container for Azure Cosmos DB for NoSQL
Throughput (RU/s) operations with Azure CLI for a database or graph for Azure Cosmos DB - API for Gremlin
Throughput (RU/s) operations with Azure CLI for a database or graph for Azure Cosmos DB for MongoDB
Throughput (RU/s) operations with Azure CLI for a keyspace or table for Azure Cosmos DB - API for Cassandra
Throughput (RU/s) operations with Azure CLI for a table for Azure Cosmos DB for Table
Use Azure CLI for resource lock operations on Azure Cosmos DB for Table tables
Use Azure CLI to create a API for Cassandra account, keyspace, and table with autoscale
Use Azure CLI to create a API for Gremlin account, database, and graph with autoscale
Use Azure CLI to create a Gremlin serverless account, database, and graph
Use Azure CLI to create an Azure Cosmos DB for Table account and table with autoscale
Use Azure CLI to create an Azure Cosmos DB for Table serverless account and table
Work with account keys and connection strings for an Azure Cosmos DB account using Azure CLI
devtest-labs Azure CLI Samples for Azure DevTest Labs
event-grid Create custom topic and subscribe to events for an Azure subscription with Azure CLI
frontdoor Azure Front Door: Deploy custom domain
governance Azure Resource Graph sample queries for Azure Policy
Azure Resource Graph sample queries for management groups
hdinsight Azure HDInsight: Azure CLI samples
logic-apps Azure CLI script sample - create a logic app
mariadb Create a MariaDB server and configure a firewall rule using the Azure CLI
Create a MariaDB server and configure a vNet rule using the Azure CLI
Enable and download server slow query logs of an Azure Database for MariaDB server using Azure CLI
List and update configurations of an Azure Database for MariaDB server using Azure CLI
Monitor and scale an Azure Database for MariaDB server using Azure CLI
Restore an Azure Database for MariaDB server using Azure CLI
mysql Configure audit logs on Azure Database for MySQL - Flexible Server using Azure CLI
Configure same-zone high availability in Azure Database for MySQL - Flexible Server using Azure CLI
Configure slow query logs on an Azure Database for MySQL - Flexible Server instance using Azure CLI
Configure zone-redundant high availability in an Azure Database for MySQL - Flexible Server instance using Azure CLI
Create a MySQL server and configure a firewall rule using the Azure CLI
Create an Azure Database for MySQL - Flexible Server database in a VNet using Azure CLI
Create an Azure Database for MySQL - Flexible Server instance and enable public access connectivity using Azure CLI
Create and manage read replicas in Azure Database for MySQL - Flexible Server using Azure CLI
Enable and download server slow query logs of an Azure Database for MySQL server using Azure CLI
List and change server parameters of Azure Database for MySQL - Flexible Server using Azure CLI
List and update configurations of an Azure Database for MySQL server using Azure CLI
Monitor and scale an Azure Database for MySQL - Flexible Server instance using Azure CLI
Monitor and scale an Azure Database for MySQL server using Azure CLI
Restart/stop/start an Azure Database for MySQL - Flexible Server instance using Azure CLI
Restore an Azure Database for MySQL - Flexible Server instance using Azure CLI
Restore an Azure Database for MySQL server using Azure CLI
postgresql Create an Azure Database for PostgreSQL - Flexible Server instance and configure a firewall rule using the Azure CLI
Create an Azure Database for PostgreSQL - Flexible Server instance and configure a vNet rule using the Azure CLI
Enable and download server slow query logs of an Azure Database for PostgreSQL - Flexible Server instance using Azure CLI
List and update configurations of an Azure Database for PostgreSQL - Flexible Server instance using Azure CLI
Monitor and scale a single Azure Database for PostgreSQL - Flexible Server instance using Azure CLI
Restore an Azure Database for PostgreSQL - Flexible Server instance using Azure CLI
service-fabric Create a secure Service Fabric Linux cluster via the Azure CLI
service-health Azure Resource Graph sample queries for Azure Service Health
sql-server Add a database to a failover group using the Azure CLI
Add an Azure SQL Database elastic pool to a failover group using the Azure CLI
Azure CLI script to enable transparent data encryption using your own key
Backup an Azure SQL single database to an Azure storage container using the Azure CLI
Configure a failover group for a group of databases in Azure SQL Database using the Azure CLI
Configure active geo-replication for a pooled database in Azure SQL Database using the Azure CLI
Configure active geo-replication for a single database in Azure SQL Database using the Azure CLI
Copy a database in Azure SQL Database to a new server using the Azure CLI
Create a single database and configure a firewall rule using the Azure CLI
Create an Azure SQL Managed Instance using the Azure CLI
Import a BACPAC file into a database in SQL Database using the Azure CLI
Monitor and scale a single database in Azure SQL Database using the Azure CLI
Move a database in SQL Database in a SQL elastic pool using the Azure CLI
Restore a single database in Azure SQL Database to an earlier point in time using the Azure CLI
Scale an elastic pool in Azure SQL Database using the Azure CLI
storage Calculate the size of a Blob storage container
Create a storage account and rotate its account access keys
Use an Azure CLI script to delete containers based on container name prefix
virtual-machines Azure Resource Graph sample queries for Azure Virtual Machines
Copy managed disks to same or different subscription with CLI
Copy snapshot of a managed disk to same or different subscription with CLI
Create a managed disk from a snapshot with CLI (Linux)
Create a managed disk from a VHD file in a storage account in the same subscription with CLI (Linux)
Create a virtual machine from a snapshot with CLI
Create a virtual machine using an existing managed OS disk with CLI
Export/Copy a managed disk to a storage account using the Azure CLI
Export/Copy a snapshot to a storage account in different region with CLI
Move a Marketplace Azure Virtual Machine to another subscription