public void CloudFileDirectorySAS() { CloudFileDirectory dir = this.testShare.GetRootDirectoryReference().GetDirectoryReference("dirfile"); CloudFile file = dir.GetFileReference("dirfile"); dir.Create(); file.Create(512); SharedAccessFilePolicy policy = new SharedAccessFilePolicy() { SharedAccessStartTime = DateTimeOffset.UtcNow.AddMinutes(-5), SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(30), Permissions = SharedAccessFilePermissions.Read | SharedAccessFilePermissions.List }; string sasToken = file.GetSharedAccessSignature(policy); CloudFileDirectory sasDir = new CloudFileDirectory(new Uri(dir.Uri.AbsoluteUri + sasToken)); TestHelper.ExpectedException( () => sasDir.FetchAttributes(), "Fetching attributes of a directory using a file SAS should fail", HttpStatusCode.Forbidden); sasToken = this.testShare.GetSharedAccessSignature(policy); sasDir = new CloudFileDirectory(new Uri(dir.Uri.AbsoluteUri + sasToken)); sasDir.FetchAttributes(); }