1
votes

I try to get from my c# console application a rsa key (from azure) to crypt files (for uploading) with the following command

I think i have set everything fine on azure for my application.Keys,Secret and other , but i got always the following error.

AdalServiceException: AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided.

I have read some other answers here, but no one could help me.

StorageCredentials creds = new StorageCredentials(
ConfigurationManager.AppSettings["accountName"],
ConfigurationManager.AppSettings["accountKey"]);

CloudStorageAccount account = new CloudStorageAccount(creds, useHttps: true);
CloudBlobClient client = account.CreateCloudBlobClient();
CloudBlobContainer contain = client.GetContainerReference  
(ConfigurationManager.AppSettings["container"]);
contain.CreateIfNotExists();


KeyVaultKeyResolver cloudResolver = new KeyVaultKeyResolver(GetToken);
var rsa = cloudResolver.ResolveKeyAsync("xxx",
CancellationToken.None).GetAwaiter().GetResult();

Innere Ausnahme 1:

AdalServiceException: AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided.
Trace ID: 1af5b50e-b4fd-4fb6-b795-d1ddaa390400
Correlation ID: 87ab5cc5-5209-4074-af00-38ab385ae847
Timestamp: 2017-10-11 18:40:32Z

Innere Ausnahme 2:

HttpRequestException:  Response status code does not indicate success: 401 (Unauthorized).

Innere Ausnahme 3:

AdalException: {"error":"invalid_client","error_description":"AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided.\r\nTrace ID: 1af5b50e-b4fd-4fb6-b795-d1ddaa390400\r\nCorrelation ID: 87ab5cc5-5209-4074-af00-38ab385ae847\r\nTimestamp: 2017-10-11 18:40:32Z","error_codes":[70002,50012],"timestamp":"2017-10-11 18:40:32Z","trace_id":"1af5b50e-b4fd-4fb6-b795-d1ddaa390400","correlation_id":"87ab5cc5-5209-4074-af00-38ab385ae847"}: Unknown error
1
Were you able to fix it? - jambis

1 Answers

0
votes

I had the same issue and in my case I solved it by granting access to the registered console app in Access policies settings of Key Vault.