Skip to content
Merged
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
3 changes: 2 additions & 1 deletion scripts/ci/credscan/CredScanSuppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"src\\azure-cli\\azure\\cli\\command_modules\\appservice\\tests\\latest\\recordings\\test_webapp_list_deployment_logs.yaml",
"src\\azure-cli\\azure\\cli\\command_modules\\appservice\\tests\\latest\\recordings\\test_webapp_up_statichtml_e2e.yaml",
"src\\azure-cli\\azure\\cli\\command_modules\\appservice\\tests\\latest\\recordings\\test_webapp_up_generate_default_name.yaml",
"src\\azure-cli\\azure\\cli\\command_modules\\appservice\\tests\\latest\\recordings\\test_windows_to_linux_fail.yaml"
"src\\azure-cli\\azure\\cli\\command_modules\\appservice\\tests\\latest\\recordings\\test_windows_to_linux_fail.yaml",
"src\\azure-cli\\azure\\cli\\command_modules\\appservice\\tests\\latest\\recordings\\test_one_deploy.yaml"
],
"_justification": "[AppService] response body contains random value recognized as secret"
},
Expand Down
3 changes: 2 additions & 1 deletion scripts/sdk_process/patch_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ def find_autorest_generated_folder(module_prefix="azure.mgmt"):
'azure.mgmt.compute',
'azure.mgmt.network',
'azure.mgmt.monitor',
'azure.mgmt.rdbms'
'azure.mgmt.loganalytics',
'azure.mgmt.rdbms',
'azure.mgmt.web',
'azure.mgmt.cosmosdb'
]
prefix = sys.argv[1] if len(sys.argv) >= 2 else "azure.mgmt"
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def default_api_version(self):
'private_endpoint_connections': '2019-10-17-preview',
'subscription_diagnostic_settings': '2017-05-01-preview'
}),
ResourceType.MGMT_APPSERVICE: '2019-08-01',
ResourceType.MGMT_APPSERVICE: '2020-09-01',
ResourceType.MGMT_IOTHUB: '2020-03-01',
ResourceType.MGMT_ARO: '2020-04-30',
ResourceType.MGMT_DATABOXEDGE: '2019-08-01'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ def _generic_site_operation(cli_ctx, resource_group_name, name, operation_name,
return (operation(resource_group_name, name)
if extra_parameter is None else operation(resource_group_name,
name, extra_parameter))

return (operation(resource_group_name, name, slot)
if extra_parameter is None else operation(resource_group_name,
name, extra_parameter, slot))
name, slot, extra_parameter))


def _generic_settings_operation(cli_ctx, resource_group_name, name, operation_name,
setting_properties, slot=None, client=None, api_version=None):
client = client or web_client_factory(cli_ctx, api_version=api_version)
operation = getattr(client.web_apps, operation_name if slot is None else operation_name + '_slot')
if slot is None:
return operation(resource_group_name, name, setting_properties)

