When using DefaultAzureCredential through NodeJS SDK to send an email through the EmailClient I get a Denied By Resource Provider

Ryan Zielke 5 Reputation points
2023-03-20T01:12:15.41+00:00

When using DefaultAzureCredential through NodeJS SDK to send an email through the EmailClient I get a Denied By Resource Provider. The Azure Function is created. It doesn't tell me what resource provider is denying and I have a global admin and contributor role set for Communication Service

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,234 questions
{count} vote

2 answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-03-24T08:41:27.87+00:00

    @Ryan Zielke ,

    I believe you’re referring to the steps outlined in this doc
    Azure Communication Email client library for JavaScript - please do confirm.

    As mentioned in the doc - You can also authenticate with Azure Active Directory using the Azure Identity library. To use the DefaultAzureCredential provider shown below, or other credential providers provided with the Azure SDK, please install the @azure/identity package:

    npm install @azure/identity

    Bash: npm install @azure/identity

    
    const { DefaultAzureCredential } = require("@azure/identity");
    
     
    
    // DefaultAzureCredential expects the following three environment variables:
    
    // - AZURE_TENANT_ID: The tenant ID in Azure Active Directory
    
    // - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant
    
    // - AZURE_CLIENT_SECRET: The client secret for the registered application
    
    const credential = new DefaultAzureCredential();
    
    

    I understand you have already verified admin and contributor roles, if you haven’t checked, you may try to check the Azure portal to see if there are any other restrictions or policies that are preventing the user from accessing the resource.

     

    Also, ensure Registration Provider (RP)** is registered.

     

     --Azure Portal >> Select the subscription you want to use to register a resource provider >> under Settings select Resource providers.

    --To register a resource provider, select the resource provider and then select Register

    Resource providers for Azure services

     
    Kindly let us know how it goes, I'll follow-up with you further.  


  2. Trung Phạm 5 Reputation points
    2023-09-22T11:04:45.9133333+00:00

    I am having the same issue, I tried this link: https://learn.microsoft.com/en-us/azure/communication-services/concepts/authentication#azure-ad-authentication and got credentials but it did not work for me.


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.