When you use a user-assigned identity, you need to specify the client_id of the MSI in ManagedIdentityCredential().
credential = ManagedIdentityCredential(client_id="xxxxxxxx")
To get the client_id, navigate to your function app -> Identity -> User assigned -> click your user-assigned identity -> copy the client_id.

When you use a user-assigned identity, you need to specify the client_id of the MSI in ManagedIdentityCredential().
credential = ManagedIdentityCredential(client_id="xxxxxxxx")
To get the client_id, navigate to your function app -> Identity -> User assigned -> click your user-assigned identity -> copy the client_id.

Here is how you would use Managed Identity in python:
from msrestazure.azure_active_directory import MSIAuthentication
creds = MSIAuthentication()
client = SecretClient(vault_url=MyVaultUrl, credentials=creds)
For this to work however, you have to have the identity assigned to your azure function as part of the deployment. If you are using terraform, there is a provider which you can use and it accepts an identity {} block where you can specify type="UserAssigned" and identity_ids = ["id1", "id2",...]


