Azure / azure-cli

Azure Command-Line Interface
MIT License
3.91k stars 2.88k forks source link

az functionapp config container set fails #28141

Open sridharvenkat opened 5 months ago

sridharvenkat commented 5 months ago

Describe the bug

I am unable to set a container image to function apps using Azure CLI. The function app is under "Container Apps Environment". I am able to do the same using portal, just that it won't work in CLI. The error is "Internal Server Error", doesn't provide much information as well.

Related command

az functionapp config container set --docker-custom-image-name .azurecr.io/:4338e0ec91f0bb3216e4 --docker-registry-server-password --docker-registry-server-url https://.azurecr.io --docker-registry-server-user --name --resource-group

Errors

Operation returned an invalid status 'Internal Server Error' Content: {"Message":"An error has occurred."}

Issue script & Debug output

urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings?api-version=2022-03-01 HTTP/1.1" 500 36 cli.azure.cli.core.sdk.policies: Response status: 500 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': '36' 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: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains' cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-IIS/10.0' cli.azure.cli.core.sdk.policies: 'X-AspNet-Version': '4.0.30319' cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET' cli.azure.cli.core.sdk.policies: 'x-ms-failure-cause': 'service' cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '1199' cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '7d1eeaf6-1d3d-4aa8-ab54-143b6422f61c' cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '7d1eeaf6-1d3d-4aa8-ab54-143b6422f61c' cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'WESTUS:20240107T210608Z:7d1eeaf6-1d3d-4aa8-ab54-143b6422f61c' cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff' cli.azure.cli.core.sdk.policies: 'Date': 'Sun, 07 Jan 2024 21:06:08 GMT' cli.azure.cli.core.sdk.policies: 'Connection': 'close' cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {"Message":"An error has occurred."} cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/appservice/custom.py", line 464, in update_application_settings_polling _generic_settings_operation(cmd.cli_ctx, resource_group_name, name, File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/appservice/_appservice_utils.py", line 33, in _generic_settings_operation return operation(resource_group_name, name, setting_properties) File "/usr/lib64/az/lib/python3.9/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer return func(*args, **kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/mgmt/web/v2022_03_01/operations/_web_apps_operations.py", line 18341, in update_application_settings raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Internal Server Error' Content: {"Message":"An error has occurred."}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(command_args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/appservice/custom.py", line 1783, in update_container_settings_functionapp return update_container_settings(cmd, resource_group_name, name, registry_server, File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/appservice/custom.py", line 1761, in update_container_settings update_app_settings(cmd, resource_group_name, name, settings, slot) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/appservice/custom.py", line 438, in update_app_settings update_application_settings_polling(cmd, resource_group_name, name, app_settings, slot, client) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/appservice/custom.py", line 477, in update_application_settings_polling raise CLIError(ex) knack.util.CLIError: Operation returned an invalid status 'Internal Server Error' Content: {"Message":"An error has occurred."}

cli.azure.cli.core.azclierror: Operation returned an invalid status 'Internal Server Error' Content: {"Message":"An error has occurred."} az_command_data_logger: Operation returned an invalid status 'Internal Server Error' Content: {"Message":"An error has occurred."}

Expected behavior

Sets a container image to the function app

Environment Summary

azure-cli 2.55.0

core 2.55.0 telemetry 1.1.0

Extensions: ai-examples 0.2.5 ml 2.22.0 ssh 2.0.2

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

Python location '/usr/bin/python3.9' Extensions directory '/home/sridharan/.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.

sridharvenkat commented 5 months ago

Any update on this?

kamperiadis commented 5 months ago

Hi @sridharvenkat We are currently investigating this issue and we will get back to you on this. Thank you for your patience.

raorugan commented 5 months ago

Hi @sridharvenkat you need to use below parameters such as --image, --registry-password, --registry-username to update the image in cli . (refer this doc link -https://github.com/Azure/azure-functions-on-container-apps?tab=readme-ov-file#update-function-container-image)

az functionapp config container set --image /: --registry-password --registry-username --name --resource-group

The current parameters used in your cmdlet are deprecated (https://learn.microsoft.com/en-us/cli/azure/functionapp/config/container?view=azure-cli-latest#az-functionapp-config-container-set) image

raorugan commented 5 months ago

@sridharvenkat - can you please look into the acr image name as well , it seems incorrect. https://.azurecr.io https:// is not required. Can you try below format highlighted image

.azurecr.io/:
kamperiadis commented 5 months ago

Hi @sridharvenkat Just wanted to check in and see if the suggestions above resolved the issue you were experiencing?

sridharvenkat commented 5 months ago

@raorugan, image name parameter did not contain https, only the register server URL had it. I guess while posting this bug, GitHub also removed some text from my command text. Also, I tried the commands with and without deprecated parameter names.

raorugan commented 5 months ago

Hi @sridharvenkat can you share the error messages you are currently seeing?

Elizabeth-Martin2 commented 1 week ago

@sridharvenkat - can you please look into the acr image name as well , it seems incorrect. https://.azurecr.io https:// is not required. Can you try below format highlighted image

.azurecr.io/:

I was getting the same "Internal Server Error" and the above resolved the issue for me