Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.99k forks source link

Deployment hangs with parameter containing `/*` #27518

Open anthony-c-martin opened 1 year ago

anthony-c-martin commented 1 year ago

Describe the bug

The following command appears to hang before attempting to submit a deployment to Azure:

az deployment group create --template-file main.json --resource-group ant-test --parameters clientKey="q8/*&(fi"

It can be repro'd with the following contents of main.json:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "clientKey": {
      "type": "string"
    }
  },
  "resources": [],
  "outputs": {}
}

Related command

az deployment group create

Errors

N/A

Issue script & Debug output

az deployment group create --template-file /Users/ant/Desktop/issue12032/main.json --resource-group ant-test --parameters clientKey="q8/*&(fi"  --debug --verbose
cli.knack.cli: Command arguments: ['deployment', 'group', 'create', '--template-file', '/Users/ant/Desktop/issue12032/main.json', '--resource-group', 'ant-test', '--parameters', 'clientKey=q8/*&(fi', '--debug', '--verbose']
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 0x10112e4d0>, <function OutputProducer.on_global_arguments at 0x1011c3490>, <function CLIQuery.on_global_arguments at 0x10122c940>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'deployment': ['azure.cli.command_modules.resource']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: resource                  0.095        51       227
cli.azure.cli.core: Total (1)                 0.095        51       227
cli.azure.cli.core: Loaded 51 groups, 227 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : deployment group create
cli.azure.cli.core: Command table: deployment group create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x101cdad40>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/ant/.azure/commands/2023-10-03.19-20-11.deployment_group_create.88921.log'.
az_command_data_logger: command args: deployment group create --template-file {} --resource-group {} --parameters {} --debug --verbose
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x101cf76d0>]
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/profiles/_shared.py", line 655, in _get_attr
    op = getattr(op, part)
AttributeError: module 'azure.mgmt.resource.resources.v2022_09_01.models' has no attribute 'ExemptionCategory'

cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x101e012d0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x101e013f0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x1011c3520>, <function CLIQuery.handle_query_parameter at 0x10122c9d0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x101e01360>]
cli.azure.cli.core.util: attempting to read file /Users/ant/Desktop/issue12032/main.json as utf-8-sig

Expected behavior

The deployment is submitted to Azure and runs successfully.

Environment Summary

azure-cli                         2.53.0

core                              2.53.0
telemetry                          1.1.0

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

Python location '/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/bin/python'
Extensions directory '/Users/ant/.azure/cliextensions'

Python (Darwin) 3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 1 year ago

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