Generate Azure CLI scripts using Microsoft Copilot in Azure

Microsoft Copilot in Azure (preview) can generate Azure CLI scripts that you can use to create or manage resources.

When you tell Microsoft Copilot in Azure about a task you want to perform by using Azure CLI, it provides a script with the necessary commands. You'll see which placeholder values that you need to update with the actual values based on your environment.

Tip

You can also get help from Copilot in Azure directly from your command-line interface.

Note

The tasks and sample prompts listed here show a few of the areas where Microsoft Copilot in Azure (preview) can be especially helpful. However, this is not a complete list of all the things you can do. We encourage you to experiment with your own prompts and see how Microsoft Copilot in Azure (preview) can help you manage your Azure resources and environment.

Important

Microsoft Copilot in Azure (preview) is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Sample prompts

Here are a few examples of the kinds of prompts you can use to generate Azure CLI scripts. Some prompts will return a single command, while others provide multiple steps walking through the full scenario. Modify these prompts based on your real-life scenarios, or try additional prompts to create different kinds of queries.

  • "Give me a CLI script to create a new storage account"
  • "How do I list all my VMs using Azure CLI?"
  • "Create a virtual network with two subnets using the address space of 10.0.0.0/16 using az cli"
  • "I need to assign a dns name to a vm using a script"
  • "How to attach a disk to a VM using az cli"
  • "How to create and manage a Linux pool in Azure Batch using cli"
  • "Show me how to back up and restore a web app from a backup using cli"
  • "Create VNet service endpoints for Azure Database for PostgreSQL using CLI"
  • "I want to create a function app with a named storage account connection using Azure CLI"
  • "How to create an App Service app and deploy code to a staging environment using CLI"
  • "I want to use Azure CLI to deploy and manage AKS using a private service endpoint."

Examples

In this example, the prompt "I want to use Azure CLI to create a web application" provides a list of steps, along with the necessary Azure CLI commands.

Screenshot of Microsoft Copilot in Azure providing Azure CLI commands to create a web app.

When you follow that request with "Provide full script", the commands are shown together in one script.

Screenshot of Microsoft Copilot in Azure providing a full Azure CLI script to create a web app.

You can also start off by letting Microsoft Copilot in Azure know that you want the commands all together. For example, you could say "I want a script to create a low cost VM (all in one codeblock for me to copy and paste)".

Screenshot of Microsoft Copilot in Azure providing an Azure CLI script to create a VM.

Next steps