Azure / NoOpsAccelerator

A flexible, Infrastructure-as-Code foundation that assists customers with the development and deployment of opinionated infrastructure models that are secure, well-governed, and simple to maintain.
MIT License
63 stars 32 forks source link

Mixing PoSH and CLI commands can produce unexpected results #220

Open Commochief opened 1 year ago

Commochief commented 1 year ago

Describe the bug Working thru the Demo 1 - module keeps switching between PSH and Az CLI which will not work. The context can be different between the two so it needs to offer both solutions (PoSH/CLI) completely or stick with one/other

To Reproduce Steps to reproduce the behavior:

az cloudset --name [AzureCloud | AzureGovernment] az login $context = Get-AzContext $location = [your region]

Expected behavior All commands in a given module should have both CLI and PoSH or just one of the options because the context between the two can be totally different. To do the same 'Get-Context' you would use 'az account show'

Screenshots Demo1ContextIssue

matross-ghes commented 1 year ago

We are using PowerShell with Azure CLI so we can capture the results of Get-AzContext to make the deployment a bit easier with variables. The output of AZ ACCOUNT SHOW could be used within the command, but it will be a bit messy. We can use either BASH or PowerShell, and we opt'd to use PowerShell with AZ CLI for demonstrations here. $context is then used as $context.Tenant.Id when specifying --management-group-id in the az deployment command.

The demonstrations attempt to make it known in the beginning we are using AZ CLI in PowerShell.

matross-ghes commented 1 year ago

Thanks for the additional information @Commochief ! We will implement PowerShell and change to a singular language.