I trying to create a function in AL that will create a SAS auth to be able to send a message to Azure.
Below is an example of a call that returns a complete SAS-token that I can use for a http-request.
This is the function that creates the token.
But when I try to use the SAS-key I get an error saying that the the token is incorrect, not invalid, just simply wrong.
On a visual inspection of the key it seems very similar to a real token created.
Obviously there is something wrong in my function but I cannot find out why.
Help!
After lots of testing and debugging and a good night sleep I have made some adjustments and the function is now working correctly.
My error was primarily that I used the Base64decode on the Key. However, the key should be used as-is and not be decoded before used.
Complete working function below if anyone else stumbles upon this. The function will return a complete SAS-token that can be used as Authorization in a http-request header to send a message to an Azure Service Bus Queue.
Thank you Sir for a quick response.
The link shows similar documentation that MS has in it's documentation
learn.microsoft.com/.../service-bus-sas
learn.microsoft.com/.../generate-sas-token
However, I suspect that the Crypto.GenerateBase64KeyedHashAsBase64String using HMACSHA256 does not give me a correct response and thus creating an invalid authorization.
Or is there a better way to create a SAS auth in BC/AL?
Hi,
You can visit the below link, see if it help you.
github.com/.../service-bus-shared-access-signature-authentication.md
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156