@Hamza Sote Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
As I understand you're trying to use an access token obtained for the wrong audience or resource to open the SFTP service using an HTTP trigger in Power Automate. The error message you're seeing indicates that the access token should match one of the allowed audiences, which are:
- https://management.core.windows.net/
- https://management.core.windows.net
- https://management.azure.com/
- https://management.azure.com
To resolve this issue, you can try the following steps:
- Make sure that you're obtaining the access token for the correct audience or resource. In this case, you should obtain the access token for the SFTP service that you're trying to access.
- If you're using the Azure AD connector in Power Automate to obtain the access token, make sure that you're specifying the correct resource parameter in the
Get tokenaction. The resource parameter should be set to the URI of the SFTP service that you're trying to access.
If you're still having issues, you can try using the HTTP action in Power Automate to make a direct HTTP request to the SFTP service. You can include the access token in the Authorization header of the HTTP request. Here's an example of how to do this:
HTTP POST https://sftp.example.com/api/files
Replace https://sftp.example.com/api/files with the URI of the SFTP service that you're trying to access, and replace the access token in the Authorization header with the one that you obtained for the correct audience or resource.
Obtaining an access token for the wrong audience or resource when trying to open the SFTP service using HTTP Trigger with PowerAutomate in Azure, you need to ensure that the Audience property is set correctly. The Audience property should be set to the target resource ID, which is the URI of the resource that you want to access. This ensures that the access tokens used for authentication are valid for the correct resource. You can also specify the root service URL for a specific storage account. For more information about authorizing access with Microsoft Entra ID for Azure Storage, see the following documentation:
- Authorize access to Azure blobs and queues by using Microsoft Entra ID
- Authorize access to Azure Storage with Microsoft Entra ID
For further troubleshooting, you can refer to the following resources:
- Authenticate access and connections to Azure resources with managed identities in Azure Logic Apps
- Connect to an SFTP file server from workflows in Azure Logic Apps - Troubleshooting
Troubleshoot common issues with triggers - Power Automate
Please let us know if you have any further queries. I’m happy to assist you further.
---Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.