在本课中,你将了解如何在 Blob 容器上创建策略,并生成 SAS 密钥。
存储访问策略提供对服务器端共享访问签名的额外控制级别。 共享访问签名是向容器、blob、队列和表授予受限访问权限的 URI。 使用此新的增强功能时,需要在具有读取、写入和列表权限的容器上创建策略。
可以使用以下方法之一创建策略和共享访问签名:
Azure SDK 中的 CloudBlobContainer.GetSharedAccessSignature 方法。
string signature = blob.GetSharedAccessSignature(new SharedAccessPolicy() { // Specify the expiration time for the signature. SharedAccessExpiryTime = DateTime.Now.Years(1), // Specify the permissions granted by the signature. Permissions = SharedAccessPermissions.Write | SharedAccessPermissions.Read });第三方 Azure 资源管理器工具,例如 Azure 存储资源管理器。
下一课: