Azure / Azure/MachineLearningNotebooks

AttributeError: 'InteractiveLoginAuthentication' object has no attribute 'get_token'

Open
#1,366 11 comments 0 reactions 0 assignees View on GitHub
ADO product-issue Reinforcement Learning Workspace Management
Dominant language
Jupyter Notebook
Stars
4.4k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Following this notebook exactly. The only code change being changing create_or_update() to begin_create_or_update() as advised by a previous issue.

```
from azure.mgmt.network import NetworkManagementClient

# Virtual network name
vnet_name ="rl_pong_vnet"

# Default subnet
subnet_name ="default"

# The Azure subscription you are using
subscription_id=ws.subscription_id

# The resource group for the reinforcement learning cluster
resource_group=ws.resource_group

# Azure region of the resource group
location=ws.location

network_client = NetworkManagementClient(ws._auth_object, subscription_id)

async_vnet_creation = network_client.virtual_networks.begin_create_or_update(
resource_group,
vnet_name,
{
'location': location,
'address_space': {
'address_prefixes': ['10.0.0.0/16']
}
}
)

async_vnet_creation.wait()
print("Virtual network created successfully: ", async_vnet_creation.result())
```

I get result:

```
AttributeError Traceback (most recent call last)
in
24 'location': location,
25 'address_space': {
---> 26 'address_prefixes': ['10.0.0.0/16']
27 }
28 }

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/mgmt/network/v2020_08_01/operations/_virtual_networks_operations.py in begin_create_or_update(self, resource_group_name, virtual_network_name, parameters, **kwargs)
319 parameters=parameters,
320 cls=lambda x,y,z: x,
--> 321 **kwargs
322 )
323

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/mgmt/network/v2020_08_01/operations/_virtual_networks_operations.py in _create_or_update_initial(self, resource_group_name, virtual_network_name, parameters, **kwargs)
261 body_content_kwargs['content'] = body_content
262 request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
--> 263 pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
264 response = pipeline_response.http_response
265

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_base.py in run(self, request, **kwargs)
209 else _TransportRunner(self._transport)
210 )
--> 211 return first_node.send(pipeline_request) # type: ignore

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_base.py in send(self, request)
69 _await_result(self._policy.on_request, request)
70 try:
---> 71 response = self.next.send(request)
72 except Exception: # pylint: disable=broad-except
73 if not _await_result(self._policy.on_exception, request):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/mgmt/core/policies/_base.py in send(self, request)
45 # type: (PipelineRequest[HTTPRequestType], Any) -> PipelineResponse[HTTPRequestType, HTTPResponseType]
46 http_request = request.http_request
---> 47 response = self.next.send(request)
48 if response.http_response.status_code == 409:
49 rp_name = self._check_rp_not_registered_err(response)

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_base.py in send(self, request)
69 _await_result(self._policy.on_request, request)
70 try:
---> 71 response = self.next.send(request)
72 except Exception: # pylint: disable=broad-except
73 if not _await_result(self._policy.on_exception, request):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_base.py in send(self, request)
69 _await_result(self._policy.on_request, request)
70 try:
---> 71 response = self.next.send(request)
72 except Exception: # pylint: disable=broad-except
73 if not _await_result(self._policy.on_exception, request):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_base.py in send(self, request)
69 _await_result(self._policy.on_request, request)
70 try:
---> 71 response = self.next.send(request)
72 except Exception: # pylint: disable=broad-except
73 if not _await_result(self._policy.on_exception, request):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_base.py in send(self, request)
69 _await_result(self._policy.on_request, request)
70 try:
---> 71 response = self.next.send(request)
72 except Exception: # pylint: disable=broad-except
73 if not _await_result(self._policy.on_exception, request):

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/policies/_redirect.py in send(self, request)
155 redirect_settings = self.configure_redirects(request.context.options)
156 while retryable:
--> 157 response = self.next.send(request)
158 redirect_location = self.get_redirect_location(response)
159 if redirect_location and redirect_settings['allow']:

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/policies/_retry.py in send(self, request)
434 start_time = time.time()
435 self._configure_timeout(request, absolute_timeout, is_response_error)
--> 436 response = self.next.send(request)
437 if self.is_retry(retry_settings, response):
438 retry_active = self.increment(retry_settings, response=response)

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_base.py in send(self, request)
67 :rtype: ~azure.core.pipeline.PipelineResponse
68 """
---> 69 _await_result(self._policy.on_request, request)
70 try:
71 response = self.next.send(request)

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/_tools.py in await_result(func, *args, **kwargs)
27 def await_result(func, *args, **kwargs):
28 """If func returns an awaitable, raise that this runner can't handle it."""
---> 29 result = func(*args, **kwargs)
30 if hasattr(result, "__await__"):
31 raise TypeError(

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/core/pipeline/policies/_authentication.py in on_request(self, request)
91
92 if self._token is None or self._need_new_token:
---> 93 self._token = self._credential.get_token(*self._scopes)
94 self._update_headers(request.http_request.headers, self._token.token)
95

AttributeError: 'InteractiveLoginAuthentication' object has no attribute 'get_token'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.