在本課程中,您將瞭解如何在 Blob 容器上建立原則,併產生 SAS 金鑰。
預存存取原則提供伺服器端共用存取簽章的額外控制層級。 共用存取簽章是一種 URI,可授與容器、Blob、佇列和數據表的限制訪問許可權。 使用此新的增強功能時,您必須在具有讀取、寫入和列表許可權的容器上建立原則。
您可以使用下列其中一種方法來建立原則和共用存取簽章:
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 Storage Explorer。
下一課: