Communication Service: Denied by the resource provider with emauls

Andrei Toderean Dascalu 6 Reputation points
2024-12-05T15:58:34.4166667+00:00

I am trying to follow the https://learn.microsoft.com/en-us/azure/communication-services/tutorials/postman-tutorial but update it to send emails

Unfortunately I keep getting a generic error

{
    "error": {
        "code": "Denied",
        "message": "Denied by the resource provider."
    }
}

When I use the JS client library with the same endpoint and accessKey, it all works yet when I try to use postman and the provided tutorial, it does not work.

The tutorial seems to partially contradict the signing documentation found at https://learn.microsoft.com/en-us/rest/api/communication/authentication

mainly that you should set a header called "x-ms-date" whereas the Postmain tutorial sets a header called "Date" pm.request.headers.upsert({key:'Date', value: dateStr});

I have tried either version but it does not work. Can anyone help?

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
941 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 23,141 Reputation points Microsoft Employee
    2024-12-24T10:02:14.9933333+00:00

    @Andrei Toderean Dascalu Thanks for posting your question in Microsoft Q&A, apologize for any inconvenience caused on this. Based on the above information, I understand that you are trying to send an email using REST API from postman and you are facing the issues. Correct me if my understanding wrong.

    To reproduce this behavior, I have followed the same documentation steps and using post man I am able to send the email using email Send Rest API without any issues as shown below.

    ACS_postman

    mainly that you should set a header called "x-ms-date" whereas the Postmain tutorial sets a header called "Date" pm.request.headers.upsert({key:'Date', value: dateStr});

    Regarding this query, you need to have hmac-sha256-signature as Authorization header inorder to work with ACS using Rest API's. In which x-ms-date is one of the request parameters (which needs date) + along with Key in signature formation.

    In the Pre-request script sample, they have declared it as Date and passing it as same while creating the signature as shown below. User's image

    Similarly, in this other example mentioned here they have declared it as data and while constructing the signature they have passed it x-ms-date.

    User's image

    In the above both examples, we are passing the request header names as different but for the Authorization signature you need to have date.

    Hope this helps, let me know if you have any further questions on this.

    Please accept as Yes if the answer is helpful so that it can help others in the community.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.