Generate PowerShell scripts using Microsoft Copilot in Azure
Microsoft Copilot in Azure (preview) can generate PowerShell 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 PowerShell, it provides a script with the necessary cmdlets. 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 PowerShell scripts. Some prompts return a single cmdlet, 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.
- "How do I list the VMs I have running in Azure using PowerShell?"
- "Create a storage account using PowerShell."
- "How do I get all quota limits for a subscription using Azure PowerShell?"
- "Can you show me how to stop all virtual machines in a specific resource group using PowerShell?"
Examples
In this example, the prompt "How do I list all my resource groups using PowerShell?" provides the cmdlet along with information on other ways to use it.
Similarly, if you ask "How can I create a new resource group using PowerShell?", you see an example cmdlet that you can customize as needed.
You can also ask Microsoft Copilot in Azure for a script with multiple cmdlets. For example, you could say "Can you help me write a script for Azure PowerShell that can be run directly, and after creating a VM, deploy an AKS cluster on it." Copilot in Azure provides a code block that you can copy, letting you know which values to replace.
Next steps
- Explore capabilities of Microsoft Copilot in Azure.
- Learn more about Azure PowerShell.