小编Jim*_* Xu的帖子

Add-AzTableRow 命令在 Azure Cloud Shell 中不可用

我正在尝试使用 Azure Cloud Shell 在我的表存储中插入新行,但我面临以下异常。所以让我知道我们需要用来插入的任何其他命令。

块引用

 Add-AzTableRow: The term 'Add-AzTableRow' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)

块引用

下面是命令:

$partitionKey1 = "partition1"
$partitionKey2 = "partition2"


Add-AzTableRow `
    -table $cloudTable `
    -partitionKey $partitionKey1 `
    -rowKey ("CA") -property @{"username"="Chris";"userid"=1}
Run Code Online (Sandbox Code Playgroud)

azure-storage azure-table-storage azure-cloud-shell

6
推荐指数
1
解决办法
1771
查看次数

Azure SAS 令牌无法与 Azure.Storage.Blobs BlobServiceClient 一起使用

我正在使用Azure.Storage.Blobs v12.1.0图书馆。我正在使用用户委托和 Azure 服务主体凭据生成 Blob 级 SAS 令牌,并尝试使用生成的 SAS 令牌上传 Blob。我完全按照Azure 中的此代码示例生成 SAS 令牌。

这是我用来创建 SAS 令牌的代码:

string blobEndpoint = string.Format("https://{0}.blob.core.windows.net", storageProviderSettings.AccountName);

        TokenCredential credential =
            new ClientSecretCredential(
                storageProviderSettings.TenantId,
                storageProviderSettings.ClientId,
                storageProviderSettings.ClientSecret,
                new TokenCredentialOptions());

        BlobServiceClient blobServiceClient = new BlobServiceClient(new Uri(blobEndpoint),
                                                            credential);

        BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName);
        BlobClient blobClient = containerClient.GetBlobClient(blobName);

        var delegationKey = await blobServiceClient.GetUserDelegationKeyAsync(DateTimeOffset.UtcNow, DateTimeOffset.UtcNow.AddDays(7));
        BlobSasBuilder sasBuilder = new BlobSasBuilder()
        {
            BlobContainerName = containerName,
            BlobName = blobName,
            Resource = "b",
            StartsOn = DateTimeOffset.UtcNow,
            ExpiresOn = DateTimeOffset.UtcNow.AddSeconds(expirySeconds)
        };
        sasBuilder.SetPermissions(BlobSasPermissions.All); …
Run Code Online (Sandbox Code Playgroud)

.net azure azure-storage azure-blob-storage azure-sas

3
推荐指数
1
解决办法
6338
查看次数