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

Storage identity remove resource manager provider #15837

Conversation

yevster
Copy link

@yevster yevster commented Sep 30, 2020

No description provided.

@ghost ghost added the azure-spring All azure-spring related issues label Sep 30, 2020
<artifactId>azure-spring-boot-service</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>azure-identity-spring-library</artifactId>
Copy link
Contributor

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

Copy link
Author

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;
}

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

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.");
}
Copy link
Contributor

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.

Copy link
Author

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";
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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
*/
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 {
Copy link
Contributor

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"?>
Copy link
Contributor

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.

@saragluna
Copy link
Member

@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
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

@yevster yevster Oct 28, 2020

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.

@stliu
Copy link
Member

stliu commented Jun 10, 2021

is this still active?

@chenrujun
Copy link

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.

@stliu
Copy link
Member

stliu commented Jun 15, 2021

i'm closing this PR since it's been a long time inactive, please reopen if needed

@stliu stliu closed this Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants