Skip to content

[Fix] Improve Function App AI messaging & Flex errors#33447

Draft
MaddyMicrosoft wants to merge 1 commit into
Azure:devfrom
MaddyMicrosoft:fix/already-exists-consistency-32951
Draft

[Fix] Improve Function App AI messaging & Flex errors#33447
MaddyMicrosoft wants to merge 1 commit into
Azure:devfrom
MaddyMicrosoft:fix/already-exists-consistency-32951

Conversation

@MaddyMicrosoft
Copy link
Copy Markdown
Member

Fix #32951: update Application Insights messaging and Flex Consumption error handling.

  • HISTORY.rst: add release notes for AI messaging fix and Flex Consumption hosting-constraints translation.
  • custom.py: catch Microsoft.Web "hosting constraints" HttpResponseError during function app create, probe for an existing site, perform cleanup (plan, storage container, user-assigned identity) and raise a ValidationError with actionable, non-leaking recommendations (different headlines/recommendations depending on whether the site exists).
  • custom.py: when creating Application Insights (workspace-based and regular), probe for an existing component and log "already exists and will be used" instead of incorrectly saying it "was created" on re-runs.
  • tests: add unit tests (test_functionapp_already_exists_messaging.py) to cover AI messaging changes and the hosting-constraints -> ValidationError translation.

These changes improve UX by providing accurate status messages and actionable guidance when Flex Consumption name/hosting conflicts occur.

Related command

Description

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


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

Fix Azure#32951: update Application Insights messaging and Flex Consumption error handling.

- HISTORY.rst: add release notes for AI messaging fix and Flex Consumption hosting-constraints translation.
- custom.py: catch Microsoft.Web "hosting constraints" HttpResponseError during function app create, probe for an existing site, perform cleanup (plan, storage container, user-assigned identity) and raise a ValidationError with actionable, non-leaking recommendations (different headlines/recommendations depending on whether the site exists).
- custom.py: when creating Application Insights (workspace-based and regular), probe for an existing component and log "already exists and will be used" instead of incorrectly saying it "was created" on re-runs.
- tests: add unit tests (test_functionapp_already_exists_messaging.py) to cover AI messaging changes and the hosting-constraints -> ValidationError translation.

These changes improve UX by providing accurate status messages and actionable guidance when Flex Consumption name/hosting conflicts occur.
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 27, 2026

❌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
Type Test Case Error Message Line
Failed test_logicapp_config_appsettings_e2e self = <azure.cli.command_modules.appservice.tests.latest.test_logicapp_commands.LogicappBasicE2ETest testMethod=test_logicapp_config_appsettings_e2e>
resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer(location=DEFAULT_LOCATION)
    def test_logicapp_config_appsettings_e2e(self, resource_group):
        logicapp_name = self.create_random_name(prefix='logic-e2e', length=24)
        plan = self.create_random_name(prefix='logic-e2e-plan', length=24)
        storage = self.create_random_name(prefix='logicstorage', length=24)
        self.cmd('appservice plan create -g {} -n {} --sku WS1'.format(resource_group, plan)).get_output_in_json()['id']
        self.cmd('appservice plan list -g {}'.format(resource_group))
        self.cmd('storage account create --name {} -g {} -l {} --sku Standard_LRS --allow-blob-public-access false'.format(storage, resource_group, DEFAULT_LOCATION))
    
        self.cmd('logicapp create -g {} -n {} -p {} -s {}'.format(resource_group, logicapp_name, plan, storage),
                 checks=[
                         JMESPathCheck('state', 'Running'),
                         JMESPathCheck('name', logicapp_name),
                         JMESPathCheck('hostNames[0]', logicapp_name + '.azurewebsites.net')
                 ]
        )
    
        # update through key value pairs
        self.cmd('logicapp config appsettings set -g {} -n {} --settings s1=foo s2=bar s3=bar2'.format(resource_group, logicapp_name)).assert_with_checks([
            JMESPathCheck("[?name=='s1']
[0].value", None),
            JMESPathCheck("[?name=='s2']
Failed test_logicapp_e2e The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_logicapp_commands.py:30
❌3.13
Type Test Case Error Message Line
Failed test_logicapp_config_appsettings_e2e self = <azure.cli.command_modules.appservice.tests.latest.test_logicapp_commands.LogicappBasicE2ETest testMethod=test_logicapp_config_appsettings_e2e>
resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer(location=DEFAULT_LOCATION)
    def test_logicapp_config_appsettings_e2e(self, resource_group):
        logicapp_name = self.create_random_name(prefix='logic-e2e', length=24)
        plan = self.create_random_name(prefix='logic-e2e-plan', length=24)
        storage = self.create_random_name(prefix='logicstorage', length=24)
        self.cmd('appservice plan create -g {} -n {} --sku WS1'.format(resource_group, plan)).get_output_in_json()['id']
        self.cmd('appservice plan list -g {}'.format(resource_group))
        self.cmd('storage account create --name {} -g {} -l {} --sku Standard_LRS --allow-blob-public-access false'.format(storage, resource_group, DEFAULT_LOCATION))
    
        self.cmd('logicapp create -g {} -n {} -p {} -s {}'.format(resource_group, logicapp_name, plan, storage),
                 checks=[
                         JMESPathCheck('state', 'Running'),
                         JMESPathCheck('name', logicapp_name),
                         JMESPathCheck('hostNames[0]', logicapp_name + '.azurewebsites.net')
                 ]
        )
    
        # update through key value pairs
        self.cmd('logicapp config appsettings set -g {} -n {} --settings s1=foo s2=bar s3=bar2'.format(resource_group, logicapp_name)).assert_with_checks([
            JMESPathCheck("[?name=='s1']
[0].value", None),
            JMESPathCheck("[?name=='s2']
Failed test_logicapp_e2e The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_logicapp_commands.py:30
️✔️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
️✔️postgresql
️✔️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 May 27, 2026

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

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 27, 2026

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>

@MaddyMicrosoft MaddyMicrosoft changed the title Improve Function App AI messaging & Flex errors [Fix] Improve Function App AI messaging & Flex errors May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output should be consistent when resource already exists

3 participants