spring-projects / spring-vault

Provides familiar Spring abstractions for HashiCorp Vault
https://spring.io/projects/spring-vault
Apache License 2.0
283 stars 186 forks source link

Azure MSI - VM Scale Set name must not be null #650

Closed ruffCode closed 3 years ago

ruffCode commented 3 years ago

It looks like in 2.3.1 a vmScaleSetName property was added to the AzureVmEnvironment class. I'm running this on a VM with no scale set an the vmss_name field is missing from the instance metadata query, which seems to be causing this exception.

Everything was working prior to 2.3.1. The only way I've been able to get this to work is by manually passing AzureVmEnvironment with a blank sting for scaleSetName in AzureMsiAuthenticationOptions.builder(), which is obviously not ideal.

This is a Kotlin project, not sure if that matters.

Thank you!

Caused by: java.lang.IllegalArgumentException: VM Scale Set name must not be null
    at org.springframework.util.Assert.notNull(Assert.java:201)
    at org.springframework.vault.authentication.AzureVmEnvironment.<init>(AzureVmEnvironment.java:66)
    at org.springframework.vault.authentication.AzureMsiAuthentication.toAzureVmEnvironment(AzureMsiAuthentication.java:215)
    at org.springframework.vault.authentication.AuthenticationSteps$MapStep.apply(AuthenticationSteps.java:536)
    at org.springframework.vault.authentication.AuthenticationStepsOperator.doMapStep(AuthenticationStepsOperator.java:201)
    at org.springframework.vault.authentication.AuthenticationStepsOperator.lambda$createMono$3(AuthenticationStepsOperator.java:134)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:113)
    ... 40 common frames omitted
ruffCode commented 3 years ago

I believe that #644 fixes this issue

mp911de commented 3 years ago

The change is merged now. I'm closing this one as a duplicate of #644. Care to retest against the latest 2.3.3 snapshots?

ruffCode commented 3 years ago

The change is merged now. I'm closing this one as a duplicate of #644. Care to retest against the latest 2.3.3 snapshots?

Everything works as expected, thank you!