chaostoolkit-azure
chaostoolkit-azure copied to clipboard
Unable to authenticate using SPN
Getting failed: AttributeError: 'ServicePrincipalCredentials' object has no attribute 'get_token'
Below is experiment.json parameters for azure authentication. "configuration": { "azure_subscription_id": "" , "region_a_resource_group": "" , "region_a_app_service": "*" , "traffic_manager_endpoint": ""
},
"secrets": {
"azure": {
"client_id": "******"
,
"client_secret": "********"
,
"tenant_id": "******"
}
},
**[2021-03-20 17:08:26 WARNING] Azure cloud not provided. Using AZURE_PUBLIC_CLOUD as default [2021-03-20 17:08:27 ERROR] => failed: AttributeError: 'ServicePrincipalCredentials' object has no attribute 'get_token'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/chaoslib/activity.py", line 228, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/usr/local/lib/python3.7/site-packages/chaoslib/provider/python.py", line 60, in run_python_activity
sys.exc_info()[2])
File "/usr/local/lib/python3.7/site-packages/chaoslib/provider/python.py", line 55, in run_python_activity
return func(**arguments)
File "/usr/local/lib/python3.7/site-packages/chaosazure/webapp/actions.py", line 83, in start_webapp
choice = __fetch_webapp_at_random(filter, configuration, secrets)
File "/usr/local/lib/python3.7/site-packages/chaosazure/webapp/actions.py", line 134, in __fetch_webapp_at_random
webapps = fetch_webapps(filter, configuration, secrets)
File "/usr/local/lib/python3.7/site-packages/chaosazure/webapp/actions.py", line 119, in fetch_webapps
webapps = fetch_resources(filter, RES_TYPE_WEBAPP, secrets, configuration)
File "/usr/local/lib/python3.7/site-packages/chaosazure/common/resources/graph.py", line 23, in fetch_resources
resources = client.resources(_query_request)
File "/usr/local/lib/python3.7/site-packages/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py", line 68, in resources
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/_base.py", line 211, in run
return first_node.send(pipeline_request) # type: ignore
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
File "/usr/local/lib/python3.7/site-packages/azure/mgmt/core/policies/_base.py", line 47, in send
response = self.next.send(request)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
[Previous line repeated 1 more time]
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/policies/_redirect.py", line 158, in send
response = self.next.send(request)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/policies/_retry.py", line 435, in send
response = self.next.send(request)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/_base.py", line 69, in send
_await_result(self._policy.on_request, request)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/_tools.py", line 29, in await_result
result = func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/azure/core/pipeline/policies/_authentication.py", line 93, in on_request
self._token = self._credential.get_token(*self._scopes)
chaoslib.exceptions.ActivityFailed: AttributeError: 'ServicePrincipalCredentials' object has no attribute 'get_token'
[31m[2021-03-20 16:47:45 ERROR] [activity:188][39m => failed: AttributeError: 'ServicePrincipalCredentials' object has no attribute 'get_token'**
@Lawouach Lawouach
Same here...
Reading on StackOverFlow, it seems the authentication should upgraded / switched to a new API. Seems straightforward, but I am not exactly the Python guy...
Same here. Could the authors (@Lawouach @bugra-derre @buderre @seriousscorpion @mkaszub) share the versions of their python packages, which they can successfully run this driver? Such as these packages:
- chaostoolkit
- msrestazure
- msrest
- azure-mgmt-compute
- azure-mgmt-resourcegraph
- azure-mgmt-web
- azure-common
- azure-core
This project does specify the needed python packages in requirements.txt, but doesn't specify their versions. This may be the reason causing this problem.