When connecting to the Cosmos API using Power BI Desktop you receive an error stating: "We encountered an error while trying to connect. Detail: Access to the resource is forbidden."
This error is caused when the user that is attempting to connect to the Cosmos API does not have the API User role assigned to them in the Administration section of the Cosmos Portal. To resolve this, log in to the Cosmos Portal and navigate to Administration -> Users. From there, make sure that the API User role is added for the user that is attempting to access the Cosmos API.
Once this role has been added for the user they will be allowed to connect to the Cosmos API from Power BI Desktop to pull in data. Note that it can take a few minutes for the change to take effect and for the Power BI Desktop to be able to connect to the Cosmos API.
More details on user roles and assigning roles to users can be viewed in the KB articles below:
If none of these resolutions solve the problem for you, be sure to email us at email@example.com and we will be happy to work with you to get your issue resolved.