-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Draft] Support az what-if
#32138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
[Draft] Support az what-if
#32138
Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| sql server create | cmd sql server create added parameter what_if |
⚠️ util
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| what-if | cmd what-if added |
⚠️ vm
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| vm create | cmd vm create added parameter what_if |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new az what-if command that allows users to simulate Azure CLI scripts and visualize infrastructure changes before execution. The command analyzes a script file and sends it to an external service for what-if analysis.
- Adds a new
what-ifcommand to the util module - Implements script parsing and external API integration for what-if simulation
- Provides help documentation and parameter definitions for the new command
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/util/custom.py | Core implementation of the show_what_if function that reads scripts and calls external service |
| src/azure-cli/azure/cli/command_modules/util/commands.py | Command registration for the new what-if command |
| src/azure-cli/azure/cli/command_modules/util/_params.py | Parameter definition for the script path argument |
| src/azure-cli/azure/cli/command_modules/util/_help.py | Help documentation and usage examples for the command |
| src/azure-cli/azure/cli/command_modules/util/tests/latest/test_whatif_script.sh | Test script file for the what-if functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
* Add what if feature * Update src/azure-cli-core/azure/cli/core/commands/__init__.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * minor fix * Update what_if.py --------- Co-authored-by: ZelinWang <zelinwang@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az what-if--what-ifDescription
A new Azure CLI command for creating a sandboxed what-if simulation of Azure CLI scripts to visualize infrastructure changes before execution.
--script-path: Specify the path to a script file containing Azure CLI commands to be executed.--no-pretty-print: Disable pretty-printing of the output.Include pr #32131 contributed by @wangzelin007
az vm --what-ifaz sql --what-ifTesting Guide
Ensure you have run
az loginaz what-if --script-path "/path/to/your/script.shaz what-if --script-path "/path/to/your/script.sh" --subscription 00000000-0000-0000-0000-000000000000History Notes
[What-if]
az what-if: Supportaz what-if[What-if]: Support
--what-ifThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.