[Function] Fix New-AzFunctionApp fails because of param -Name binding. #29253
[Function] Fix New-AzFunctionApp fails because of param -Name binding. #29253
-Name binding. #29253Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
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 $Nameargument from theTest-AzNameAvailabilitycall, soNameis passed only via@PSBoundParameters - Update
ChangeLog.mdto 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 |
src/Functions/Functions/ChangeLog.md
Outdated
| - Additional information about change #1 | ||
| --> | ||
| ## Upcoming Release | ||
| * Fixed New-AzFunctionApp fails because of param `-Name` binding. [#29166] |
There was a problem hiding this comment.
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.
|
/azp run azure-powershell - powershell-core |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run azure-powershell - powershell-core |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Fixing #29166 caused by #28873
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.