Skip to content

{App Service} az functionapp create: Stack API to take SKU for Flex#32264

Merged
yanzhudd merged 12 commits intoAzure:devfrom
khkh-ms:khkh-flex-stacks-api-sku
Nov 10, 2025
Merged

{App Service} az functionapp create: Stack API to take SKU for Flex#32264
yanzhudd merged 12 commits intoAzure:devfrom
khkh-ms:khkh-flex-stacks-api-sku

Conversation

@khkh-ms
Copy link
Copy Markdown
Contributor

@khkh-ms khkh-ms commented Oct 15, 2025

Related command

  • az functionapp list-flexconsumption-locations
  • az functionapp create --resource-group {RESOURCE_GROUP} --name {APP_NAME} --storage-account {STORAGE_NAME} --flexconsumption-location {REGION} --runtime python --runtime-version 3.11

Description
Updated the stacks API to take SKU as parameter/query string. Also make the Flex specific stacks API class to be generic and able to take SKU as input.

Testing Guide
az functionapp list-flexconsumption-locations


This checklist is used to make sure that common guidelines for a pull request are followed.

@khkh-ms khkh-ms requested a review from jsntcy as a code owner October 15, 2025 17:52
Copilot AI review requested due to automatic review settings October 15, 2025 17:52
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Oct 15, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Oct 15, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Oct 15, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds generic SKU-aware runtime stack helper to replace the previous Flex-only helper so that Function App stack resolution can work for Flex Consumption (FC1) and future SKUs. Key change introduces _FunctionAppSkuStackRuntimeHelper with a sku parameter and updates all call sites accordingly.

  • Introduces new helper class _FunctionAppSkuStackRuntimeHelper and replaces prior _FlexFunctionAppStackRuntimeHelper usages.
  • Modifies the stacks API URL to attempt adding a sku query parameter.
  • Removes hardcoded filtering for FC1 skus in stack parsing.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/appservice/custom.py Outdated
Comment on lines 5669 to 5672
for sku in skus:
if sku['skuCode'] != 'FC1':
continue

github_actions_properties = {
'is_supported': github_actions_settings.get('isSupported', False),
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the prior FC1 filter means multiple skus can iterate but the logic later assigns runtime_to_version[runtime_name][runtime_version] once, overwriting earlier sku entries and yielding a nondeterministic sku selection. Either (a) restore filtering to the requested sku, (b) key runtime_to_version by (runtime_version, skuCode), or (c) ensure the API correctly filters by sku (after fixing the URL) so only one sku is returned.

Copilot uses AI. Check for mistakes.
Comment on lines 5612 to 5617
def __init__(self, cmd, location, runtime, sku, runtime_version=None):
self._cmd = cmd
self._location = location
self._runtime = runtime
self._sku = sku
self._runtime_version = runtime_version
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attribute self._runtime_version is assigned but never referenced elsewhere in the class; remove it or use it (e.g., to default resolve logic) to avoid dead code and reduce confusion.

Suggested change
def __init__(self, cmd, location, runtime, sku, runtime_version=None):
self._cmd = cmd
self._location = location
self._runtime = runtime
self._sku = sku
self._runtime_version = runtime_version
def __init__(self, cmd, location, runtime, sku):
self._cmd = cmd
self._location = location
self._runtime = runtime
self._sku = sku

Copilot uses AI. Check for mistakes.
@yanzhudd
Copy link
Copy Markdown
Contributor

please fix the CI issues

@yanzhudd
Copy link
Copy Markdown
Contributor

please note that the code completion date is on 10/28/2025 at 07:00 UTC for the upcoming release. Please address the comments asap, otherwise it has to be postponed to next sprint (11/18)

@zhoxing-ms
Copy link
Copy Markdown
Contributor

{App Service} az functionapp create: Stack API to take SKU for Flex

May I ask why the title uses {}? Is the change in PR imperceptible to customers?

@khkh-ms khkh-ms changed the title {App Service} az functionapp create: Stack API to take SKU for Flex [App Service] az functionapp create: Stack API to take SKU for Flex Nov 3, 2025
@khkh-ms khkh-ms force-pushed the khkh-flex-stacks-api-sku branch from f6f5210 to ee2abec Compare November 3, 2025 21:01
stacks_api_url = '/providers/Microsoft.Web/locations/{}/functionAppStacks?' \
'api-version=2020-10-01&removeHiddenStacks=true&removeDeprecatedStacks=true&stack={}'
def get_raw_function_app_stacks(self, cmd, location, runtime, sku):
stacks_api_url = '/providers/Microsoft.Web/locations/{}/functionAppStacks?api-version=2023-01-01&removeHiddenStacks=true&removeDeprecatedStacks=true&stack={}&sku={}' # pylint: disable=line-too-long
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing "FC1" from every calling function, why don't you just make it so that this url is

stacks_api_url = '/providers/Microsoft.Web/locations/{}/functionAppStacks?api-version=2023-01-01&removeHiddenStacks=true&removeDeprecatedStacks=true&stack={}&sku=FC1'

This way, we don't have to update all existing functions. I think we should only accept a sku param to the RuntimeHelper class and methods if this class is used for stuff other than flex and this sku value can vary based on those applications. But my understanding is that all of this is for flex and we would have to use the same sku value right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the class as generic in terms of SKU because the stacks API is not Flex specific anymore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed as recommended. Will make the class generic in a different PR. thanks!

@khkh-ms khkh-ms force-pushed the khkh-flex-stacks-api-sku branch from 3b33f51 to e84fa69 Compare November 7, 2025 04:26

@ResourceGroupPreparer(location=LINUX_ASP_LOCATION_FUNCTIONAPP)
@StorageAccountPreparer()
def test_functionapp_on_linux_consumption_python_latest(self, resource_group, storage_account):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this test relevant in testing the changes you made in custom.py if that _FlexFunctionAppStackRuntimeHelper class is for Flex specific apps?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved offline

Copy link
Copy Markdown
Contributor Author

@khkh-ms khkh-ms Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context: The test was removed by azcli team because it was breaking and blocking the PRs. I am adding the adding the test back after fixing it as part of the PR. thanks!

@yanzhudd yanzhudd changed the title [App Service] az functionapp create: Stack API to take SKU for Flex {App Service} az functionapp create: Stack API to take SKU for Flex Nov 10, 2025
@yanzhudd yanzhudd merged commit 19bddd4 into Azure:dev Nov 10, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Functions az functionapp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants