I am trying to stop a virtual machine in the azure cloud using the azure-python-sdk. I am following this page https://github.com/Azure-Samples/virtual-machines-python-manage and I have created an Azure active directory application by following this link, https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal.
As a first step I am trying to authenticate using a call to ServicePrincipalCredentials passing client_id, secret, and tenant, but the connection throws the following error, 'Keyring cache token has failed: (1783, 'CredWrite', 'The stub received bad data')'
The application has a Virtual Machine Contributor permission setup. Is this a permission issue?