Skip to content
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

az lab environment create no longer accepts JSON-escaped parameters on --parameters #30206

Open
Yvand opened this issue Oct 28, 2024 · 2 comments
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Devtestlab az lab Service Attention This issue is responsible by Azure service team.

Comments

@Yvand
Copy link

Yvand commented Oct 28, 2024

Describe the bug

For years I've been using az lab environment create to create DTL environments, using JSON-escaped parameters on --parameters to pass the template parameters, but this no longer works with the version 2.65.0 (not sure when it appeared).
Could it be a regression introduced by #29878 ?

Related command

az lab environment create

Errors

InvalidArgumentValue: --parameters: File '[ { "name": "provisionSharePoint2016", "value": "false" }, { "name": "provisionSharePoint2019", "value": "false" }, { "name": "provisionSharePointSubscription", "value": "Subscription-Latest" }, { "name": "configureADFS", "value": "true" }, { "name": "enableHybridBenefitServerLicenses", "value": "true" }, { "name": "enableAutomaticUpdates", "value": "false" }, { "name": "adminUserName", "value": "yvand" }, { "name": "adminPassword", "value": "PASSWORD" }, { "name": "serviceAccountsPassword", "value": "PASSWORD" }, { "name": "addPublicIPAddress", "value": "SharePointVMsOnly" }, { "name": "RDPTrafficAllowed", "value": "10.20.30.40" }, { "name": "addAzureBastion", "value": "false" } ]' doesn't exist

Issue script & Debug output

Script:

subscriptionId="SUBID"
DTL_ACCOUNTSPASSWORD="PASSWORD"
rg="RGNAME"
envName="ENVNAME"
labName="LABNAME"
az lab environment create --lab-name $labName --name $envName --resource-group $rg --debug --artifact-source-name "Public Repo" \
          --arm-template "/subscriptions/$subscriptionId/resourceGroups/ldapcp/providers/Microsoft.DevTestLab/labs/$labName/artifactSources/Public Environment Repo/armTemplates/SharePoint-AllVersions" \
          --parameters "[ { \"name\": \"provisionSharePoint2016\", \"value\": \"false\" }, { \"name\": \"provisionSharePoint2019\", \"value\": \"false\" }, { \"name\": \"provisionSharePointSubscription\", \"value\": \"Subscription-Latest\" }, { \"name\": \"configureADFS\", \"value\": \"true\" }, { \"name\": \"enableHybridBenefitServerLicenses\", \"value\": \"true\" }, { \"name\": \"enableAutomaticUpdates\", \"value\": \"false\" }, { \"name\": \"adminUserName\", \"value\": \"yvand\" }, { \"name\": \"adminPassword\", \"value\": \"$DTL_ACCOUNTSPASSWORD\" }, { \"name\": \"serviceAccountsPassword\", \"value\": \"$DTL_ACCOUNTSPASSWORD\" }, { \"name\": \"addPublicIPAddress\", \"value\": \"SharePointVMsOnly\" }, { \"name\": \"RDPTrafficAllowed\", \"value\": \"10.20.30.40\" }, { \"name\": \"addAzureBastion\", \"value\": \"false\" } ]"

Output:

cli.knack.cli: Command arguments: ['lab', 'environment', 'create', '--lab-name', 'LABNAME', '--name', 'ENVNAME', '--resource-group', 'RGNAME', '--debug', '--artifact-source-name', 'Public Repo', '--arm-template', '/subscriptions/SUBID/resourceGroups/ldapcp/providers/Microsoft.DevTestLab/labs/LABNAME/artifactSources/Public Environment Repo/armTemplates/SharePoint-AllVersions', '--parameters', '[ { "name": "provisionSharePoint2016", "value": "false" }, { "name": "provisionSharePoint2019", "value": "false" }, { "name": "provisionSharePointSubscription", "value": "true" }, { "name": "configureADFS", "value": "true" }, { "name": "enableHybridBenefitServerLicenses", "value": "true" }, { "name": "enableAutomaticUpdates", "value": "false" }, { "name": "adminUserName", "value": "yvand" }, { "name": "adminPassword", "value": "PASSWORD" }, { "name": "serviceAccountsPassword", "value": "PASSWORD" }, { "name": "addPublicIPAddress", "value": "SharePointVMsOnly" }, { "name": "RDPTrafficAllowed", "value": "10.20.30.40" }, { "name": "addAzureBastion", "value": "false" } ]']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fb41e1da700>, <function OutputProducer.on_global_arguments at 0x7fb41df29bc0>, <function CLIQuery.on_global_arguments at 0x7fb41df676a0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'lab': ['azure.cli.command_modules.lab']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: lab                       0.091        11        33
cli.azure.cli.core: Total (1)                 0.091        11        33
cli.azure.cli.core: Loaded 11 groups, 33 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : lab environment create
cli.azure.cli.core: Command table: lab environment create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fb41d141ee0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/yvand/.azure/commands/2024-10-28.09-28-08.lab_environment_create.33523.log'.
az_command_data_logger: command args: lab environment create --lab-name {} --name {} --resource-group {} --debug --artifact-source-name {} --arm-template {} --parameters {}
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fb41d178680>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fb41cf8e5c0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fb41cf8e700>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x7fb41cf8e7a0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fb41df29c60>, <function CLIQuery.handle_query_parameter at 0x7fb41df67740>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fb41cf8e660>]
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_command_ctx.py", line 53, in format_args
    self.args._schema._fmt(ctx=self, value=self.args)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 402, in __call__
    raise err from err
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 399, in __call__
    value[field_name] = field_schema._fmt(ctx, value[field_name])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 737, in __call__
    raise AAZInvalidArgValueError("File '{}' doesn't exist".format(data))
