Azure / azure-cli

Azure Command-Line Interface
MIT License
3.95k stars 2.93k forks source link

az cosmosdb update is not working as expected #28502

Open archanchoudhury-uptycs opened 5 months ago

archanchoudhury-uptycs commented 5 months ago

Describe the bug

As per the instruction given here https://learn.microsoft.com/en-us/cli/azure/cosmosdb?view=azure-cli-latest#az-cosmosdb-update(cosmosdb-preview) I am trying to use --enable-public-network However I am getting the error like below: unrecognized arguments: --enable-public-network false

My usecase is, I want to remove the Public Network access for my existing Cosmos-DB Resource.

Related command

This is what I am trying to do: az cosmosdb update --name archan-cassandra --resource-group archan-RG --enable-public-network false az cosmosdb update --name archan-postgres --resource-group archan-RG --enable-public-network false

This is not working.

Errors

unrecognized arguments: --enable-public-network false

Examples from AI knowledge base:
az cosmosdb update --capabilities EnableGremlin --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup
Update an Azure Cosmos DB database account. (autogenerated)

az cosmosdb update --name myaccount --resource-group mygroup --locations regionName=eastus --locations regionName=uksouth --enable-multiple-write-locations
Creates a new Azure Cosmos DB database account with two regions. UK South is zone redundant.

https://docs.microsoft.com/en-US/cli/azure/cosmosdb#az_cosmosdb_update

Issue script & Debug output

archan [ ~ ]$ az cosmosdb update --name archan-cassandra --resource-group archan-RG --enable-public-network false --debug
cli.knack.cli: Command arguments: ['cosmosdb', 'update', '--name', 'archan-cassandra', '--resource-group', 'archan-RG', '--enable-public-network', 'false', '--debug']
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 0x7fea4164f1f0>, <function OutputProducer.on_global_arguments at 0x7fea41569d30>, <function CLIQuery.on_global_arguments at 0x7fea41501310>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'cosmosdb': ['azure.cli.command_modules.cosmosdb']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: cosmosdb                  0.162        58       199
cli.azure.cli.core: Total (1)                 0.162        58       199
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: ai-examples               0.093         1         1  /usr/lib/python3.9/site-packages/azure-cli-extensions/ai-examples
cli.azure.cli.core: Total (1)                 0.093         1         1  
cli.azure.cli.core: Loaded 59 groups, 200 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : cosmosdb update
cli.azure.cli.core: Command table: cosmosdb update
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fea409a6c10>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/archan/.azure/commands/2024-03-05.13-05-45.cosmosdb_update.2570.log'.
az_command_data_logger: command args: cosmosdb update --name {} --resource-group {} --enable-public-network {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fea4094c820>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fea40975820>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fea4091a700>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7fea409431f0>]
cli.azure.cli.core.command_recommender: "--enable-public-network" is an invalid parameter for command "cosmosdb update".
urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443
urllib3.connectionpool: https://app.aladdin.microsoft.com:443 "GET /api/v1.0/suggestions?query=%7B%22command%22%3A+%22cosmosdb+update%22%2C+%22parameters%22%3A+%22%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.58.0%22%2C+%22errorType%22%3A+%22UnrecognizedArguments%22%2C+%22correlationId%22%3A+%22e46a84b3-37fb-4178-98e2-2536bf6751ba%22%2C+%22subscriptionId%22%3A+%22116daa12-f6e6-4d37-85fd-65467901d845%22%2C+%22eventId%22%3A+%227b93ea99-2c03-4f6b-84b8-86bfcd4cd157%22%7D HTTP/1.1" 200 None
cli.azure.cli.core.command_recommender: "--enable-public-network" is an invalid parameter for command "cosmosdb update".
cli.azure.cli.core.azclierror: NoneType: None

cli.azure.cli.core.azclierror: unrecognized arguments: --enable-public-network false
az_command_data_logger: unrecognized arguments: --enable-public-network false

Examples from AI knowledge base:
az cosmosdb update --capabilities EnableGremlin --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup
Update an Azure Cosmos DB database account. (autogenerated)

az cosmosdb update --name myaccount --resource-group mygroup --locations regionName=eastus --locations regionName=uksouth --enable-multiple-write-locations
Creates a new Azure Cosmos DB database account with two regions. UK South is zone redundant.

https://docs.microsoft.com/en-US/cli/azure/cosmosdb#az_cosmosdb_update
Read more about the command in reference docs
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fea409a6e50>]
az_command_data_logger: exit code: 2
cli.__main__: Command ran in 0.947 seconds (init: 0.161, invoke: 0.786)
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 4111 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/usr/bin/python3.9 /usr/lib/az/lib/python3.9/site-packages/azure/cli/telemetry/__init__.py /home/archan/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Once I run the output it should work without any error and change the Public Network settings to disabled.

Environment Summary

azure-cli                         2.58.0

core                              2.58.0
telemetry                          1.1.0

Extensions:
ai-examples                        0.2.5
ml                                2.23.0
ssh                                2.0.2

Dependencies:
msal                              1.26.0
azure-mgmt-resource             23.1.0b2

Python location '/usr/bin/python3.9'
Extensions directory '/home/archan/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.9/site-packages/azure-cli-extensions'

Python (Linux) 3.9.14 (main, Oct 12 2023, 19:48:32) 
[GCC 11.2.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 5 months ago

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

microsoft-github-policy-service[bot] commented 5 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pjohari-ms, @kushagraThapar, @simplynaveen20.