Skip to content

Don't call for storageConnetionString if it's not needed#4929

Merged
nturinski merged 1 commit intomainfrom
nat/storageSuffixFix
Mar 16, 2026
Merged

Don't call for storageConnetionString if it's not needed#4929
nturinski merged 1 commit intomainfrom
nat/storageSuffixFix

Conversation

@nturinski
Copy link
Copy Markdown
Member

@nturinski nturinski commented Mar 13, 2026

Fixes #4900

For creating flex + managed identity, storageConnectionString is never used but still computed. That's the unnecessary call that triggers the error since it's not available with storage accounts that have SAS turned off.

Also have a fallback for storage endpoint suffix, but it was previously hard-coded before, so it probably didn't work for other clouds.

@nturinski nturinski requested a review from a team as a code owner March 13, 2026 00:25
Copilot AI review requested due to automatic review settings March 13, 2026 00:25
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

This PR avoids unnecessarily fetching the storage connection string when creating a Flex function app with managed identity, which previously caused errors for storage accounts with SAS disabled. It also replaces hard-coded core.windows.net storage endpoint suffixes with environment-aware values for multi-cloud support.

Changes:

  • Skip fetching storageConnectionString when creating a Flex app with managed identity, since only service URIs are used in that scenario.
  • Extract a getStorageEndpointSuffix helper that reads the storage endpoint suffix from the Azure environment (with fallback), replacing hard-coded core.windows.net.
  • Use nonNullProp as a runtime assertion on storageConnectionString at all usage sites to fail fast if it's unexpectedly undefined.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/utils/managedIdentityUtils.ts Added getStorageEndpointSuffix helper and replaced hard-coded core.windows.net in blob/queue/table service URIs with the environment-aware suffix.
src/commands/createFunctionApp/FunctionAppCreateStep.ts Conditionally fetches storageConnectionString only when needed; moved plan-type boolean declarations earlier; wrapped usages in nonNullProp assertions.

@nturinski nturinski merged commit 4e6f48e into main Mar 16, 2026
6 checks passed
@nturinski nturinski deleted the nat/storageSuffixFix branch March 16, 2026 18:02
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.

Internal error: Expected value to be neither null nor undefined: storageEndpointSuffix

3 participants