Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/Functions/Functions.Autorest/custom/HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,14 @@ function GetEndpointSuffix
[Microsoft.Azure.PowerShell.Cmdlets.Functions.DoNotExportAttribute()]
param()

$environmentName = (Get-AzContext).Environment.Name
$storageEndpointSuffix = (Get-AzContext).Environment.StorageEndpointSuffix

Comment on lines +163 to 164
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The function could throw a null reference exception if Get-AzContext returns null. Consider adding error handling to check if the context exists before accessing its properties. For example: '$context = Get-AzContext; if ($null -eq $context) { return '' }; $storageEndpointSuffix = $context.Environment.StorageEndpointSuffix'

Suggested change
$storageEndpointSuffix = (Get-AzContext).Environment.StorageEndpointSuffix
$context = Get-AzContext
if ($null -eq $context -or $null -eq $context.Environment)
{
return ''
}
$storageEndpointSuffix = $context.Environment.StorageEndpointSuffix

Copilot uses AI. Check for mistakes.
switch ($environmentName)
if ([string]::IsNullOrWhiteSpace($storageEndpointSuffix))
{
"AzureUSGovernment" { ';EndpointSuffix=core.usgovcloudapi.net' }
"AzureChinaCloud" { ';EndpointSuffix=core.chinacloudapi.cn' }
"AzureCloud" { ';EndpointSuffix=core.windows.net' }
default { '' }
return ''
}

return ";EndpointSuffix=$storageEndpointSuffix"
}

function NewAppSetting
Expand Down
2 changes: 2 additions & 0 deletions src/Functions/Functions/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
-->
## Upcoming Release

* Fixed cloud portability by using dynamic endpoints for storage [#29034]
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The changelog entry could be more descriptive for users. Consider expanding it to explain the impact and what specific issue was fixed. For example: "Fixed 'New-AzFunctionApp' cmdlet to work in non-public Azure clouds by dynamically retrieving storage endpoints instead of using hardcoded values. This enables full cloud portability across Azure Public, Government, China, and custom cloud environments."

Copilot generated this review using guidance from repository custom instructions.

## Version 4.3.0
* Added FlexConsumption support to Get-AzFunctionAppAvailableLocation, which returns a list of regions that supported Flex Consumption, including locations supporting zone redundancy (currently applied only to Flex Consumption)
* Added a new cmdlet Get-AzFunctionAppFlexConsumptionRuntime to retrieve Flex Consumption runtimes for a specified location
Expand Down
Loading