Skip to content

Re-create an existing service failed #35

@hellyzh

Description

@hellyzh

Describe the bug

  1. if create a service: az apic service create -g hlytest424 --name hlyservice426c
  2. then create the service again, will get error: az apic service create -g hlytest424 --name hlyservice426c --tags '{test:value}' --identity '{type:SystemAssigned}'
    image

Related command

az apic service create -g hlytest424 --name hlyservice426c

Errors

helly@hellypcvm:~$ az apic service create -g hlytest424 --name hlyservice426c --tags '{test:value}' --identity '{type:System
Assigned}'
(ValidationError) The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.
Code: ValidationError
Message: The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.

Issue script & Debug output

helly@hellypcvm:~$ az apic service create -g hlytest424 --name hlyservice426c --debug
cli.knack.cli: Command arguments: ['apic', 'service', 'create', '-g', 'hlytest424', '--name', 'hlyservice426c', '--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 0x7f37f2544040>, <function OutputProducer.on_global_arguments at 0x7f37f24ee160>, <function CLIQuery.on_global_arguments at 0x7f37f2303c40>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'apic': ['azext_apic_extension']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
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: apic-extension 0.227 6 37 /home/helly/.azure/cliextensions/apic-extension
cli.azure.cli.core: Total (1) 0.227 6 37
cli.azure.cli.core: Loaded 6 groups, 37 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : apic service create
cli.azure.cli.core: Command table: apic service create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f37f141dc60>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/helly/.azure/commands/2024-04-24.15-39-14.apic_service_create.204693.log'.
az_command_data_logger: command args: apic service create -g {} --name {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f37f1463ec0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f37f148e020>, <function register_cache_arguments..add_cache_arguments at 0x7f37f148e160>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f37f24ee200>, <function CLIQuery.handle_query_parameter at 0x7f37f2303ce0>, <function register_ids_argument..parse_ids_arguments at 0x7f37f148e0c0>]
az_command_data_logger: extension name: apic-extension
az_command_data_logger: extension version: 1.0.0b5
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/helly/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/helly/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/kerberos', 'tenant_region_scope': 'WW', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 7329d6a3-a361-428e-9f87-42a33391f063
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/1756abc0-3554-4341-8d6a-46674962ea19/resourcegroups/hlytest424?api-version=2022-09-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'bf9ec659-020d-11ef-8795-990278737c70'
cli.azure.cli.core.sdk.policies: 'CommandName': 'apic service create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g --name --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.59.0 (DEB) azsdk-python-core/1.28.0 Python/3.11.8 (Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)'
cli.azure.cli.core.sdk.policies: 'Authorization': ''
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/1756abc0-3554-4341-8d6a-46674962ea19/resourcegroups/hlytest424?api-version=2022-09-01 HTTP/1.1" 200 227
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Content-Length': '227'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '11998'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '7aa7ccbd-c17a-4741-8f83-00f0b09b3cc6'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '7aa7ccbd-c17a-4741-8f83-00f0b09b3cc6'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'JAPANEAST:20240426T022905Z:7aa7ccbd-c17a-4741-8f83-00f0b09b3cc6'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: 2A41F2D9490843F4BBD1507C7D8E244E Ref B: TYO201100115017 Ref C: 2024-04-26T02:29:05Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Fri, 26 Apr 2024 02:29:05 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"id":"/subscriptions/1756abc0-3554-4341-8d6a-46674962ea19/resourceGroups/hlytest424","name":"hlytest424","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{},"properties":{"provisioningState":"Succeeded"}}
cli.azure.cli.core.aaz._arg_fmt: using location 'eastus' from resource group 'hlytest424'
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/kerberos', 'tenant_region_scope': 'WW', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 8201d21b-f62e-4931-914e-0b4453d45e8c
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/1756abc0-3554-4341-8d6a-46674962ea19/resourceGroups/hlytest424/providers/Microsoft.ApiCenter/services/hlyservice426c?api-version=2024-03-01'
cli.azure.cli.core.sdk.policies: Request method: 'PUT'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'Content-Length': '22'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'bf9ec659-020d-11ef-8795-990278737c70'
cli.azure.cli.core.sdk.policies: 'CommandName': 'apic service create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g --name --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.59.0 (DEB) azsdk-python-core/1.28.0 Python/3.11.8 (Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)'
cli.azure.cli.core.sdk.policies: 'Authorization': '
'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"location": "eastus"}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions/1756abc0-3554-4341-8d6a-46674962ea19/resourceGroups/hlytest424/providers/Microsoft.ApiCenter/services/hlyservice426c?api-version=2024-03-01 HTTP/1.1" 400 155
cli.azure.cli.core.sdk.policies: Response status: 400
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-store, no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Content-Length': '155'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '1198'
cli.azure.cli.core.sdk.policies: 'api-supported-versions': '2023-07-01-preview, 2024-03-01, 2024-03-15-preview'
cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': 'aa46a8a7-7566-4ce6-863f-78269845f89c'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'aa46a8a7-7566-4ce6-863f-78269845f89c'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'JAPANWEST:20240426T022907Z:aa46a8a7-7566-4ce6-863f-78269845f89c'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: 9502E41696174D33AE7325240C1FB767 Ref B: TYO201151004034 Ref C: 2024-04-26T02:29:05Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Fri, 26 Apr 2024 02:29:06 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {
"code": "ValidationError",
"message": "The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog."
}
cli.azure.cli.core.azclierror: 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 664, in execute
raise ex
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 731, 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 701, 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 "/home/helly/.azure/cliextensions/apic-extension/azext_apic_extension/aaz/latest/apic/service/_create.py", line 36, in _handler
self._execute_operations()
File "/home/helly/.azure/cliextensions/apic-extension/azext_apic_extension/aaz/latest/apic/service/_create.py", line 103, in _execute_operations
self.ServicesCreateOrUpdate(ctx=self.ctx)()
File "/home/helly/.azure/cliextensions/apic-extension/azext_apic_extension/aaz/latest/apic/service/_create.py", line 127, in call
return self.on_error(session.http_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_operation.py", line 332, in on_error
raise HttpResponseError(response=response, error_format=error_format)
azure.core.exceptions.HttpResponseError: (ValidationError) The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.
Code: ValidationError
Message: The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.

cli.azure.cli.core.azclierror: (ValidationError) The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.
Code: ValidationError
Message: The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.
az_command_data_logger: (ValidationError) The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.
Code: ValidationError
Message: The Sku property on the given model is null. A valid Sku is required to create or update an API Catalog.
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f37f141dee0>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 3.395 seconds (init: 0.350, invoke: 3.045)
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 4121 in cache
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/helly/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Can create the service again

Environment Summary

azure-cli 2.59.0

core 2.59.0
telemetry 1.1.0

Extensions:
apic-extension 1.0.0b5

Dependencies:
msal 1.27.0
azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\v-helzha.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions