0

By default, when running something like az deployment group create --template-file xyz.bicep ..., bicep is in "Incremental" mode. Because of this, it might happen that things get added while they should've been simply changed.

With --mode Complete, this can be changed. But it's of course "a bit" annoying to always specify this. It might also mean, that it gets forgotten.

How can I tell the az CLI that it should, by default, work in Complete mode instead?

Alexander Skwar
  • 875
  • 1
  • 9
  • 20

1 Answers1

1

You may try to use alis like this one for instance:

New-Alias -Name "azd" az deployment group create --mode Complete

and then call just:

azd --template-file xyz.bicep
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • But that doesn't take eg. "az deployment group what-if" into consideration, does it? And it's also not present when running az from scripts. Would "azd --mode Interactive" work? Ie., would it allow me to override the Complete mode on a case by case basis? – Alexander Skwar Jun 17 '21 at 11:25
  • You can still pass another parameters like `azd --template-file xyz.bicep what-if`. However it won't allow you to override mode. For this you will be forced to use full syntax. There is no way to change default behavior and this is just workaround. However, not perfect. – Krzysztof Madej Jun 17 '21 at 11:26
  • I'm not using Powershell. Only fish shell or sometimes bash. Windows is just there to start WSL ;) And this workaround really isn't that good. Too many loopholes, too many possible issues. – Alexander Skwar Jun 17 '21 at 11:34
  • 1
    Yeah, I just notice that. (thus I deleted that comment) It would not work with cli. Sorry, I was trying to be to hurry to help you ;) – Krzysztof Madej Jun 17 '21 at 11:37
  • 2
    thanks. Let me guess - there's also no way to make "-c" ("--confirm-with-what-if") to be a default? – Alexander Skwar Jun 17 '21 at 11:43
  • You may use this in scripts but you need to be sure to call New-Aliast at the beginning. And you can for isntance create tewo aliases, one for Complete mode, and one for Inceremental. – Krzysztof Madej Jun 17 '21 at 11:43
  • Yeah, there is no options to customize defaults. You may relay on aliases, but it makes sense only to some point. Otherwise you will end up with tons of them. (you are good in guessing ;) ) – Krzysztof Madej Jun 17 '21 at 11:45