Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,10 @@ def load_arguments(self, _):
c.argument('enriched_errors', options_list=['--enriched-errors'],
help='If true, deployment failures will show context-enriched diagnostics with error codes, suggested fixes, and Copilot prompts. Enabled by default; use --enriched-errors false to disable.',
arg_type=get_three_state_flag(), default=True)
c.argument('tag', help='Linux only. A friendly name used to identify the deployment.')
c.argument(
'deployment_tag',
options_list=['--deploymentTag', c.deprecate(target='--tag', redirect='--deploymentTag')],
help='Linux only. A friendly name used to identify the deployment.')

with self.argument_context('functionapp deploy') as c:
c.argument('name', options_list=['--name', '-n'], help='Name of the function app to deploy to.')
Expand Down
12 changes: 6 additions & 6 deletions src/azure-cli/azure/cli/command_modules/appservice/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12045,7 +12045,7 @@ def perform_onedeploy_webapp(cmd,
track_status=True,
enable_kudu_warmup=True,
enriched_errors=True,
tag=None):
deployment_tag=None):
params = OneDeployParams()

params.cmd = cmd
Expand All @@ -12064,7 +12064,7 @@ def perform_onedeploy_webapp(cmd,
params.track_status = track_status
params.enable_kudu_warmup = enable_kudu_warmup
params.enriched_errors = enriched_errors
params.tag = tag
params.tag = deployment_tag

# When a slot is targeted, fetch the slot's Site (not production) so the
# cached model matches what every downstream consumer expects — slots have
Expand All @@ -12073,8 +12073,8 @@ def perform_onedeploy_webapp(cmd,
app = _generic_site_operation(cmd.cli_ctx, resource_group_name, name, 'get', slot)
params._cached_site = app # pylint: disable=protected-access
params.is_linux_webapp = is_linux_webapp(app)
if tag is not None and not params.is_linux_webapp:
logger.warning("--tag is only supported for Linux web apps and will be ignored.")
if deployment_tag is not None and not params.is_linux_webapp:
logger.warning("--deploymentTag is only supported for Linux web apps and will be ignored.")
params.tag = None

# Warn that zip deploy won't auto-build on Linux
Expand Down Expand Up @@ -12253,7 +12253,7 @@ def _build_onedeploy_scm_url(params):
deploy_url = deploy_url + '&path=' + quote(params.target_path)

if params.tag is not None:
deploy_url = deploy_url + '&tag=' + quote(params.tag, safe='')
deploy_url = deploy_url + '&deploymentTag=' + quote(params.tag, safe='')

return deploy_url

Expand Down Expand Up @@ -12372,7 +12372,7 @@ def _get_onedeploy_request_body(params):
"ignorestack": params.should_ignore_stack,
"clean": params.is_clean_deployment,
"restart": params.should_restart,
"tag": params.tag,
"deploymentTag": params.tag,
}
}
body = {"properties": {k: v for k, v in body["properties"].items() if v is not None}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ def __init__(self, status_code):

class TestOneDeployTag(unittest.TestCase):

def test_scm_url_includes_encoded_tag(self):
def test_scm_url_includes_encoded_deployment_tag(self):
from azure.cli.command_modules.appservice.custom import OneDeployParams, _build_onedeploy_scm_url
params = OneDeployParams()
params.artifact_type = 'zip'
Expand All @@ -1645,21 +1645,23 @@ def test_scm_url_includes_encoded_tag(self):
return_value='https://example.scm.azurewebsites.net'):
result = _build_onedeploy_scm_url(params)

self.assertEqual(result, 'https://example.scm.azurewebsites.net/api/publish?type=zip&tag=release%202026%2F08')
self.assertEqual(
result,
'https://example.scm.azurewebsites.net/api/publish?type=zip&deploymentTag=release%202026%2F08')

@mock.patch('azure.cli.command_modules.appservice.custom._perform_onedeploy_internal')
@mock.patch('azure.cli.command_modules.appservice.custom._generic_site_operation')
def test_webapp_deploy_ignores_tag_for_windows_webapp(self, site_operation_mock, perform_deploy_mock):
def test_webapp_deploy_ignores_deployment_tag_for_windows_webapp(self, site_operation_mock, perform_deploy_mock):
from azure.cli.command_modules.appservice.custom import perform_onedeploy_webapp
site_operation_mock.return_value = mock.MagicMock(kind='app', reserved=False)

with mock.patch('azure.cli.command_modules.appservice.custom.logger.warning') as warning_mock:
perform_onedeploy_webapp(mock.MagicMock(), 'myRG', 'myApp', tag='windows-tag')
perform_onedeploy_webapp(mock.MagicMock(), 'myRG', 'myApp', deployment_tag='windows-tag')

warning_mock.assert_any_call('--tag is only supported for Linux web apps and will be ignored.')
warning_mock.assert_any_call('--deploymentTag is only supported for Linux web apps and will be ignored.')
self.assertIsNone(perform_deploy_mock.call_args.args[0].tag)

def test_arm_body_includes_tag(self):
def test_arm_body_includes_deployment_tag(self):
import json
from azure.cli.command_modules.appservice.custom import OneDeployParams, _get_onedeploy_request_body
params = OneDeployParams()
Expand All @@ -1669,7 +1671,7 @@ def test_arm_body_includes_tag(self):

body, file_hash = _get_onedeploy_request_body(params)

self.assertEqual(json.loads(body)['properties']['tag'], 'release-2026-08')
self.assertEqual(json.loads(body)['properties']['deploymentTag'], 'release-2026-08')
self.assertIsNone(file_hash)


Expand Down
Loading