static string GetBlobSasUri(CloudBlobContainer container) { //Get a reference to a blob within the container. //CloudBlockBlob blob = container.GetBlockBlobReference("sasblobzwj.txt"); CloudAppendBlob blob = container.GetAppendBlobReference("sasblobzwj.txt"); //Upload text to the blob. If the blob does not yet exist, it will be created. //If the blob does exist, its existing content will be overwritten. //string blobContent = "This blob will be accessible to clients via a shared access signature (SAS)."; //blob.UploadText(blobContent); //Set the expiry time and permissions for the blob. //In this case, the start time is specified as a few minutes in the past, to mitigate clock skew. //The shared access signature will be valid immediately. SharedAccessBlobPolicy sasConstraints = new SharedAccessBlobPolicy(); sasConstraints.SharedAccessStartTime = DateTimeOffset.UtcNow.AddMinutes(-5); sasConstraints.SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddHours(24); sasConstraints.Permissions = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write; //Generate the shared access signature on the blob, setting the constraints directly on the signature. string sasBlobToken = blob.GetSharedAccessSignature(sasConstraints); //Return the URI string for the container, including the SAS token. return(blob.Uri + sasBlobToken); }