[App Service] az functionapp create: Add the --domain-name-scope support#32110
[App Service] az functionapp create: Add the --domain-name-scope support#32110
az functionapp create: Add the --domain-name-scope support#32110Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| functionapp create | cmd functionapp create added parameter auto_generated_domain_name_label_scope |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the --domain-name-scope parameter to the az functionapp create command, allowing customers to specify the domain name scope for function apps. When using --domain-name-scope SubscriptionReuse, the function app will be created with a unique domain format [appname]-[unique-string].[region].azurewebsites.net instead of the default [appname].azurewebsites.net.
- Adds the
--domain-name-scopeparameter with validation choices - Updates the function app creation logic to pass the domain name scope to the Site object
- Includes comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
_params.py |
Adds the new --domain-name-scope parameter definition with choices validation |
custom.py |
Updates the create_functionapp function to accept and use the domain name scope parameter |
test_functionapp_commands.py |
Adds test for unique domain name functionality and marks some existing tests as skipped |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| help='Enable zone redundancy for high availability. Applies to Flex Consumption SKU only.', is_preview=True) | ||
| c.argument('configure_networking_later', options_list=['--configure-networking-later', '--cnl'], arg_type=get_three_state_flag(), | ||
| help='Use this option if you want to configure networking later for an app using network-restricted storage.') | ||
| c.argument('auto_generated_domain_name_label_scope', options_list=['--domain-name-scope'], help="Specify the scope of uniqueness for the default hostname during resource creation. ", choices=['TenantReuse', 'SubscriptionReuse', 'ResourceGroupReuse', 'NoReuse']) |
There was a problem hiding this comment.
The help message should start with an active voice verb instead of "Specify". Consider changing to "Set the scope of uniqueness for the default hostname during resource creation."
| settings = [] | ||
| site_config = SiteConfig(app_settings=settings) |
There was a problem hiding this comment.
[nitpick] The introduction of an intermediate settings variable that's immediately used once adds unnecessary complexity. The original direct initialization SiteConfig(app_settings=[]) was clearer and more concise.
| settings = [] | |
| site_config = SiteConfig(app_settings=settings) | |
| site_config = SiteConfig(app_settings=[]) |
There was a problem hiding this comment.
@khkh-ms can you provide more context on why this change was made? I don't see where we use that settings variable elsewhere
There was a problem hiding this comment.
Changed back. Don't remember but had probably changed it for testing.
| result = self.cmd('functionapp create -g {} -n {} -c {} -s {} --os-type Windows --functions-version 4 --runtime node --runtime-version 22 --domain-name-scope SubscriptionReuse' | ||
| .format(resource_group, functionapp_name, WINDOWS_ASP_LOCATION_FUNCTIONAPP, storage_account)).get_output_in_json() |
There was a problem hiding this comment.
[nitpick] The command string is too long and should be broken into multiple lines for better readability. Consider using parentheses or backslashes to split the command across lines.
| result = self.cmd('functionapp create -g {} -n {} -c {} -s {} --os-type Windows --functions-version 4 --runtime node --runtime-version 22 --domain-name-scope SubscriptionReuse' | |
| .format(resource_group, functionapp_name, WINDOWS_ASP_LOCATION_FUNCTIONAPP, storage_account)).get_output_in_json() | |
| result = self.cmd( | |
| ( | |
| 'functionapp create -g {} -n {} -c {} -s {} ' | |
| '--os-type Windows --functions-version 4 ' | |
| '--runtime node --runtime-version 22 ' | |
| '--domain-name-scope SubscriptionReuse' | |
| ).format(resource_group, functionapp_name, WINDOWS_ASP_LOCATION_FUNCTIONAPP, storage_account) | |
| ).get_output_in_json() |
| ienv/ | ||
| iienv/ | ||
| iiienv/ | ||
| vvenv/ |
There was a problem hiding this comment.
May I ask why need to modify .gitignore file?
|
@yanzhudd Could you please review this PR again? |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az functionapp create
Description
The change adds the support of --domain-name-scope parameter. The parameter helps customers to specify the domain name scope for the function app. When creating the function app with
--domain-name-scope SubscriptionReuse, it will functionapp with the domain of the format of [appnames]-[unique-string].[region].azurewebsites.net instead of the default domain of [appnames].azurewebsites.net.Testing Guide
az functionapp create -g [resrouce-group] -n [functionapp-name] -s [storage-account-name] --functions-version 4 --runtime python --runtime-version 3.11 --flexconsumption-location [region] --domain-name-scope SubscriptionReuse
History Notes
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.