azure.cli.core.aaz.exceptions.AAZInvalidArgValueError: InvalidArgumentValue: --parameters: File '[ { "name": "provisionSharePoint2016", "value": "false" }, { "name": "provisionSharePoint2019", "value": "false" }, { "name": "provisionSharePointSubscription", "value": "true" }, { "name": "configureADFS", "value": "true" }, { "name": "enableHybridBenefitServerLicenses", "value": "true" }, { "name": "enableAutomaticUpdates", "value": "false" }, { "name": "adminUserName", "value": "yvand" }, { "name": "adminPassword", "value": "PASSWORD" }, { "name": "serviceAccountsPassword", "value": "PASSWORD" }, { "name": "addPublicIPAddress", "value": "SharePointVMsOnly" }, { "name": "RDPTrafficAllowed", "value": "10.20.30.40" }, { "name": "addAzureBastion", "value": "false" } ]' doesn't exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
    raise ex
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 733, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_command.py", line 155, in __call__
    return self._handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/lab/aaz/latest/lab/environment/_create.py", line 32, in _handler
    super()._handler(command_args)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_command.py", line 165, in _handler
    self.ctx.format_args()
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_command_ctx.py", line 55, in format_args
    raise InvalidArgumentValueError(str(err))
azure.cli.core.azclierror.InvalidArgumentValueError: InvalidArgumentValue: --parameters: File '[ { "name": "provisionSharePoint2016", "value": "false" }, { "name": "provisionSharePoint2019", "value": "false" }, { "name": "provisionSharePointSubscription", "value": "true" }, { "name": "configureADFS", "value": "true" }, { "name": "enableHybridBenefitServerLicenses", "value": "true" }, { "name": "enableAutomaticUpdates", "value": "false" }, { "name": "adminUserName", "value": "yvand" }, { "name": "adminPassword", "value": "PASSWORD" }, { "name": "serviceAccountsPassword", "value": "PASSWORD" }, { "name": "addPublicIPAddress", "value": "SharePointVMsOnly" }, { "name": "RDPTrafficAllowed", "value": "10.20.30.40" }, { "name": "addAzureBastion", "value": "false" } ]' doesn't exist

cli.azure.cli.core.azclierror: InvalidArgumentValue: --parameters: File '[ { "name": "provisionSharePoint2016", "value": "false" }, { "name": "provisionSharePoint2019", "value": "false" }, { "name": "provisionSharePointSubscription", "value": "true" }, { "name": "configureADFS", "value": "true" }, { "name": "enableHybridBenefitServerLicenses", "value": "true" }, { "name": "enableAutomaticUpdates", "value": "false" }, { "name": "adminUserName", "value": "yvand" }, { "name": "adminPassword", "value": "PASSWORD" }, { "name": "serviceAccountsPassword", "value": "PASSWORD" }, { "name": "addPublicIPAddress", "value": "SharePointVMsOnly" }, { "name": "RDPTrafficAllowed", "value": "10.20.30.40" }, { "name": "addAzureBastion", "value": "false" } ]' doesn't exist
az_command_data_logger: InvalidArgumentValue: --parameters: File '[ { "name": "provisionSharePoint2016", "value": "false" }, { "name": "provisionSharePoint2019", "value": "false" }, { "name": "provisionSharePointSubscription", "value": "true" }, { "name": "configureADFS", "value": "true" }, { "name": "enableHybridBenefitServerLicenses", "value": "true" }, { "name": "enableAutomaticUpdates", "value": "false" }, { "name": "adminUserName", "value": "yvand" }, { "name": "adminPassword", "value": "PASSWORD" }, { "name": "serviceAccountsPassword", "value": "PASSWORD" }, { "name": "addPublicIPAddress", "value": "SharePointVMsOnly" }, { "name": "RDPTrafficAllowed", "value": "10.20.30.40" }, { "name": "addAzureBastion", "value": "false" } ]' doesn't exist
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fb41d142160>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 0.198 seconds (init: 0.074, invoke: 0.124)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 4613 in cache file under /home/yvand/.azure/telemetry/20241028092809011
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /home/yvand/.azure /home/yvand/.azure/telemetry/20241028092809011"
telemetry.process: Return from creating process 33541
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Triggers the creation of the DTL lab, using the JSON-escaped parameters passed to --parameters

Environment Summary

azure-cli 2.65.0

core 2.65.0
telemetry 1.1.0

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/home/yvand/.azure/cliextensions'

Python (Linux) 3.11.8 (main, Sep 25 2024, 11:33:44) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

@Yvand Yvand added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Oct 28, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 28, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. Devtestlab az lab labels Oct 28, 2024
@Yvand
Copy link
Author

Yvand commented Oct 28, 2024

FYI it is exactly the same problem with parameter --artifacts in command az lab vm apply-artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Devtestlab az lab Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants