public async Task SasAuth()
        {
            string storageUri  = StorageUri;
            string accountName = StorageAccountName;
            string accountKey  = PrimaryStorageAccountKey;
            string tableName   = "OfficeSuppliesSasAuth" + _random.Next();

            #region Snippet:TablesAuthSas

            // Construct a new <see cref="TableServiceClient" /> using a <see cref="TableSharedKeyCredential" />.
            var credential = new TableSharedKeyCredential(accountName, accountKey);

            var serviceClient = new TableServiceClient(
                new Uri(storageUri),
                credential);

            // Build a shared access signature with the Write and Delete permissions and access to all service resource types.
            var sasUri = serviceClient.GenerateSasUri(
                TableAccountSasPermissions.Write | TableAccountSasPermissions.Delete,
                TableAccountSasResourceTypes.All,
                new DateTime(2040, 1, 1, 1, 1, 0, DateTimeKind.Utc));

            // Create the TableServiceClients using the SAS URI.
            var serviceClientWithSas = new TableServiceClient(sasUri);

            // Validate that we are able to create a table using the SAS URI with Write and Delete permissions.
            await serviceClientWithSas.CreateTableIfNotExistsAsync(tableName);

            // Validate that we are able to delete a table using the SAS URI with Write and Delete permissions.
            await serviceClientWithSas.DeleteTableAsync(tableName);

            #endregion
        }
        public void GenerateSasUri(TableServiceClient client, TableSharedKeyCredential cred)
        {
            TableAccountSasPermissions   permissions   = TableAccountSasPermissions.Add;
            TableAccountSasResourceTypes resourceTypes = TableAccountSasResourceTypes.Container;
            var expires     = DateTime.Now.AddDays(1);
            var expectedSas = new TableAccountSasBuilder(permissions, resourceTypes, expires).Sign(cred);

            var actualSas = client.GenerateSasUri(permissions, resourceTypes, expires);

            Assert.AreEqual("?" + expectedSas, actualSas.Query);
        }