显然,可以使用共享访问策略来控制对 Azure 队列的访问。此处的示例http://msdn.microsoft.com/en-us/library/windowsazure/hh508996证实了这一点,但仅提供了 blob 共享访问策略的示例。有没有人对队列(和表)如何实现相同的参考有任何参考?
问问题
2127 次
2 回答
2
您可以在 Windows Azure 存储博客上找到完整的示例:介绍表 SAS(共享访问签名)、队列 SAS 和更新到 Blob SAS。这是将策略分配给队列的部分:
// Create the GC queue SAS policy.
QueuePermissions gcQueuePermissions = new QueuePermissions();
SharedAccessQueuePolicy gcQueuePolicy = new SharedAccessQueuePolicy()
{
// Providing the max duration
SharedAccessExpiryTime = DateTime.MaxValue,
// Permission is granted to process queue messages.
Permissions = SharedAccessQueuePermissions.ProcessMessages
};
// Associate the above policy with a signed identifier
gcQueuePermissions.SharedAccessPolicies.Add(
gcPolicySignedIdentifier,
gcQueuePolicy);
// The below call will result in a Set Queue ACL request to be sent to
// Windows Azure Storage in order to store the policy and associate it with the
// "GCAccessPolicy" signed identifier that will be referred to
// by the generated SAS token
this.gcQueue.SetPermissions(gcQueuePermissions);
于 2012-09-06T14:15:36.803 回答
0
表 SAS (特别是示例的 SAS 令牌生产者部分)的公告帖子是否可以帮助您?在我看来,SAS 可用于从 SDK 1.7 开始的表和队列。
于 2012-09-06T14:19:56.220 回答