0
votes

I'm trying to get feedback for push notifications, as described here: https://docs.microsoft.com/en-us/previous-versions/azure/reference/mt705560(v=azure.100).

Upon success, an Azure Storage Container URL is returned, complete with authentication token.

I have the URL:

https://pushpnsfb9bf61499e7c8fe.blob.core.windows.net/00000000002002698042?sv=2015-07-08&sr=c&sig=KbF1GtORNzAaCZH9UP7UFi9wMOYBmBgL%2BXLG3Qau9U0%3D&se=2020-08-29T19:10:17Z&sp=rl

But requesting it returns an authentication error:

<Error>
    <Code>AuthenticationFailed</Code>
    <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature...</Message>
    <AuthenticationErrorDetail>Signature did not match. String to sign used was... </AuthenticationErrorDetail>
</Error>

I am trying to follow the docs at https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-service-sas-create-dotnet?tabs=dotnet#create-a-service-sas-for-a-blob-container. The URL has sr=c, which seems to mean I need a "SAS for a blob container".

But where do I get the token? The returned URL has a sig querystring parameter - I tried using that to sign the request, but it didn't work.

What am I doing wrong?

1
Could you please tell me what you want to do with the container url? - Jim Xu
@JimXu, I am trying to make a request to that URL to get a list of expired device tokens. - alekop

1 Answers

1
votes

When we call the Get Platform Notification Services (PNS) feedback rest api, we will get a container url with sas token. And the sas token has read and list permissions at container level. So we can use azure blob rest api to read the content, properties, metadata or block list of any blob in the container or list blobs in the container with the token. For more details, please refer to here

For example

  1. Get container url enter image description here

  2. Test a. list blobs

GET https://pushpnsfb2f34ecd6733e74.blob.core.windows.net/00000000002000276266?
<sas token e.t. sv=2015-07-08&sr=c&sig=SQodHcRM6p04ag9rJZBqPDmr1NMd%2FbIWoPzMZrB9TpI%3D&se=2020-09-02T05%3A28%3A07Z&sp=rl>
 &restype=container&comp=list

enter image description here

b. read blob content

GET GET https://pushpnsfb2f34ecd6733e74.blob.core.windows.net/00000000002000276266/<blob name>?
<sas token e.t. sv=2015-07-08&sr=c&sig=SQodHcRM6p04ag9rJZBqPDmr1NMd%2FbIWoPzMZrB9TpI%3D&se=2020-09-02T05%3A28%3A07Z&sp=rl>

For more details about Azure Blob rest api, please refer to here.