Skip to content

Error: "ResourceNotFoundError: Failed to retrieve Scm Uri" running 'az webapp deploy' from Azure Dev Ops (linux) #30432

@daveslee

Description

@daveslee

Describe the bug

Running "az webapp deploy --clean true --resource-group **** --name **** --src-path C:\Temp\app.zip --debug" is successful from local machine ( 'AZURECLI/2.67.0 (MSI) azsdk-python-core/1.31.0 Python/3.12.7 (Windows-11-10.0.22621-SP0)' ). However, when running from an Azure Dev Ops agent, the errror "Failed to retrieve Scm Uri" is returned (AZURECLI/2.67.0 (DEB) azsdk-python-core/1.31.0 Python/3.12.7 ( Linux-6.5.0-1025-azure-x86_64-with-glibc2.35) VSTS_a696132d-be00-4e6c-bfe5-30dbd147a605_build_194_0 ).

When running with the --debug command enabled, you can see that the response from https://management.azure.com:443 "GET /subscriptions/****/resourceGroups/****/providers/Microsoft.Web/sites/****?api-version=2023-01-01 HTTP/1.1" differs in shape. The successful command recieves a response with {"id": ... at the root level. The unsuccessful command is wrapped with {"value":[{"id":...

Related command

az webapp deploy

Errors

File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 336, in call
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/appservice/custom.py", line 6934, in perform_onedeploy_webapp
return _perform_onedeploy_internal(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/appservice/custom.py", line 7174, in _perform_onedeploy_internal
response = _make_onedeploy_request(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/appservice/custom.py", line 7103, in _make_onedeploy_request
deploy_url = _build_onedeploy_url(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/appservice/custom.py", line 6961, in _build_onedeploy_url
return _build_onedeploy_scm_url(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/appservice/custom.py", line 6965, in _build_onedeploy_scm_url
scm_url = _get_scm_url(params.cmd, params.resource_group_name, params.webapp_name, params.slot)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/appservice/custom.py", line 3062, in _get_scm_url
raise ResourceNotFoundError('Failed to retrieve Scm Uri')

Issue script & Debug output

This is the debug output of the failing command.
unsuccessful.txt

Here is an example of a successful log, run locally:
successful.txt

Expected behavior

The command should successfully complete in both environments. Not just the Windows local machine.

Environment Summary

azure-cli 2.67.0

core 2.67.0
telemetry 1.1.0

Extensions:
azure-devops 1.0.1

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.12.7 (main, Oct 30 2024, 03:56:40) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.Web Appsaz webappapp-service-deploymentbugThis 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