[BUG] Key Vault ResourceModifiedException: Status Code 400
See original GitHub issueDescribe the bug
We ran into this KV exception when running ITs with libs in the buildFromSource
step. We managed to create a minimal project to reproduce the issue. https://github.com/saragluna/kv-it-issue.
Exception or Stack Trace
Exception in thread "main" com.azure.core.exception.ResourceModifiedException: Status code 400, "{"error":{"code":"BadParameter","message":"Property has invalid value\r\n"}}"
at com.azure.core.implementation.http.rest.RestProxyBase.instantiateUnexpectedException(RestProxyBase.java:366)
at com.azure.core.implementation.http.rest.SyncRestProxy.ensureExpectedStatus(SyncRestProxy.java:121)
at com.azure.core.implementation.http.rest.SyncRestProxy.handleRestReturnType(SyncRestProxy.java:206)
at com.azure.core.implementation.http.rest.SyncRestProxy.invoke(SyncRestProxy.java:76)
at com.azure.core.implementation.http.rest.RestProxyBase.invoke(RestProxyBase.java:110)
at com.azure.core.http.rest.RestProxy.invoke(RestProxy.java:95)
at com.sun.proxy.$Proxy3.setSecret(Unknown Source)
at com.azure.security.keyvault.secrets.implementation.SecretClientImpl.setSecretWithResponse(SecretClientImpl.java:497)
at com.azure.security.keyvault.secrets.SecretClient.setSecretWithResponse(SecretClient.java:147)
at com.azure.security.keyvault.secrets.SecretClient.setSecret(SecretClient.java:118)
at com.example.demo.DemoApplication.main(DemoApplication.java:19)
To Reproduce https://github.com/saragluna/kv-it-issue
Code Snippet
private static final String NAME = "sample-key";
private static final String VALUE = "sample-value";
SecretClient client = new SecretClientBuilder()
.vaultUrl("XXX")
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
client.setSecret(NAME, VALUE);
KeyVaultSecret secret = client.getSecret(NAME);
System.out.println(secret.getValue());
Expected behavior The code can work fine.
Screenshots
Setup (please complete the following information):
- OS: [MacOS]
- IDE: [IntelliJ]
- Library/Libraries: [azure-security-keyvault-secrets:4.5.0-beta.1]
- Java version: [8]
- App Server/Environment: [N/A]
- Frameworks: [N/A]
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
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
@vcolin7, just did some tests.
Before applying the latest changes, the error only happened to the sync client.
After applying the latest changes, both sync and async clients can work now.
So I am going to close this issue. Thanks for the help.
@vcolin7, thanks. Will try it now.