gpt4 book ai didi

azure - 如何读取Azure存储 key

转载 作者:行者123 更新时间:2023-12-03 02:51:36 25 4
gpt4 key购买 nike

我有一个 Azure 存储连接字符串,我想从中读取AccountName帐户 key
我可以获得帐户名称,但无法获得 key
谁能建议我如何阅读Key

ConnectionString : DefaultEndpointsProtocol=https;AccountName=dev;AccountKey=tsdsgyduysaugdsay4aR6EPn2Ie9YOILeEp5RRFXeeaJ9;EndpointSuffix=core.windows.net

var cloudStorageAccount = CloudStorageAccount.Parse(ConnectionString);

var storageCredentials = new StorageCredentials(cloudStorageAccount.Credentials.AccountName, cloudStorageAccount.Credentials.KeyName);

最佳答案

因此,如果您有存储凭据(帐户名和 key )和 Blob 的 URI,则可以通过两种方法创建 CloudBlockBlob 实例。

        var storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key;EndpointSuffix=core.windows.net;");
var blob = new CloudBlockBlob(new Uri("https://account-name.blob.core.windows.net/container-name/blob-name"), storageAccount.Credentials);

或者

        var storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key;EndpointSuffix=core.windows.net;");
var blobClient = storageAccount.CreateCloudBlobClient();
var blob = new CloudBlockBlob(new Uri("https://account-name.blob.core.windows.net/container-name/blob-name"), blobClient);

关于azure - 如何读取Azure存储 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55772662/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com