Skip to content

Unable to create an APIM api with a blank url suffix #27517

@DavidAtImpactCubed

Description

@DavidAtImpactCubed

Describe the bug

Through the az apim api update command it is possible to set the path (i.e. url suffix).
Through the Azure portal, it is possible to set the path to be blank for a single API per APIM instance.

The az apim api update command does not accept a blank string or null for the path parameter, so it isn't possible to automate this.

Related command

az apim api update --service-name $apimName --resource-group $apimResourceGroup --api-id $apiName --path $null
or
az apim api update --service-name $apimName --resource-group $apimResourceGroup --api-id $apiName --path ""

Errors

argument --path: expected one argument

Issue script & Debug output

$apiName = 'test-api'
$apimName = 'my-apim'
$apimResourceGroup = 'my-apim'

az apim api update --service-name $apimName --resource-group $apimResourceGroup --api-id $apiName --path $null --debug

cli.knack.cli: Command arguments: ['apim', 'api', 'update', '--service-name', 'my-apim', '--resource-group', 'my-apim', '--api-id', 'test-api', '--path', '--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 0x020CB4A8>, <function OutputProducer.on_global_arguments at 0x022CD6E8>, <function CLIQuery.on_global_arguments at 0x022E8340>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'apim': ['azure.cli.command_modules.apim']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: apim 0.011 14 68
cli.azure.cli.core: Total (1) 0.011 14 68
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: Loaded 14 groups, 68 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : apim api update
cli.azure.cli.core: Command table: apim api update
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x044AC4A8>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\david.azure\commands\2023-10-03.22-50-27.apim_api_update.77604.log'.
az_command_data_logger: command args: apim api update --service-name {} --resource-group {} --api-id {} --path --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x044D65C8>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x044E5580>, <function register_cache_arguments..add_cache_arguments at 0x044E5610>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
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+%22apim+api+update%22%2C+%22parameters%22%3A+%22--path%2C--api-id%2C--service-name%2C--resource-group%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.53.0%22%2C+%22errorType%22%3A+%22ExpectedArgument%22%2C+%22correlationId%22%3A+%22d001b157-a9cb-494d-a6be-177f1528bf48%22%2C+%22subscriptionId%22%3A+%22b617bc33-3d67-451e-a132-4cc2153bdff0%22%2C+%22eventId%22%3A+%22f38191a5-a3a3-4a70-a997-e7a8d6db9ea6%22%7D HTTP/1.1" 200 None
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "argparse.py", line 1859, in parse_known_args
File "argparse.py", line 2072, in _parse_known_args
File "argparse.py", line 2002, in consume_optional
File "argparse.py", line 2167, in _match_argument
argparse.ArgumentError: argument --path: expected one argument

cli.azure.cli.core.azclierror: argument --path: expected one argument
az_command_data_logger: argument --path: expected one argument

Expected behavior

So long as there is only one API with a blank path, the command should accept a blank path.

Environment Summary

azure-cli 2.53.0

core 2.53.0
telemetry 1.1.0

Extensions:
arcdata 1.5.5
automation 0.2.1

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

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    API Managementaz apimAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.act-observability-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions