Accessing Azure blob Storage in Logic App with Access Policy
using http/https connection.
For this, we will go to azure storage account, under
container we will create two policy.
1DayAccess – Read , Create and Write permission on container
with validity
ReadAccessOnly – Read only permission on container.
When we create Access Policy, we will also specify the Start
and Expiry time of policy, the policy will work only during specified time
interval.
Once we have created the Access policy for Blob container,
we will create Shared Access Signature for each policy. The SAS will be used to
access the container for respective operations.
Open Microsoft Azure Storage explorer, if don’t have storage
explorer, you can download the tool and connect to your azure subscriptions.
Right click the container à
click Get Shared Access Signature
Click required Access Policy, you will be able to see list access policy defined.
Click Create button to create URI and Query String
Copy thr URI and try sending some blob data using postman
tool, with above URI generated it will give an error
<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:
Time: </Message>
<AuthenticationErrorDetail>Signature did not match. String to sign used was
/blob/sablobstoragedemo/$root
1DayAccess
2018-03-28
</AuthenticationErrorDetail>
In
the above URL, we have to add blob name in URL for creation request
https://sab.blob.core.windows.net/educontainer/NewBlob?sv ---Same
as your Generated URL---
Now when we tested create operation with above URL, we got
success response and blob has been created successfully in container.
Now we will try to perform write operation with
ReadAccessPolicy SAS in Postman.
We got following error AuthorizationPermissionMismatch with detailed error message,
this is expected as we are trying to perform write operation with ready only access
policy.
<Code>AuthorizationPermissionMismatch</Code>
<Message>This request is not authorized to perform this operation using this permission.
Using SAS URL in logic app using HTTP connection
We have added Http connection in logic app, now we have to
set connection method, URI , Header and other parameter values.
Once you have setup the required property, now trigger the
logic app it will perform the create operation on container using specified SAS
URL.
Comments
Post a Comment