Skip to content

[ARM] az deployment sub/group what-if:Add new commands to support What-If for ARM template deployment - #12942

Merged
Zunli Hu (Juliehzl) merged 34 commits into
Azure:devfrom
shenglol:arm-template-what-if
Apr 27, 2020
Merged

Zunli Hu (Juliehzl) merged 34 commits into
Azure:devfrom
shenglol:arm-template-what-if

Conversation

@shenglol

@shenglol Shenglong Li (shenglol) commented Apr 10, 2020

Copy link
Copy Markdown
Contributor

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 existing deployment sub/group create commands to allow users to review and acknowledge resource changes and execute deployment with one operation.

Here's a sample output:
image

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.

@yonzhan

Copy link
Copy Markdown
Collaborator

add to S168

@zhoxing-ms

Copy link
Copy Markdown
Contributor

Shenglong Li (@shenglol) Why doesn't az deployment mg, az deployment tenant have what-if?

@zhoxing-ms

Copy link
Copy Markdown
Contributor

I suggest that it might be better to change the PR title, like: [ARM] az deployment sub/group/... what-if:Add new commands to support What-If for ARM template deployment
PR title writing guide: link

Comment thread src/azure-cli/azure/cli/command_modules/resource/_help.py Outdated
@shenglol Shenglong Li (shenglol) changed the title [ARM] Add template deployment What-If commands [ARM] az deployment sub/group what-if:Add new commands to support What-If for ARM template deployment Apr 10, 2020
@shenglol

Shenglong Li (shenglol) commented Apr 10, 2020

Copy link
Copy Markdown
Contributor Author

Shenglong Li (@shenglol) Why doesn't az deployment mg, az deployment tenant have what-if?

Currently the What-If back-end doesn't support mg-level and tenant-level deployments. We might add the support in the future.

@shenglol

Copy link
Copy Markdown
Contributor Author

I suggest that it might be better to change the PR title, like: [ARM] az deployment sub/group/... what-if:Add new commands to support What-If for ARM template deployment
PR title writing guide: link

Thanks. I changed the title.

Comment thread src/azure-cli/azure/cli/command_modules/resource/custom.py
@shenglol

Shenglong Li (shenglol) commented Apr 17, 2020

Copy link
Copy Markdown
Contributor Author

Xing Zhou (@zhoxing-ms) Jiashuo Li (@jiasli) do you mind helping merge it once the build pipeline passes? It would be great if we can still catch the next release.

@jiasli

Copy link
Copy Markdown
Contributor

Xing Zhou (@zhoxing-ms) Jiashuo Li (@jiasli) do you mind helping merge it once the build pipe line passes? It would be great if we can still catch the next release.

Absolutely!

Comment thread src/azure-cli/azure/cli/command_modules/resource/_params.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/resource/_params.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/resource/_params.py
Comment thread src/azure-cli/azure/cli/command_modules/resource/_utils.py
Comment thread src/azure-cli/azure/cli/command_modules/resource/_params.py Outdated
@shenglol

Copy link
Copy Markdown
Contributor Author

Zunli Hu (@Juliehzl) could you take another look at the PR when you get a chance? Thanks!

@Juliehzl

Copy link
Copy Markdown
Contributor

Zunli Hu (@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 (

@Juliehzl Zunli Hu (Juliehzl) Apr 24, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shenglol Shenglong Li (shenglol) Apr 24, 2020

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants