Hello Samuel Bidó,
It looks like you're running into a 403 Forbidden error when trying to update your Digital Twin using the .NET SDK in your Docker container. Let's break down a few things to troubleshoot this.
- Permissions Check: Ensure that your App Registration has the necessary permissions. You've mentioned that you've assigned the "Azure Digital Twins Data Owner" role to your user, but make sure that the App Registration also has the appropriate permissions set up in the Azure portal under "API permissions" for Azure Digital Twins. Sometimes it might require admin consent for the permissions to take effect.
- Environment Variables: Since you're using Docker, double-check that your environment variables containing the credentials and other relevant information are correctly set in your
docker-compose.yml
. Make sure that the variables you are trying to access (likeDIGITAL_TWINS_INSTANCE
) are being passed correctly into the Docker container. - Service Principal Authentication: If you're running the application in a non-interactive environment (like from a Docker container), make sure you're using the correct method to authenticate. You might want to consider using a client secret or certificate-based authentication instead of environment variables for the credentials.
- Endpoint and Instance: Double-check the
adtInstanceUrl
to ensure it points to the correct Azure Digital Twins instance URL. - Rate Limits and Throttling: While less likely, keep in mind that Azure subscription limits or throttling could also be a reason for the error. Check your Azure subscription's usage and look for any limits on requests or updates.
- Logs and Trace: If possible, enable logging within your application to get more insight into what's happening when it attempts to make that update call. This could also help to identify if there are issues with the payload being sent in the request.
Hope this helps!
Thank you!