Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

`az webapp list` doesn't return the whole list of web apps #29495

Open nulltoken opened 3 months ago

nulltoken commented 3 months ago

Describe the bug

az webapp list returns a bunch of resources. However some of them are not returned.

For those I have to specify the resource group they belong to (ie. az webapp list --resource-group "my-resource-group"

Related command

az webapp list

Errors

No errors. Only an empty array is returned

Issue script & Debug output

PS> az webapp list --debug --resource-group "{my-resource-group}" > 1.txt DEBUG: cli.knack.cli: Command arguments: ['webapp', 'list', '--debug', '--resource-group', '{my-resource-group}'] DEBUG: cli.knack.cli: init debug log: Cannot enable color. DEBUG: cli.knack.cli: Event: Cli.PreExecute [] DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x000001C120D739C0>, <function OutputProducer.on_global_arguments at 0x000001C120EFA200>, <function CLIQuery.on_global_arguments at 0x000001C120F23D80>] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] DEBUG: cli.azure.cli.core: Modules found from index for 'webapp': ['azure.cli.command_modules.appservice', 'azure.cli.command_modules.serviceconnector'] DEBUG: cli.azure.cli.core: Loading command modules: DEBUG: cli.azure.cli.core: Name Load Time Groups Commands DEBUG: cli.azure.cli.core: appservice 0.742 79 270 DEBUG: cli.azure.cli.core: serviceconnector 0.116 20 307 DEBUG: cli.azure.cli.core: Total (2) 0.858 99 577 DEBUG: cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next'] DEBUG: cli.azure.cli.core: Loading extensions: DEBUG: cli.azure.cli.core: Name Load Time Groups Commands Directory DEBUG: cli.azure.cli.core: Total (0) 0.000 0 0 DEBUG: cli.azure.cli.core: Loaded 97 groups, 577 commands. DEBUG: cli.azure.cli.core: Found a match in the command table. DEBUG: cli.azure.cli.core: Raw command : webapp list DEBUG: cli.azure.cli.core: Command table: webapp list DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x000001C123E6A480>] DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users{user}.azure\commands\2024-07-27.10-46-59.webapp_list.71932.log'. INFO: az_command_data_logger: command args: webapp list --debug --resource-group {} DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x000001C123EC49A0>] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x000001C123EC4A40>, <function register_cache_arguments..add_cache_arguments at 0x000001C123EC4B80>] DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x000001C120EFA2A0>, <function CLIQuery.handle_query_parameter at 0x000001C120F23E20>, <function register_ids_argument..parse_ids_arguments at 0x000001C123EC4AE0>] DEBUG: cli.azure.cli.core.commands.client_factory: Getting management service client client_type=WebSiteManagementClient DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='C:\Users\{user}\.azure\msal_token_cache.bin', encrypt=True DEBUG: cli.azure.cli.core.auth.binary_cache: load: C:\Users{user}.azure\msal_http_cache.bin DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None) INFO: msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/{tenant} DEBUG: msal.authority: openid_config("https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/{tenant}/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/{tenant}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/{tenant}/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/{tenant}/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/{tenant}/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'} DEBUG: msal.application: Broker enabled? True DEBUG: cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={} DEBUG: cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={} DEBUG: msal.application: Cache hit an AT DEBUG: msal.telemetry: Generate or reuse correlation_id: 08abe066-8f57-44c0-a623-31d1b74ad6ab DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/{subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Web/sites?api-version=2023-01-01' DEBUG: cli.azure.cli.core.sdk.policies: Request method: 'GET' DEBUG: cli.azure.cli.core.sdk.policies: Request headers: DEBUG: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json' DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'c9225183-4bf4-11ef-b53f-040e3ca148de' DEBUG: cli.azure.cli.core.sdk.policies: 'CommandName': 'webapp list' DEBUG: cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--debug --resource-group' DEBUG: cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.61.0 (MSI) azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.19045-SP0)' DEBUG: cli.azure.cli.core.sdk.policies: 'Authorization': '*****' DEBUG: cli.azure.cli.core.sdk.policies: Request body: DEBUG: cli.azure.cli.core.sdk.policies: This request has no body DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443 DEBUG: urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/{subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Web/sites?api-version=2023-01-01 HTTP/1.1" 200 8346 DEBUG: cli.azure.cli.core.sdk.policies: Response status: 200 DEBUG: cli.azure.cli.core.sdk.policies: Response headers: DEBUG: cli.azure.cli.core.sdk.policies: 'Date': 'Sat, 27 Jul 2024 08:47:02 GMT' DEBUG: cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache' DEBUG: cli.azure.cli.core.sdk.policies: 'Expires': '-1' DEBUG: cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE' DEBUG: cli.azure.cli.core.sdk.policies: 'Connection': 'Keep-Alive' DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json' DEBUG: cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: 7E1FECD96D5D47D584208FAC25DD2966 Ref B: AMS231020614031 Ref C: 2024-07-27T08:47:02Z' DEBUG: cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET' DEBUG: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache' DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Length': '8346' DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-request-id': 'bf381f5a-f3d1-4623-bc08-4f1ea47250b0' DEBUG: cli.azure.cli.core.sdk.policies: 'X-AspNet-Version': '4.0.30319' DEBUG: cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff' DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'FRANCECENTRAL:20240727T084703Z:567f297d-d938-43fc-a4ba-61c31392d8ae' DEBUG: cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains' DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '567f297d-d938-43fc-a4ba-61c31392d8ae' DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '249' DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-reads': '3749' DEBUG: cli.azure.cli.core.sdk.policies: Response content: DEBUG: cli.azure.cli.core.sdk.policies: {"value":[{"id":"/subscriptions/{subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Web/sites/{webapp}","name":"{webapp}","type":"Microsoft.Web/sites","kind":"app,linux","location":"West Europe","tags":{"[REDACTED]]},"properties":{"name":"{webapp}","state":"Running","hostNames":["{webapp}.{ase}.appserviceenvironment.net"],"webSpace":"{serviceplan_resourcegroup}-{ase}appseWestEuropewebspace","selfLink":"https://waws-prod-am2-c8b40a63.api.p.azurewebsites.windows.net:454/subscriptions/{subscription}/webspaces/{serviceplan_resourcegroup}-{ase}appseWestEuropewebspace/sites/{webapp}","repositorySiteName":"{webapp}","owner":null,"usageState":"Normal","enabled":true,"adminEnabled":true,"afdEnabled":false,"enabledHostNames":["{webapp}.{ase}.appserviceenvironment.net","{webapp}.scm.{ase}.appserviceenvironment.net"], ...} DEBUG: cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x000001C123EB1B20>, <function _x509_from_base64_to_hex_transform at 0x000001C123EB1BC0>] DEBUG: cli.knack.cli: Event: CommandInvoker.OnFilterResult [] DEBUG: cli.knack.cli: Event: Cli.SuccessfulExecute [] DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x000001C123E6A700>] INFO: az_command_data_logger: exit code: 0 INFO: cli.main: Command ran in 4.920 seconds (init: 0.719, invoke: 4.201) INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1 INFO: telemetry.client: Accumulated 0 events. Flush the clients. INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1 INFO: telemetry.save: Save telemetry record of length 3663 in cache INFO: telemetry.main: Begin creating telemetry upload process. INFO: telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry__init__.pyc C:\Users{user}.azure" INFO: telemetry.process: Return from creating process INFO: telemetry.main: Finish creating telemetry upload process.

Expected behavior

az webapp list should return the whole list of web apps.

Environment Summary

PS> az --version azure-cli 2.61.0 *

core 2.61.0 * telemetry 1.1.0

Extensions: resource-graph 2.1.0

Dependencies: msal 1.28.0 azure-mgmt-resource 23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Users\xxxxxx.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

Additional context

No response

azure-client-tools-bot-prd[bot] commented 3 months ago

Hi @nulltoken,

2.61.0 is not the latest Azure CLI(2.62.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 3 months ago

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

nulltoken commented 3 months ago

FWIW, it looks like the webapps that aren't returned by az webapp list are the ones where the appservice and the service plan they run on top of are in two different resource groups.

Peter2021Devops commented 3 months ago

Hello everyone, I have a similar problem, documented at issues/29218. In my case the appservice and the service plan are in the same resource group.