Skip to content

Commit 83d1588

Browse files
committed
Enable MSI authentication for pull based az webapp deploy operations
1 parent 05a5d8f commit 83d1588

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/azure-cli/azure/cli/command_modules/appservice/_params.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,8 @@ def load_arguments(self, _):
776776
c.argument('reset', help='Reset Java apps to the default parking page if set to true with no type specified.', arg_type=get_three_state_flag())
777777
c.argument('timeout', type=int, help='Timeout for the deployment operation in milliseconds. Ignored when using "--src-url" since synchronous deployments are not yet supported when using "--src-url"')
778778
c.argument('slot', help="The name of the slot. Default to the productions slot if not specified.")
779-
c.argument('track_status', help="If true, web app startup status during deployment will be tracked for linux web apps.",
780-
arg_type=get_three_state_flag())
779+
c.argument('track_status', help="If true, web app startup status during deployment will be tracked for linux web apps.", arg_type=get_three_state_flag())
780+
c.argument('pull_identity', help="AAD identity used for pull based deployments. 'system' will use the app's system assigned identy. An user assigned identity can be used by providing the client ID. Only available for Windows WebApps. Support for Linux WebApps coming soon.")
781781

782782
with self.argument_context('functionapp deploy') as c:
783783
c.argument('name', options_list=['--name', '-n'], help='Name of the function app to deploy to.')

src/azure-cli/azure/cli/command_modules/appservice/custom.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -6912,7 +6912,8 @@ def perform_onedeploy_webapp(cmd,
69126912
ignore_stack=None,
69136913
timeout=None,
69146914
slot=None,
6915-
track_status=True):
6915+
track_status=True,
6916+
pull_identity=None):
69166917
params = OneDeployParams()
69176918

69186919
params.cmd = cmd
@@ -6929,6 +6930,7 @@ def perform_onedeploy_webapp(cmd,
69296930
params.timeout = timeout
69306931
params.slot = slot
69316932
params.track_status = track_status
6933+
params.pull_identity = pull_identity
69326934

69336935
return _perform_onedeploy_internal(params)
69346936

@@ -6948,6 +6950,7 @@ def __init__(self):
69486950
self.should_restart = None
69496951
self.is_clean_deployment = None
69506952
self.should_ignore_stack = None
6953+
self.pull_identity = None
69516954
self.timeout = None
69526955
self.slot = None
69536956
self.track_status = False
@@ -7056,6 +7059,11 @@ def _get_onedeploy_request_body(params):
70567059
"access it".format(params.src_path)) from e
70577060
elif params.src_url:
70587061
logger.warning('Deploying from URL: %s', params.src_url)
7062+
7063+
if app_is_linux_webapp and params.pull_identity is not None:
7064+
logger.warning('Pull with MSI support comming soon for Linux webapps')
7065+
raise ValidationError("Pull with MSI support is not available for Linux webapps")
7066+
70597067
body = {
70607068
"properties": {
70617069
"packageUri": params.src_url,
@@ -7064,8 +7072,10 @@ def _get_onedeploy_request_body(params):
70647072
"ignorestack": params.should_ignore_stack,
70657073
"clean": params.is_clean_deployment,
70667074
"restart": params.should_restart,
7075+
"pullIdentity": params.pull_identity
70677076
}
70687077
}
7078+
70697079
body = {"properties": {k: v for k, v in body["properties"].items() if v is not None}}
70707080
body = json.dumps(body)
70717081
else:

0 commit comments

Comments
 (0)