Skip to content

[Function] Fix New-AzFunctionApp fails because of param -Name binding. #29253

Merged
VeryEarly merged 3 commits intomainfrom
nori/fix-functionhelper
Mar 10, 2026
Merged

[Function] Fix New-AzFunctionApp fails because of param -Name binding. #29253
VeryEarly merged 3 commits intomainfrom
nori/fix-functionhelper

Conversation

@NoriZC
Copy link
Contributor

@NoriZC NoriZC commented Mar 10, 2026

Description

Fixing #29166 caused by #28873

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings March 10, 2026 03:02
@azure-client-tools-bot-prd
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
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

This PR fixes issue #29166 where New-AzFunctionApp would fail with a "Cannot bind parameter because parameter 'Name' is specified more than once" error on Windows PowerShell 5.1. The bug was introduced in PR #28873 (Flex Consumption support). The root cause was that ValidateFunctionAppNameAvailability was calling Test-AzNameAvailability -Name $Name -Type Site @PSBoundParameters, which passed -Name twice—once explicitly and once via @PSBoundParameters (since $Name is a declared parameter). Windows PowerShell 5.1 is strict about this, unlike PowerShell 7+.

Changes:

  • Remove the redundant explicit -Name $Name argument from the Test-AzNameAvailability call, so Name is passed only via @PSBoundParameters
  • Update ChangeLog.md to document the bug fix

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Functions/Functions.Autorest/custom/HelperFunctions.ps1 Removes duplicate -Name $Name from Test-AzNameAvailability call to fix Windows PowerShell 5.1 binding error
src/Functions/Functions/ChangeLog.md Adds changelog entry for the fix under ## Upcoming Release

- Additional information about change #1
-->
## Upcoming Release
* Fixed New-AzFunctionApp fails because of param `-Name` binding. [#29166]
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The ChangeLog entry is grammatically awkward: "Fixed New-AzFunctionApp fails because of param -Name binding." should read "Fixed an issue where New-AzFunctionApp fails due to duplicate -Name parameter binding." or similar to be clearer for end-users. The existing entries in this file (e.g., "Fixed cloud portability by using dynamic endpoints for storage") follow a more readable pattern.

Copilot uses AI. Check for mistakes.
@VeryEarly VeryEarly enabled auto-merge (squash) March 10, 2026 03:27
@VeryEarly
Copy link
Collaborator

/azp run azure-powershell - powershell-core

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@VeryEarly
Copy link
Collaborator

/azp run azure-powershell - powershell-core

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@VeryEarly VeryEarly merged commit fe636c0 into main Mar 10, 2026
12 checks passed
@VeryEarly VeryEarly deleted the nori/fix-functionhelper branch March 10, 2026 08:03
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.

3 participants