Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds azure identity capability #84

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

fardarter
Copy link
Contributor

@fardarter fardarter commented Jan 19, 2024

This PR adds the ability to use an Azure Managed Identity for authentication.

  • Adds optional configuration for using an Azure managed identity via new parameters: auth_type, clientId
  • Adds support for the use of DefaultAzureCredential from the '@azure/identity' package
  • Supports both system and user assigned managed identities via optionally passing clientId to DefaultAzureCredential.

Addresses issue: #71

Can be tested by:
a) using a local authorised logged in user
b) deploying a working Strapi instance to an app service and using the system assigned identity permissions
c) assigning a working app service a user assigned managed identity and passing the identity id to the clientId configuration parameter.

RBAC role of Storage Blob Data Contributor over either the target account or the target container should be sufficient for upload.

@jakeFeldman
Copy link
Owner

Hello @fardarter thank you for the PR. Do you mind adding a description to the PR. Thanks

@fardarter
Copy link
Contributor Author

Hello @fardarter thank you for the PR. Do you mind adding a description to the PR. Thanks

Is this for release notes? Do you need a specific approach/format?

@fardarter
Copy link
Contributor Author

Hello @fardarter thank you for the PR. Do you mind adding a description to the PR. Thanks

Is this for release notes? Do you need a specific approach/format?

@jakeFeldman Just following up here. I'm keen to get this in so happy to adjust to your needs.

@jakeFeldman
Copy link
Owner

@fardarter Thanks for the follow up. Yes, having a detailed description with the changes, how to test, etc.. would be good for the release notes and posterity.

.eslintrc.js Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@fardarter
Copy link
Contributor Author

@fardarter Thanks for the follow up. Yes, having a detailed description with the changes, how to test, etc.. would be good for the release notes and posterity.

Have updated and will follow up on the other. I'm testing at the moment with a patch-package version of a dist I'm building locally with this code in all the scenarios listed. I can let you know if I run into any bugs today but I don't anticipate any.

@fardarter
Copy link
Contributor Author

@fardarter Thanks for the follow up. Yes, having a detailed description with the changes, how to test, etc.. would be good for the release notes and posterity.

Have updated and will follow up on the other. I'm testing at the moment with a patch-package version of a dist I'm building locally with this code in all the scenarios listed. I can let you know if I run into any bugs today but I don't anticipate any.

@jakeFeldman Have had successful deployments yesterday with clientId and plain msi for days before that.

src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
Copy link
Owner

@jakeFeldman jakeFeldman left a comment

Choose a reason for hiding this comment

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

This looks good. Just a few other clean up items and I would be happy to merge this.

Copy link
Owner

@jakeFeldman jakeFeldman left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. This looks good. Let me know, if you're interested in helping maintain the plugin. I would appreciate the help.

@jakeFeldman jakeFeldman merged commit 43e86a5 into jakeFeldman:master Feb 2, 2024
@fardarter
Copy link
Contributor Author

fardarter commented Feb 2, 2024

Thanks for the PR. This looks good. Let me know, if you're interested in helping maintain the plugin. I would appreciate the help.

Thanks for the merge. Looking forward to seeing it in a new release.

Honestly don't know what I'd be signing up for. I'm open to chatting about it.

I'm also maybe not the best candidate as I'm mainly an ops person. I stop interfacing with Strapi once it's deployed and I can use identities to access the things I need (trying to run secretless infra). I don't know much about the actual plugin interop.

@jakeFeldman
Copy link
Owner

Hey @fardarter, I just published version v3.4.0-beta. You can test it by adding the beta tag to your install script.

yarn add strapi-provider-upload-azure-storage@beta

If you want to test the version and make sure that both authTypes are working I can publish v3.4.0.

No worries wrt to maintenance. The amount of work is low/minimal, I just don't use Azure much these days.

@fardarter
Copy link
Contributor Author

fardarter commented Feb 5, 2024

Hey @fardarter, I just published version v3.4.0-beta. You can test it by adding the beta tag to your install script.

yarn add strapi-provider-upload-azure-storage@beta

If you want to test the version and make sure that both authTypes are working I can publish v3.4.0.

No worries wrt to maintenance. The amount of work is low/minimal, I just don't use Azure much these days.

Thanks, I'll do it for 'msi'. I don't use secrets, which is why I wanted the DefaultCredentials code.

Do you mainly just need someone to triage issues?

@fardarter
Copy link
Contributor Author

Hey @fardarter, I just published version v3.4.0-beta. You can test it by adding the beta tag to your install script.

yarn add strapi-provider-upload-azure-storage@beta

If you want to test the version and make sure that both authTypes are working I can publish v3.4.0.

No worries wrt to maintenance. The amount of work is low/minimal, I just don't use Azure much these days.

Working with beta package for msi flow.

@jakeFeldman
Copy link
Owner

Great to hear. Version 3.4.0 is available now. Thanks again for the PR

README.md Outdated
module.exports = ({ env }) => ({
upload: {
config: {
provider: "strapi-provider-upload-azure-storage",
providerOptions: {
auth_type: env("STORAGE_AUTH_TYPE", "default"),

Choose a reason for hiding this comment

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

why wihout this line produces error ? did msoft change something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Achmadrendra1 You need to include an authType now. It's so to distinguish between the two key types. If you're using the original variables, all you need to do it include that line.

Copy link
Owner

Choose a reason for hiding this comment

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

Sorry. In hindsight I should have published this as a major version since that was a breaking change.

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