我尝试使用以下命令从我的c#控制台应用程序获取rsa密钥(从azure)到crypt文件(用于上载)
我想我已经为我的应用设置了天蓝色的一切.Keys,Secret等,但我总是遇到以下错误。
AdalServiceException:AADSTS70002:验证凭据时出错。 AADSTS50012:提供了无效的客户端密钥。
我在这里已经阅读了其他一些答案,但没有人可以帮助我。
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
答案 0 :(得分:0)
我遇到了同样的问题,就我而言,我通过在Key Vault的访问策略设置中授予对已注册控制台应用程序的访问权限来解决了该问题。