I have a .NET 8 Blazor Server application that accesses an Azure App Configuration, which references some secrets in Azure Keyvault. Both the App Configuration and the Keyvault are protected by PIM. When I activate the relevant roles and run my application locally, my application is still denied access.
If I wait for at least an hour, the issue disappears. We're working on this application with 2 engineers. I use Rider, but my colleague uses Visual Studio. He has the same problem but found out logging out and back in in Visual Studio resolves the issue.
It seems the cache of a token or credentials doesn't get properly invalidated when necessary, but I have no clue how to research this further.
According to Azure RBAC propagation latency:
Since Azure Resource Manager sometimes caches configurations and data to improve performance, it can sometimes take up to 30 minutes for changes to take effect when you assign roles or remove role assignments.
Using Azure CLI, you can force a refresh of your role assignment changes by signing out and signing in.
See also Troubleshoot Azure RBAC.