oscerd commented on code in PR #12865: URL: https://github.com/apache/camel/pull/12865#discussion_r1461881873
########## components/camel-azure/camel-azure-storage-blob/src/main/docs/azure-storage-blob-component.adoc: ########## @@ -535,6 +535,50 @@ from("direct:copyBlob") In this way the file.txt in the container containerblob1 of the account 'account', will be copied to the container containerblob2 of the same account. +=== SAS Token generation example + +SAS Blob Container tokens can be generated programmatically or via Azure UI. In order to generate the token with java code, the following can be done: + +[source,java] +-------------------------------------------------------------------------------- + +BlobContainerClient blobClient = new BlobContainerClientBuilder() + .endpoint(String.format("https://%s.blob.core.windows.net/%s", accountName, accessKey)) + .containerName(containerName) + .credential(new StorageSharedKeyCredential(accountName, accessKey)) + .buildClient(); + + // Create a SAS token that's valid for 1 day, as an example + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + + // Assign permissions to the SAS token + BlobContainerSasPermission blobContainerSasPermission = new BlobContainerSasPermission() + .setWritePermission(true) + .setListPermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + .setReadPermission(true); + + BlobServiceSasSignatureValues sasSignatureValues = new BlobServiceSasSignatureValues(expiryTime, blobContainerSasPermission); + + return blobClient.generateSas(sasSignatureValues); +-------------------------------------------------------------------------------- + +The generated SAS token can be then stored to an application.properties file so that it can be loaded by the camel route, example: + +[source,properties] +-------------------------------------------------------------------------------- + +camel.component.azure-storage-blob.sas-token=$SAS_TOKEN +-------------------------------------------------------------------------------- + +[source,java] +-------------------------------------------------------------------------------- + +from("direct:copyBlob") + .to("azure-storage-blob://account/containerblob2?operation=uploadBlockBlob&&credentialType=AZURE_SAS") Review Comment: I guess one "&" could be removed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org