Skip to content

Basic implementation for managed identity for create function app#4213

Merged
nturinski merged 11 commits intomainfrom
nat/managedIdentityBasic
Mar 12, 2025
Merged

Basic implementation for managed identity for create function app#4213
nturinski merged 11 commits intomainfrom
nat/managedIdentityBasic

Conversation

@nturinski
Copy link
Member

Partially implements #4206

This is the bare bones implementation of having managed system identities integrated with function apps.

There's still quite a lot to do in terms of checking their settings for debugging/deploying.

This code is very simple because system identity is just a flag you turn on with the identity object and the backend completes the rest. The rest is using the role assignment API to give the function app the Storage Blob Data Contributor role which is the bare minimum requirement for deploying (since it leverages storage blob containers for that).

Lastly, we need to change the AccountWebJobsStorage to AccountWebJobsStorage__accountName. This is where a lot of our customer scenarios will break since we relied on that setting for a lot, so still plenty of work to do there.

@nturinski nturinski requested a review from a team as a code owner July 12, 2024 22:36
alexweininger
alexweininger previously approved these changes Jul 15, 2024
}
}

const principalId = nonNullProp(nonNullProp(context.site, 'identity'), 'principalId');
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit cleaner to do

Suggested change
const principalId = nonNullProp(nonNullProp(context.site, 'identity'), 'principalId');
const principalId = nonNullValueAndProp(context.site.identity, 'principalId');

and I think it does the same thing.

package.json Outdated
"dependencies": {
"@azure/arm-appinsights": "^5.0.0-alpha.20230530.1",
"@azure/arm-appservice": "^15.0.0",
"@azure/arm-authorization-profile-2020-09-01-hybrid": "^2.1.0",
Copy link
Member

Choose a reason for hiding this comment

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

Curious: Were you forced to use 2020-09-01-hybrid for some reason?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was just following this documentation. Didn't even really think about how the @azure/arm-authorization-profile package would exist.

https://learn.microsoft.com/en-us/javascript/api/overview/azure/arm-authorization-profile-2020-09-01-hybrid-readme?view=azure-node-latest

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines 156 to 157
name: `${ConnectionKey.Storage}__accountName`,
value: context.newStorageAccountName ?? context.storageAccount?.name
Copy link
Member

Choose a reason for hiding this comment

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

This is where a lot of our customer scenarios will break since we relied on that setting for a lot, so still plenty of work to do there.

Can you outline which scenarios you expect to break? Have you verified them breaking?

Copy link
Member Author

Choose a reason for hiding this comment

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

  • Deployment: We rely/enforce having the AzureWebJobsStorage setting
  • Debugging: Same thing as above

Those are the main scenarios. We were discussing maybe having two different settings.json files-- one for remote and one for local settings. I'm not actually sure if the AzureWebJobsStorage__accountName setting works locally since you would need an app that has an identity with RBAC to the storage account. That's kind of the main push as to why we'd want to have two separate settings.

@nturinski nturinski merged commit 5704a16 into main Mar 12, 2025
2 checks passed
@nturinski nturinski deleted the nat/managedIdentityBasic branch March 12, 2025 22:18
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.

4 participants