Azure / ALZ-Bicep

This repository contains the Azure Landing Zones (ALZ) Bicep modules that help deliver and deploy the Azure Landing Zone conceptual architecture in a modular approach. https://aka.ms/alz/docs
MIT License
742 stars 495 forks source link

Invalid argument in the management group deployment examples #680

Closed sergey-netdev closed 9 months ago

sergey-netdev commented 9 months ago

What happened? Provide a clear and concise description of the bug, including deployment details.

Attempt to execute the deployment command causes the error.

unrecognized arguments: --management-group-id alz

It appears there is no --management-group-id argument in the latest version (2.53.1) of az deployment tenant create. https://github.com/Azure/ALZ-Bicep/tree/main/infra-as-code/bicep/modules/managementGroups

Please provide the correlation id associated with your error or bug.

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

What was the expected outcome?

Successful deployment

Relevant log output

PS C:\projects\ABC\bicep\modules\managementGroups> az deployment tenant create --name ${NAME} --location $LOCATION --template-file $TEMPLATEFILE --parameters $PARAMETERS --management-group-id $MGID
unrecognized arguments: --management-group-id alz

PS C:\projects\ABC\bicep\modules\managementGroups> az --version
azure-cli                         2.53.1

core                              2.53.1
telemetry                          1.1.0

Dependencies:
msal                            1.24.0b2
azure-mgmt-resource             23.1.0b2

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\YYY\.azure\cliextensions'

Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.
PS C:\projects\ABC\bicep\modules\managementGroups> az deployment tenant create --help

Command
    az deployment tenant create : Start a deployment at tenant scope.
        Please specify only one of --template-file FILE | --template-uri URI | --template-spec to
        input the ARM template.

Arguments
    --location -l                      [Required] : The location to store the deployment metadata.
    --confirm-with-what-if -c                     : Instruct the command to run deployment What-If
                                                    before executing the deployment. It then prompts
                                                    you to acknowledge resource changes before it
                                                    continues.
    --handle-extended-json-format -j [Deprecated] : Support to handle extended template
                                                    content including multiline and comments in
                                                    deployment.
        Option '--handle-extended-json-format/-j' has been deprecated and will be removed in a
        future release.
    --name -n                                     : The deployment name.
    --no-prompt                                   : The option to disable the prompt of missing
                                                    parameters for ARM template. When the value is
                                                    true, the prompt requiring users to provide
                                                    missing parameter will be ignored. The default
                                                    value is false.  Allowed values: false, true.
    --no-wait                                     : Do not wait for the long-running operation to
                                                    finish.
    --parameters -p                               : Supply deployment parameter values.
        Parameters may be supplied from a file using the `@{path}` syntax, a JSON string, or as
        <KEY=VALUE> pairs. Parameters are evaluated in order, so when a value is assigned twice, the
        latter value will be used. It is recommended that you supply your parameters file first, and
        then override selectively using KEY=VALUE syntax.
    --proceed-if-no-change                        : Instruct the command to execute the deployment
                                                    if the What-If result contains no resource
                                                    changes. Applicable when --confirm-with-what-if
                                                    is set.
    --query-string -q                             : The query string (a SAS token) to be used with
                                                    the template-uri in the case of linked
                                                    templates.
    --template-file -f                            : The path to the template file or Bicep file.
    --template-spec -s                            : The template spec resource id.
    --template-uri -u                             : The URI to the template file.
    --what-if -w                                  : Instruct the command to run deployment What-If.
    --what-if-exclude-change-types -x             : Space-separated list of resource change types to
                                                    be excluded from What-If results. Applicable
                                                    when --confirm-with-what-if is set.  Allowed
                                                    values: Create, Delete, Deploy, Ignore, Modify,
                                                    NoChange, Unsupported.
    --what-if-result-format -r                    : The format of What-If results. Applicable when
                                                    `--confirm-with-what-if` is set.  Allowed
                                                    values: FullResourcePayloads, ResourceIdOnly.
                                                    Default: FullResourcePayloads.

Global Arguments
    --debug                                       : Increase logging verbosity to show all debug
                                                    logs.
    --help -h                                     : Show this help message and exit.
    --only-show-errors                            : Only show errors, suppressing warnings.
    --output -o                                   : Output format.  Allowed values: json, jsonc,
                                                    none, table, tsv, yaml, yamlc.  Default: json.
    --query                                       : JMESPath query string. See http://jmespath.org/
                                                    for more information and examples.
    --subscription                                : Name or ID of subscription. You can configure
                                                    the default subscription using `az account set
                                                    -s NAME_OR_ID`.
    --verbose                                     : Increase logging verbosity. Use --debug for full
                                                    debug logs.

Examples
    Create a deployment at tenant scope from a remote template file, using parameters from a local
    JSON file.
        az deployment tenant create --name rollout01 --location WestUS \
            --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json

    Create a deployment at tenant scope from a local template file, using parameters from a JSON
    string.
        az deployment tenant create --name rollout01 --location WestUS \
            --template-file azuredeploy.json \
            --parameters '{ \"policyName\": { \"value\": \"policy2\" } }'

    Create a deployment at tenant scope from a local template, using a parameter file, a remote
    parameter file, and selectively overriding key/value pairs.
        az deployment tenant create --name rollout01 --location WestUS \
            --template-file azuredeploy.json  --parameters @params.json \
            --parameters https://mysite/params.json --parameters MyValue=This MyArray=@array.json

To search AI knowledge base for examples, use: az find "az deployment tenant create"

Check previous GitHub issues

Code of Conduct

jtracey93 commented 9 months ago

Hey @sergey-netdev,

Thanks for the issue, apolgoies this is a typo in the docs that i have fixed in PR #681

If using the managementGroupsScopeEscape.bicep module then the command you'll need is az deployment mg create --name ${NAME:0:63} --location $LOCATION --template-file $TEMPLATEFILE --parameters $PARAMETERS --management-group-id $MGID