Skip to content

Commit

Permalink
Add new parameter --acr-use-managed-identity-creds to allow customer …
Browse files Browse the repository at this point in the history
…to set acrUseManagedIdentityCreds while creating the site
  • Loading branch information
mstxsun committed Jan 2, 2024
1 parent df7cb4a commit da8dbcf
Show file tree
Hide file tree
Showing 5 changed files with 2,333 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def load_arguments(self, _):
c.argument('vnet', help="Name or resource ID of the regional virtual network. If there are multiple vnets of the same name across different resource groups, use vnet resource id to specify which vnet to use. If vnet name is used, by default, the vnet in the same resource group as the webapp will be used. Must be used with --subnet argument.")
c.argument('subnet', help="Name or resource ID of the pre-existing subnet to have the webapp join. The --vnet is argument also needed if specifying subnet by name.")
c.argument('public_network_access', help="Enable or disable public access to the web app", arg_type=get_enum_type(PUBLIC_NETWORK_ACCESS_MODES))
c.argument('acr_use_managed_identity_creds', action='store_true', help="Enable or disable acr use managed identity creds")
c.ignore('language')
c.ignore('using_webapp_up')

Expand Down
5 changes: 4 additions & 1 deletion src/azure-cli/azure/cli/command_modules/appservice/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def create_webapp(cmd, resource_group_name, name, plan, runtime=None, startup_fi
deployment_local_git=None, docker_registry_server_password=None, docker_registry_server_user=None,
multicontainer_config_type=None, multicontainer_config_file=None, tags=None,
using_webapp_up=False, language=None, assign_identities=None,
role='Contributor', scope=None, vnet=None, subnet=None, https_only=False, public_network_access=None):
role='Contributor', scope=None, vnet=None, subnet=None, https_only=False, public_network_access=None, acr_use_managed_identity_creds=None):
from azure.mgmt.web.models import Site
from azure.core.exceptions import ResourceNotFoundError as _ResourceNotFoundError
SiteConfig, SkuDescription, NameValuePair = cmd.get_models(
Expand Down Expand Up @@ -188,6 +188,9 @@ def create_webapp(cmd, resource_group_name, name, plan, runtime=None, startup_fi
if using_webapp_up:
https_only = using_webapp_up

if acr_use_managed_identity_creds:
site_config.acr_use_managed_identity_creds = acr_use_managed_identity_creds

webapp_def = Site(location=location, site_config=site_config, server_farm_id=plan_info.id, tags=tags,
https_only=https_only, virtual_network_subnet_id=subnet_resource_id,
public_network_access=public_network_access, vnet_route_all_enabled=vnet_route_all_enabled)
Expand Down
Loading

0 comments on commit da8dbcf

Please sign in to comment.