-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[ARM] az deployment sub/group what-if:Add new commands to support What-If for ARM template deployment #12942
Conversation
add to S168 |
@shenglol Why doesn't |
I suggest that it might be better to change the PR title, like: |
Currently the What-If back-end doesn't support mg-level and tenant-level deployments. We might add the support in the future. |
Thanks. I changed the title. |
@zhoxing-ms @jiasli do you mind helping merge it once the build pipeline passes? It would be great if we can still catch the next release. |
Absolutely! |
@Juliehzl could you take another look at the PR when you get a chance? Thanks! |
LGTM in general but curious about the fantastic function you add. 😊 |
|
||
import unittest | ||
|
||
from azure.mgmt.resource.resources.models import ( |
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.
We also need to use get_model() here.
Can you use mock() to test as shown here https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py#L85?
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.
Replaced import
with get_model()
. Regarding using mock()
, I don't think it's needed in the formatters unit tests (since there's no dependencies to assert/verify), but I added two tests with mocks to verify prompt logic with -confirm-with-what-if
, which seems to be worth testing to me: https://github.com/Azure/azure-cli/pull/12942/files#diff-a94496ee0aa9c24d38ce3e3e2793c8a2R337-R358.
Description of PR (Mandatory)
The PR adds new commands for ARM template deployment What-If (in preview):
az deployment sub what-if
az deployment group what-if
which can tell users what will happen when they deploy a template if it is valid.
A new flag
--confirm-with-what-if
was also added to the existingdeployment sub/group create
commands to allow users to review and acknowledge resource changes and execute deployment with one operation.Here's a sample output:

Testing Guide
(Example commands with explanations)
History Notes:
(Fill in the following template if multiple notes are needed, otherwise PR title will be used for history note.)
[ARM] Add template deployment What-If commands
This 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.