你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

BlobContainerPermissions 类

定义

表示容器的权限。

public sealed class BlobContainerPermissions
type BlobContainerPermissions = class
Public NotInheritable Class BlobContainerPermissions
继承
BlobContainerPermissions

示例


// If we want to set the permissions on a container, first we should get the existing permissions.
// This is important, because "SetPermissions" uses "replace" semantics, not "merge" semantics.
// If we skipped this step and just created a new BlobContainerPermissions object locally, 
// any existing policies would be deleted.
BlobContainerPermissions permissions = containerWithSharedKey.GetPermissions();

// Create a policy with read access.
SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy()
{
    SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(30),
    Permissions = SharedAccessBlobPermissions.Read
};

// Once uploaded, these permissions will allow SAS tokens created with the named policy
// to read from the container for 30 minutes, as specified in the policy.
// This only applies to SAS tokens created referencing this specific policy name on this specific container.
permissions.SharedAccessPolicies[policyName] = policy;

// This call actually uploads the permissions to the Azure Storage Service.
// Note that this can take up to 30 seconds after the call completes to take affect.
containerWithSharedKey.SetPermissions(permissions);

构造函数

BlobContainerPermissions()

初始化 BlobContainerPermissions 类的新实例。

属性

PublicAccess

获取或设置容器的公共访问设置。

SharedAccessPolicies

获取针对容器的一组共享访问策略。

适用于