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
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,15 @@ def should_create_new_rg(cmd, rg_name, is_linux):
def get_site_availability(cmd, name):
""" This is used by az webapp up to verify if a site needs to be created or should just be deployed"""
client = web_client_factory(cmd.cli_ctx)
return client.check_name_availability(name, 'Microsoft.Web/sites')
availability = client.check_name_availability(name, 'Site')

# check for "." in app name. it is valid for hostnames to contain it, but not allowed for webapp names
if "." in name:
availability.name_available = False
availability.reason = "Invalid"
availability.message = ("Site names only allow alphanumeric characters and hyphens, "
"cannot start or end in a hyphen, and must be less than 64 chars.")
return availability


def get_app_details(cmd, name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def create_webapp(cmd, resource_group_name, name, plan, runtime=None, startup_fi
node_default_version = NODE_EXACT_VERSION_DEFAULT
location = plan_info.location
# This is to keep the existing appsettings for a newly created webapp on existing webapp name.
name_validation = client.check_name_availability(name, 'Site')
name_validation = get_site_availability(cmd, name)
if not name_validation.name_available:
if name_validation.reason == 'Invalid':
raise CLIError(name_validation.message)
Expand Down
Loading