return operation(resource_group_name, name, slot, setting_properties)
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@
az webapp create -g MyResourceGroup -p MyPlan -n MyUniqueAppName -i myregistry.azurecr.io/docker-image:tag
- name: create a WebApp using shared App Service Plan that is in a different resource group.
text: >
AppServicePlanID=$(az appservice plan show -n SharedAppServicePlan -g MyResourceGroup --query "id" --out tsv)
AppServicePlanID=$(az appservice plan show -n SharedAppServicePlan -g MyASPRG --query "id" --out tsv)
az webapp create -g MyResourceGroup -p "$AppServicePlanID" -n MyUniqueAppName
"""

Expand Down
11 changes: 6 additions & 5 deletions src/azure-cli/azure/cli/command_modules/appservice/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ def load_arguments(self, _):
c.argument('https_only', help="Redirect all traffic made to an app using HTTP to HTTPS.",
arg_type=get_three_state_flag(return_label=True))
c.argument('force_dns_registration', help="If true, web app hostname is force registered with DNS",
arg_type=get_three_state_flag(return_label=True))
arg_type=get_three_state_flag(return_label=True), deprecate_info=c.deprecate(expiration='2.23.0'))
Comment thread
Juliehzl marked this conversation as resolved.
c.argument('skip_custom_domain_verification',
help="If true, custom (non *.azurewebsites.net) domains associated with web app are not verified",
arg_type=get_three_state_flag(return_label=True))
arg_type=get_three_state_flag(return_label=True), deprecate_info=c.deprecate(expiration='2.23.0'))
c.argument('ttl_in_seconds', help="Time to live in seconds for web app's default domain name",
arg_type=get_three_state_flag(return_label=True))
arg_type=get_three_state_flag(return_label=True), deprecate_info=c.deprecate(expiration='2.23.0'))
c.argument('skip_dns_registration', help="If true web app hostname is not registered with DNS on creation",
arg_type=get_three_state_flag(return_label=True))
arg_type=get_three_state_flag(return_label=True), deprecate_info=c.deprecate(expiration='2.23.0'))

with self.argument_context('webapp browse') as c:
c.argument('logs', options_list=['--logs', '-l'], action='store_true',
Expand All @@ -189,7 +189,8 @@ def load_arguments(self, _):
c.argument('name', arg_type=webapp_name_arg_type, local_context_attribute=None)
c.argument('keep_empty_plan', action='store_true', help='keep empty app service plan')
c.argument('keep_metrics', action='store_true', help='keep app metrics')
c.argument('keep_dns_registration', action='store_true', help='keep DNS registration')
c.argument('keep_dns_registration', action='store_true', help='keep DNS registration',
deprecate_info=c.deprecate(expiration='2.23.0'))

with self.argument_context('webapp webjob') as c:
c.argument('webjob_name', help='The name of the webjob', options_list=['--webjob-name', '-w'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,29 +143,6 @@ def validate_front_end_scale_factor(namespace):
raise CLIError(scale_error_text.format(scale_factor, min_scale_factor, max_scale_factor))


def validate_asp_sku(cmd, namespace):
import json
client = web_client_factory(cmd.cli_ctx)
serverfarm = namespace.name
resource_group_name = namespace.resource_group_name
asp = client.app_service_plans.get(resource_group_name, serverfarm, None, raw=True)
if asp.response.status_code != 200:
raise CLIError(asp.response.text)
# convert byte array to json
output_str = asp.response.content.decode('utf8')
res = json.loads(output_str)

# Isolated SKU is supported only for ASE
if namespace.sku in ['I1', 'I2', 'I3']:
if res.get('properties').get('hostingEnvironment') is None:
raise CLIError("The pricing tier 'Isolated' is not allowed for this app service plan. Use this link to "
"learn more: https://docs.microsoft.com/en-us/azure/app-service/overview-hosting-plans")
else:
if res.get('properties').get('hostingEnvironment') is not None:
raise CLIError("Only pricing tier 'Isolated' is allowed in this app service plan. Use this link to "
"learn more: https://docs.microsoft.com/en-us/azure/app-service/overview-hosting-plans")


def validate_ip_address(cmd, namespace):
if namespace.ip_address is not None:
_validate_ip_address_format(namespace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from knack.log import get_logger
from msrestazure.tools import (parse_resource_id, is_valid_resource_id, resource_id)

VERSION_2019_08_01 = "2019-08-01"
VERSION_2019_10_01 = "2019-10-01"
VERSION_2020_04_01 = "2020-04-01"

Expand Down Expand Up @@ -91,7 +92,7 @@ def delete_appserviceenvironment(cmd, name, resource_group_name=None, no_wait=Fa
if resource_group_name is None:
resource_group_name = _get_resource_group_name_from_ase(ase_client, name)

return sdk_no_wait(no_wait, ase_client.delete,
return sdk_no_wait(no_wait, ase_client.begin_delete,
resource_group_name=resource_group_name, name=name)


Expand All @@ -112,7 +113,7 @@ def update_appserviceenvironment(cmd, name, resource_group_name=None, front_end_
if front_end_scale_factor:
ase_def.front_end_scale_factor = front_end_scale_factor

return sdk_no_wait(no_wait, ase_client.create_or_update, resource_group_name=resource_group_name,
return sdk_no_wait(no_wait, ase_client.begin_create_or_update, resource_group_name=resource_group_name,
name=name, hosting_environment_envelope=ase_def)


Expand Down Expand Up @@ -170,8 +171,12 @@ def create_ase_inbound_services(cmd, resource_group_name, name, subnet, vnet_nam
inbound_vnet_id=inbound_vnet_id, inbound_ip_address=inbound_ip_address)


def _get_ase_client_factory(cli_ctx):
def _get_ase_client_factory(cli_ctx, api_version=None):
client = get_mgmt_service_client(cli_ctx, WebSiteManagementClient).app_service_environments
if api_version:
client.api_version = api_version
else:
client.api_version = VERSION_2019_08_01
return client


Expand All @@ -180,7 +185,7 @@ def _get_resource_client_factory(cli_ctx, api_version=None):
if api_version:
client.api_version = api_version
else:
api_version = VERSION_2019_10_01
client.api_version = VERSION_2019_10_01
return client


Expand All @@ -189,7 +194,7 @@ def _get_network_client_factory(cli_ctx, api_version=None):
if api_version:
client.api_version = api_version
else:
api_version = VERSION_2020_04_01
client.api_version = VERSION_2020_04_01
return client


Expand Down
43 changes: 22 additions & 21 deletions src/azure-cli/azure/cli/command_modules/appservice/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from azure.cli.core.util import empty_on_404

from ._client_factory import cf_web_client, cf_plans, cf_webapps
from ._validators import validate_app_exists_in_rg, validate_app_or_slot_exists_in_rg, validate_asp_sku, validate_onedeploy_params
from ._validators import validate_onedeploy_params


def output_slots_in_table(slots):
Expand Down Expand Up @@ -115,19 +115,18 @@ def load_command_table(self, _):
g.custom_command('up', 'webapp_up', exception_handler=ex_handler_factory())
g.custom_command('ssh', 'ssh_webapp', exception_handler=ex_handler_factory(), is_preview=True)
g.custom_command('list', 'list_webapp', table_transformer=transform_web_list_output)
g.custom_show_command('show', 'show_webapp', table_transformer=transform_web_output,
validator=validate_app_or_slot_exists_in_rg)
g.custom_command('delete', 'delete_webapp', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('stop', 'stop_webapp', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('start', 'start_webapp', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('restart', 'restart_webapp', validator=validate_app_or_slot_exists_in_rg)
g.custom_show_command('show', 'show_webapp', table_transformer=transform_web_output)
g.custom_command('delete', 'delete_webapp')
g.custom_command('stop', 'stop_webapp')
g.custom_command('start', 'start_webapp')
g.custom_command('restart', 'restart_webapp')
g.custom_command('browse', 'view_in_browser')
g.custom_command('list-instances', 'list_instances', validator=validate_app_or_slot_exists_in_rg)
# Move back to using list_runtimes function once Available Stacks API is updated (it's updated with Antares deployments)
g.custom_command('list-instances', 'list_instances')
# TO DO: Move back to using list_runtimes function once Available Stacks API is updated (it's updated with Antares deployments)
g.custom_command('list-runtimes', 'list_runtimes_hardcoded')
g.custom_command('identity assign', 'assign_identity', validator=validate_app_or_slot_exists_in_rg)
g.custom_show_command('identity show', 'show_identity', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('identity remove', 'remove_identity', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('identity assign', 'assign_identity')
g.custom_show_command('identity show', 'show_identity')
g.custom_command('identity remove', 'remove_identity')
g.custom_command('create-remote-connection', 'create_tunnel', exception_handler=ex_handler_factory())
g.custom_command('deploy', 'perform_onedeploy', validator=validate_onedeploy_params, is_preview=True)
g.generic_update_command('update', getter_name='get_webapp', setter_name='set_webapp', custom_func_name='update_webapp', command_type=appservice_custom)
Expand Down Expand Up @@ -174,11 +173,11 @@ def load_command_table(self, _):
g.custom_show_command('show', 'show_container_settings')

with self.command_group('webapp config ssl') as g:
g.custom_command('upload', 'upload_ssl_cert', validator=validate_app_exists_in_rg)
g.custom_command('upload', 'upload_ssl_cert')
g.custom_command('list', 'list_ssl_certs', exception_handler=ex_handler_factory())
g.custom_show_command('show', 'show_ssl_cert', exception_handler=ex_handler_factory())
g.custom_command('bind', 'bind_ssl_cert', exception_handler=ex_handler_factory(), validator=validate_app_or_slot_exists_in_rg)
g.custom_command('unbind', 'unbind_ssl_cert', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('bind', 'bind_ssl_cert', exception_handler=ex_handler_factory())
g.custom_command('unbind', 'unbind_ssl_cert')
g.custom_command('delete', 'delete_ssl_cert', exception_handler=ex_handler_factory())
g.custom_command('import', 'import_ssl_cert', exception_handler=ex_handler_factory())
g.custom_command('create', 'create_managed_ssl_cert', exception_handler=ex_handler_factory(), is_preview=True)
Expand Down Expand Up @@ -216,10 +215,10 @@ def load_command_table(self, _):
g.custom_command('update-token', 'update_git_token', exception_handler=ex_handler_factory())

with self.command_group('webapp log') as g:
g.custom_command('tail', 'get_streaming_log', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('tail', 'get_streaming_log')
g.custom_command('download', 'download_historical_logs')
g.custom_command('config', 'config_diagnostics', validator=validate_app_or_slot_exists_in_rg)
g.custom_show_command('show', 'show_diagnostic_settings', validator=validate_app_or_slot_exists_in_rg)
g.custom_command('config', 'config_diagnostics')
g.custom_show_command('show', 'show_diagnostic_settings')

with self.command_group('webapp log deployment', is_preview=True) as g:
g.custom_show_command('show', 'show_deployment_log')
Expand Down Expand Up @@ -285,8 +284,9 @@ def load_command_table(self, _):
g.command('delete', 'delete', confirmation=True)
g.custom_command('list', 'list_app_service_plans')
g.show_command('show', 'get')
g.generic_update_command('update', custom_func_name='update_app_service_plan', setter_arg_name='app_service_plan',
validator=validate_asp_sku, supports_no_wait=True)
g.generic_update_command('update', setter_name='begin_create_or_update', custom_func_name='update_app_service_plan',
setter_arg_name='app_service_plan', supports_no_wait=True,
exception_handler=ex_handler_factory())

with self.command_group('appservice') as g:
g.custom_command('list-locations', 'list_locations', transform=transform_list_location_output)
Expand Down Expand Up @@ -359,7 +359,8 @@ def load_command_table(self, _):

with self.command_group('functionapp plan', appservice_plan_sdk) as g:
g.custom_command('create', 'create_functionapp_app_service_plan', exception_handler=ex_handler_factory())
g.generic_update_command('update', custom_func_name='update_functionapp_app_service_plan',
g.generic_update_command('update', setter_name='begin_create_or_update',
custom_func_name='update_functionapp_app_service_plan',
setter_arg_name='app_service_plan', exception_handler=ex_handler_factory())
g.command('delete', 'delete', confirmation=True)
g.custom_command('list', 'list_app_service_plans')
Expand Down
Loading