ClientAuthenticationError using Trainer in Azure
Author: useCallback
Pull request: no

### System Info

**Environment Information:**
- OS: Azure ML notebook
- Jupyter Kernel:  Python 3.8 - Pytorch and Tensorflow


### Who can help?

@pacman100  @sgugger @amyeroberts 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

**Description:**
Encountered error while running VIT transformer Trainer on Azure. Code set up for training with specific arguments. During execution, error related to token retrieval and managed identity credentials occurred.

**Code:**
```
batch_size = 16
logging_steps = len(mura_dataset) // batch_size
training_args = TrainingArguments(
    output_dir='working/',
    per_device_train_batch_size=batch_size,
    per_device_eval_batch_size=batch_size,
    evaluation_strategy='epoch',
    save_strategy='epoch',
    num_train_epochs=3,
    fp16=True if torch.cuda.is_available() else False,
    logging_steps=logging_steps,
    learning_rate=1e-5,
    save_total_limit=2,
    remove_unused_columns=False,
)
trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=mura_dataset)
trainer.train()
```

**Error Message:**
```
[/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/transformers/optimization.py:411](https://vscode-remote+amlext-002b2f737562736372697074696f6e732f32616131623532382d303864332d343561312d623362632d3736386162323939363131652f7265736f7572636547726f7570732f6d656864692f70726f7669646572732f4d6963726f736f66742e4d616368696e654c6561726e696e6753657276696365732f776f726b7370616365732f6d656864692f636f6d70757465732f6b68616c666f756e6d6f68616d6564656c6d6568646931.vscode-resource.vscode-cdn.net/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/transformers/optimization.py:411): FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning
  warnings.warn(
ChainedTokenCredential failed to retrieve a token from the included credentials.
Attempted credentials:
	EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot this issue.
	ManagedIdentityCredential: No token received.
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.


---------------------------------------------------------------------------
ClientAuthenticationError                 Traceback (most recent call last)
Cell In[20], line 20
      3 training_args = TrainingArguments(
      4     output_dir='working/',
      5     per_device_train_batch_size=batch_size,
   (...)
     14     remove_unused_columns=False,
     15 )
     16 trainer = Trainer(
     17     model=model,
     18     args=training_args,
     19     train_dataset=mura_dataset)
---> 20 trainer.train()

File [/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/transformers/trainer.py:1539](https://vscode-remote+amlext-002b2f737562736372697074696f6e732f32616131623532382d303864332d343561312d623362632d3736386162323939363131652f7265736f7572636547726f7570732f6d656864692f70726f7669646572732f4d6963726f736f66742e4d616368696e654c6561726e696e6753657276696365732f776f726b7370616365732f6d656864692f636f6d70757465732f6b68616c666f756e6d6f68616d6564656c6d6568646931.vscode-resource.vscode-cdn.net/anaconda/envs/azureml_py38_PT_TF/lib/python3.8/site-packages/transformers/trainer.py:1539), in Trainer.train(self, resume_from_checkpoint, trial, ignore_keys_for_eval, **kwargs)
   1534     self.model_wrapped = self.model
   1536 inner_training_loop = find_executable_batch_size(
   1537     self._inner_training_loop, self._train_batch_size, args.auto_find_batch_size
   1538 )
-> 1539 return inner_training_loop(
   1540     args=args,
   1541     resume_from_checkpoint=resume_from_checkpoint,
   1542     trial=trial,
   1543     ignore_keys_for_eval=ignore_keys_for_eval,
...
Attempted credentials:
	EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot this issue.
	ManagedIdentityCredential: No token received.
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.
```


### Expected behavior

**Expected Behavior:**
Code should run successfully without  issues. Training should proceed normally using provided dataset.


Comments:
The error is raised by Azure and has nothing to do with Transformers, from what I can see.

@sgugger  seems like it's looking for some env variables 
The problem is that this error happens only when I start the trainer 
Does the trainer require setting some specific env variables ? 

Mmmm, can you try `report_to="none"` in your `TrainingArguments`? It might be a problem with the Azure reporting integration.

@sgugger  Thank you so much! I've finally solved the issue. You're right It's related to Azure

@useCallback How did you solve it on the Azure side? I'm struggling with the same issue, would appreciate a hint :)