I am trying out couple of examples, which talks about using connecting Cosmos and Azure function with using access keys and other example talks about using Function with Azure storage without using Access keys, which are mentioned below
1) Using Cosmos DB with Azure function
https://docs.microsoft.com/en-us/azure/cosmos-db/managed-identity-based-authentication
2) Using Storage with Azure Function
https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad-msi
Both the example are working fine, when I try to deploy in Azure, but when I try to run these examples locally they don't work.
In both the examples I get 401 unauthorized. In my visual studio I have added the user through Tools -> Options -> Azure Service Authentication and same user is added a contributor for the above examples