-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Storage identity remove resource manager provider #15837
Storage identity remove resource manager provider #15837
Conversation
…dk-for-java into storage-identity
…th default identity
…th default identity
…ava into storage-identity
…rovider Merging from master.
…n and break when attmepting to use 2.0 version of resource management
<artifactId>azure-spring-boot-service</artifactId> | ||
<version>1.0.0</version> | ||
</parent> | ||
<artifactId>azure-identity-spring-library</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest change the artifact id to azure-identity-spring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mnriem, any objection to eliminating the Spring Environment identity library entirely and moving this functionality to the azure-spring-cloud-context
module?
credentials.put(name, credential); | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For system assigned identity, tenant id is needed.
For user assigned identity, tenant id and one optional client id is needed.
Code here has some problems work with system assigned identity and user assigned identity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be simpler to always fall back to DefaultAzureCredentialBuilder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defer to @mnriem on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For system assigned you do not need tenant id. User-assigned was not targeted and would need to be added if required.
} catch (Throwable t) { | ||
assertEquals(IllegalStateException.class, t.getClass(), | ||
"Unexpected exception class on missing configuration field."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use assertThrows() here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to use Exception annotations for generic exceptions (e.g. IllegalStateException
). Because these can be thrown from just about anywhere, it's important to ensure that it gets thrown from a particular place, not just anywhere in the test method.
*/ | ||
public SpringEnvironmentTokenBuilder fromEnvironment(Environment environment) { | ||
populateNamedCredential(environment, ""); | ||
String credentialNamesKey = AZURE_CREDENTIAL_PREFIX + "names"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to consider make use of @ConfigurationProperties and model different credentials as Map, so that we don't need the 'names' here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a repackaging of @mnriem's code, so perhaps he can answer better. My understanding is that a custom map is needed because property values could come from multiple sources, and this serves to consolidate them in a single place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'names' defines the order of the chain.
|
||
/** | ||
* @author Warren Zhu | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove @author annotation
# and use numbers and lower-case letters only. | ||
spring.cloud.azure.storage.account=ybstortst2 | ||
|
||
spring.cloud.azure.resource-group=test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resource group name should be replaced with some placeholder
spring.cloud.azure.resource-group=test | ||
|
||
# Change into your containerName and blobName | ||
blob=azure-blob://ybstrcntnr/testblob.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blob uri should be replaced with some placeholder
spring.cloud.azure.storage.account=springcloud | ||
|
||
spring.cloud.azure.region=westUS | ||
spring.cloud.azure.auto-create-resources=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use engineering system's capability to provision Azure resource dynamically. Better not to leave storage URL in config file.
@AutoConfigureMockMvc | ||
@TestPropertySource( | ||
locations = "classpath:application-test.properties") | ||
public class StorageApplicationIT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use dynamic provisioned Azure resource for test. SDK engineering system provide such capability.
It's also OK to remove test case for sample.
@@ -1,90 +1,98 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use space instead of tab.
@yevster I've pushed a commit to your branch to solve conflicts. Please remember to pull before push if you want to add more commits. |
@@ -0,0 +1,115 @@ | |||
= Spring Cloud Azure Storage Starter Sample |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have the sample in our samples, https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-resource, so I suggest we remove this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yevster I've pushed a commit to your branch to solve conflicts. Please remember to pull before push if you want to add more commits.
@saragluna, I had in-flight changes fixing the event hub binders sample. Now, I see that sample, along with several others have been removed. May I ask why?
I'll try to schedule a meeting this morning (your time) to discuss.
parameter not set (i.e. that bean would not be initialized)
…source-manager-provider
is this still active? |
I think it can be closed. Because we use this PR instead: #17119 @saragluna , please close this PR if you think it's OK to close it. |
i'm closing this PR since it's been a long time inactive, please reopen if needed |
No description provided.