Skip to content

Commit

Permalink
[App Service] Fix#21401: Update websites extension to latest SDK 6.0.1 (
Browse files Browse the repository at this point in the history
#21398)

* Updating websites extension to latest SDK 6.0.1

webapp_show to show_app fixes

* re-recording logic app tests

* undoing this so that botservice fixed the original issue where "global" is not supported for webapps
  • Loading branch information
panchagnula authored Mar 2, 2022
1 parent 598673d commit f3c278f
Show file tree
Hide file tree
Showing 180 changed files with 84,711 additions and 86,481 deletions.
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 @@ -229,7 +229,7 @@ def default_api_version(self):
'private_endpoint_connections': '2019-10-17-preview',
'subscription_diagnostic_settings': '2017-05-01-preview'
}),
ResourceType.MGMT_APPSERVICE: '2020-09-01',
ResourceType.MGMT_APPSERVICE: '2021-03-01',
ResourceType.MGMT_IOTHUB: '2021-07-02',
ResourceType.MGMT_IOTDPS: '2021-10-15',
ResourceType.MGMT_IOTCENTRAL: '2018-09-01',
Expand Down
9 changes: 4 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 @@ -102,8 +102,7 @@ def load_arguments(self, _):
completer=get_resource_name_completion_list('Microsoft.Web/serverFarms'),
configured_default='appserviceplan', id_part='name',
local_context_attribute=LocalContextAttribute(name='plan_name', actions=[LocalContextAction.GET]))
c.argument('admin_site_name', help='The name of the admin web app.',
deprecate_info=c.deprecate(expiration='0.2.17'))
c.argument('number_of_workers', help='Number of workers to be allocated.', type=int, default=1)
c.ignore('max_burst')

with self.argument_context('appservice plan create') as c:
Expand Down Expand Up @@ -567,7 +566,7 @@ def load_arguments(self, _):
c.argument('client_secret_certificate_thumbprint', options_list=['--aad-client-secret-certificate-thumbprint', '--thumbprint'], arg_group='Azure Active Directory',
help='Alternative to AAD Client Secret, thumbprint of a certificate used for signing purposes')
c.argument('allowed_audiences', nargs='+', options_list=['--aad-allowed-token-audiences'],
arg_group='Azure Active Directory', help="One or more token audiences (space-delimited).")
arg_group='Azure Active Directory', help="One or more token audiences (comma-delimited).")
c.argument('issuer', options_list=['--aad-token-issuer-url'],
help='This url can be found in the JSON output returned from your active directory endpoint using your tenantID. The endpoint can be queried from `az cloud show` at \"endpoints.activeDirectory\". '
'The tenantID can be found using `az account show`. Get the \"issuer\" from the JSON at <active directory endpoint>/<tenantId>/.well-known/openid-configuration.',
Expand All @@ -576,7 +575,7 @@ def load_arguments(self, _):
help="Application ID to integrate Facebook Sign-in into your web app")
c.argument('facebook_app_secret', arg_group='Facebook', help='Facebook Application client secret')
c.argument('facebook_oauth_scopes', nargs='+',
help="One or more facebook authentication scopes (space-delimited).", arg_group='Facebook')
help="One or more facebook authentication scopes (comma-delimited).", arg_group='Facebook')
c.argument('twitter_consumer_key', arg_group='Twitter',
help='Application ID to integrate Twitter Sign-in into your web app')
c.argument('twitter_consumer_secret', arg_group='Twitter', help='Twitter Application client secret')
Expand All @@ -589,7 +588,7 @@ def load_arguments(self, _):
help="AAD V2 Application ID to integrate Microsoft account Sign-in into your web app")
c.argument('microsoft_account_client_secret', arg_group='Microsoft', help='AAD V2 Application client secret')
c.argument('microsoft_account_oauth_scopes', nargs='+',
help="One or more Microsoft authentification scopes (space-delimited).", arg_group='Microsoft')
help="One or more Microsoft authentification scopes (comma-delimited).", arg_group='Microsoft')

with self.argument_context('webapp hybrid-connection') as c:
c.argument('name', arg_type=webapp_name_arg_type, id_part=None)
Expand Down
29 changes: 6 additions & 23 deletions src/azure-cli/azure/cli/command_modules/appservice/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,32 +116,15 @@ def validate_functionapp_asp_create(namespace):
if namespace.max_burst is not None:
if tier.lower() != "elasticpremium":
raise ArgumentUsageError("--max-burst is only supported for Elastic Premium (EP) plans")
namespace.max_burst = validate_range_of_int_flag('--max-burst', namespace.max_burst, min_val=0, max_val=100)
if namespace.number_of_workers is not None:
namespace.number_of_workers = validate_range_of_int_flag('--number-of-workers / --min-elastic-worker-count',
namespace.number_of_workers, min_val=0, max_val=100)


