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

[BUG] DefaultAzureCredential can't work properly in Spring Cloud Azure #30543

Closed
3 tasks done
saragluna opened this issue Aug 19, 2022 · 3 comments
Closed
3 tasks done
Assignees
Labels
azure-spring All azure-spring related issues bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library.
Milestone

Comments

@saragluna
Copy link
Member

Describe the bug

Found this issue when fixing this doc MicrosoftDocs/azure-docs#97305; the best case scenario is for users to run this application both locally and in Azure hosting environments without needing to modify any configurations.

If using system-assigned managed identity, users can use the following configuration

spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net

But if users are using user-assigned managed identity, users can not make it work in the Azure hosting environment:

spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net
spring.cloud.azure.keyvault.secret.property-sources[0].credential.client-id={Client ID of user-assigned managed identity}

The current solution I provided in the above PR is not ideal, because with such configurations, users won't be able to run the applications locally.

spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net
spring.cloud.azure.keyvault.secret.property-sources[0].credential.managed-identity-enabled=true

or

spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net
spring.cloud.azure.keyvault.secret.property-sources[0].credential.managed-identity-enabled=true
spring.cloud.azure.keyvault.secret.property-sources[0].credential.client-id={Client ID of user-assigned managed identity}

Exception or Stack Trace
N/A

To Reproduce
Follow this MicrosoftDocs/azure-docs#97305.

Code Snippet
N/A

Expected behavior
With the following configurations, users can run the application both locally and in the Azure hosting environment (with user-assigned managed identity)

spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net
spring.cloud.azure.keyvault.secret.property-sources[0].credential.client-id={Client ID of user-assigned managed identity}

Screenshots
N/A

Setup (please complete the following information):

  • OS: [e.g. MacOS]
  • IDE: [e.g. IntelliJ]
  • Library/Libraries: spring-cloud-azure-starter-keyvault-secrets:4.3.0
  • Java version: [e.g. 8]
  • App Server/Environment: Azure Spring Apps
  • Frameworks: Spring Boot

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

  • verbose dependency tree (mvn dependency:tree -Dverbose)
  • exception message, full stack trace, and any available logs

Additional context
N/A

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@saragluna saragluna added bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. azure-spring All azure-spring related issues azure-spring-4.0 labels Aug 19, 2022
@saragluna saragluna moved this to Todo in Spring Cloud Azure Aug 19, 2022
@saragluna saragluna changed the title [BUG] DefaultAzureCredential can work properly in Spring Cloud Azure [BUG] DefaultAzureCredential can't work properly in Spring Cloud Azure Aug 19, 2022
@moarychan
Copy link
Member

Related issue: #30683

@moarychan moarychan added this to the Backlog milestone Aug 31, 2022
@saragluna saragluna modified the milestones: Backlog, 2022-10 Sep 6, 2022
@saragluna saragluna self-assigned this Sep 6, 2022
@saragluna saragluna modified the milestones: 2022-10, 2022-11 Oct 9, 2022
@saragluna saragluna moved this from Todo to In Progress in Spring Cloud Azure Oct 17, 2022
@saragluna saragluna moved this from In Progress to Pending Review in Spring Cloud Azure Nov 2, 2022
@saragluna saragluna modified the milestones: 2022-11, 2022-12 Nov 4, 2022
@stliu
Copy link
Member

stliu commented Nov 8, 2022

it is not very clear to me the expected behavior, is it exptected to work on azure hosting with system-assigned managed identity?

let's say for this properties

spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net
spring.cloud.azure.keyvault.secret.property-sources[0].credential.client-id={Client ID of user-assigned managed identity}

is it expected to work w/o any change nor extra properties ( for example, from system environment )

  • Local with Azure Cli
  • Azure Hosting with system managed identity
  • Azure Hosting with user assigned identity

@saragluna saragluna moved this from Pending Review to Blocked in Spring Cloud Azure Nov 10, 2022
@saragluna saragluna modified the milestones: 2022-12, Backlog Dec 12, 2022
@stliu
Copy link
Member

stliu commented Dec 14, 2022

duplicated by #32443

@stliu stliu closed this as completed Dec 14, 2022
Repository owner moved this from Blocked to Done in Spring Cloud Azure Dec 14, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
azure-spring All azure-spring related issues bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants