我想使用 RBAC 連接到 Azure 表存盤。我已經在門戶中完成了角色分配,但我找不到連接到 Azure Table form .NET 代碼的方法。我可以找到很多關于如何連接到 BlobClient 的檔案
static void CreateBlobContainer(string accountName, string containerName)
{
// Construct the blob container endpoint from the arguments.
string containerEndpoint = string.Format("https://{0}.blob.core.windows.net/{1}",
accountName,
containerName);
// Get a token credential and create a service client object for the blob container.
BlobContainerClient containerClient = new BlobContainerClient(new Uri(containerEndpoint),
new DefaultAzureCredential());
// Create the container if it does not exist.
containerClient.CreateIfNotExists();
}
但找不到 Azure Table Acess 的類似檔案。
有沒有人這樣做過?
uj5u.com熱心網友回復:
使用 Azure Active Directory 和當前一代 Azure SDK 的其他令牌源進行授權的模式基于Azure.Identity包中的憑據。
與您共享的代碼段大致等效的表格如下所示:
// Construct a new TableClient using a TokenCredential.
var client = new TableClient(
new Uri(storageUri),
tableName,
new DefaultAzureCredential());
// Create the table if it doesn't already exist to verify we've successfully authenticated.
await client.CreateIfNotExistsAsync();
可以在Azure 表授權示例和Azure.Identity 庫概述中找到更多資訊。
uj5u.com熱心網友回復:
我不確定我是否理解“使用 RBAC 連接到 Azure 表存盤”的意思。RBAC 是一種授權機制——而不是一種連接機制。
以下是有關 .NET 的 Azure 表客戶端庫的檔案: https ://docs.microsoft.com/en-us/dotnet/api/overview/azure/data.tables-readme
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/441691.html