def validate_app_or_slot_exists_in_rg(cmd, namespace):
"""Validate that the App/slot exists in the RG provided"""
client = web_client_factory(cmd.cli_ctx)
webapp = namespace.name
def validate_app_exists(cmd, namespace):
app = namespace.name
resource_group_name = namespace.resource_group_name
if isinstance(namespace.slot, str):
app = client.web_apps.get_slot(resource_group_name, webapp, namespace.slot, raw=True)
else:
app = client.web_apps.get(resource_group_name, webapp, None, raw=True)
if app.response.status_code != 200:
raise ResourceNotFoundError(app.response.text)


def validate_app_exists_in_rg(cmd, namespace):
client = web_client_factory(cmd.cli_ctx)
webapp = namespace.name
resource_group_name = namespace.resource_group_name
app = client.web_apps.get(resource_group_name, webapp, None, raw=True)
if app.response.status_code != 200:
raise ResourceNotFoundError(app.response.text)
slot = namespace.slot
app = _generic_site_operation(cmd.cli_ctx, resource_group_name, app, 'get', slot)
if not app:
raise ResourceNotFoundError("'{}' app not found in ResourceGroup '{}'".format(app, resource_group_name))


def validate_add_vnet(cmd, namespace):
Expand Down
17 changes: 9 additions & 8 deletions src/azure-cli/azure/cli/command_modules/appservice/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

from ._client_factory import cf_web_client, cf_plans, cf_webapps
from ._validators import (validate_onedeploy_params, validate_staticsite_link_function, validate_staticsite_sku,
validate_vnet_integration, validate_asp_create, validate_functionapp_asp_create)
validate_vnet_integration, validate_asp_create, validate_functionapp_asp_create,
validate_app_exists)


def output_slots_in_table(slots):
Expand Down Expand Up @@ -122,7 +123,7 @@ 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)
g.custom_show_command('show', 'show_app', table_transformer=transform_web_output)
g.custom_command('delete', 'delete_webapp')
g.custom_command('stop', 'stop_webapp')
g.custom_command('start', 'start_webapp')
Expand Down Expand Up @@ -214,24 +215,24 @@ def load_command_table(self, _):

with self.command_group('webapp deployment source') as g:
g.custom_command('config-local-git', 'enable_local_git')
g.custom_command('config-zip', 'enable_zip_deploy_webapp')
g.custom_command('config-zip', 'enable_zip_deploy_webapp', exception_handler=ex_handler_factory())
g.custom_command('config', 'config_source_control', exception_handler=ex_handler_factory())
g.custom_command('sync', 'sync_site_repo', exception_handler=ex_handler_factory())
g.custom_show_command('show', 'show_source_control')
g.custom_command('delete', 'delete_source_control')
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')
g.custom_command('tail', 'get_streaming_log', validator=validate_app_exists)
g.custom_command('download', 'download_historical_logs')
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:
with self.command_group('webapp log deployment') as g:
g.custom_show_command('show', 'show_deployment_log')
g.custom_command('list', 'list_deployment_logs')

with self.command_group('functionapp log deployment', is_preview=True) as g:
with self.command_group('functionapp log deployment') as g:
g.custom_show_command('show', 'show_deployment_log')
g.custom_command('list', 'list_deployment_logs')

Expand All @@ -254,7 +255,7 @@ def load_command_table(self, _):
g.custom_command('config', 'enable_cd')
g.custom_command('show-cd-url', 'show_container_cd_url')

with self.command_group('webapp deployment github-actions', is_preview=True) as g:
with self.command_group('webapp deployment github-actions') as g:
g.custom_command('add', 'add_github_actions')
g.custom_command('remove', 'remove_github_actions')

Expand Down Expand Up @@ -310,7 +311,7 @@ def load_command_table(self, _):
validator=validate_vnet_integration)
g.custom_command('list-runtimes', 'list_function_app_runtimes')
g.custom_command('list', 'list_function_app', table_transformer=transform_web_list_output)
g.custom_show_command('show', 'show_functionapp', table_transformer=transform_web_output)
g.custom_show_command('show', 'show_app', table_transformer=transform_web_output)
g.custom_command('delete', 'delete_function_app')
g.custom_command('stop', 'stop_webapp')
g.custom_command('start', 'start_webapp')
Expand Down
Loading

0 comments on commit f3c278f

Please sign in to comment.