<commit_before>Resource Management Authentication
==================================

For general information on resource management, see :doc:`Resource Management<resourcemanagement>`.

To be able to use use the ARM library, you need to obtain one of these instances:

* azure.common.credentials.ServicePrincipalCredentials
* azure.common.credentials.UserPassCredentials
* msrestazure.azure_active_directory.AdalAuthentication
 
And use it as credentials in your management configuration client. These three instances correspond to:

* OAuth authentication using Active Directory application and service principal
* OAuth authentication using Azure Active Directory user/password
* A wrapper on top of `ADAL for Python <https://github.com/AzureAD/azure-activedirectory-library-for-python>`

Using Service Principal
------------------------

There is now a detailed official tutorial to describe this:
https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/

At this point, you must have:

* Your client id. Found in the "client id" box in the "Settings" page of your application in the Azure portal.
* Your secret key. Generated when you have created the application. You cannot show the key after creation.
  If you've lost the current key, you must create a new one in the "Settings" page of your application.
* Your AD tenant id. It's an UUID (e.g. ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF) which points to the AD containing your application.
  You will find it in the URL when you are in the Azure portal in your AD, or in the "view endpoints" in any of the given url.

Then, you can create your credentials instance:

.. code:: python

    from azure.common.credentials import ServicePrincipalCredentials

    credentials = ServicePrincipalCredentials(
        client_id = 'ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF',
        secret = '<KEY>',
        tenant = 'ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF'
    )



Using AD User/Password
----------------------

1. Connect to the Azure Classic Portal with your admin account
2. `Create a user in your default AAD <https://azure.microsoft.com/en-us/documentation/articles/active-directory-create-users/>`__. **You must NOT activate Multi-Factor Authentication!**

3. Go to Settings - Administrators<commit_msg>Remove outdated service principal ID docs<commit_after>Resource Management Authentication
==================================

For general information on resource management, see :doc:`Resource Management<resourcemanagement>`.

To be able to use use the ARM library, you need to obtain one of these instances:

* azure.common.credentials.ServicePrincipalCredentials
* azure.common.credentials.UserPassCredentials
* msrestazure.azure_active_directory.AdalAuthentication
 
And use it as credentials in your management configuration client. These three instances correspond to:

* OAuth authentication using Active Directory application and service principal
* OAuth authentication using Azure Active Directory user/password
* A wrapper on top of `ADAL for Python <https://github.com/AzureAD/azure-activedirectory-library-for-python>`

Using Service Principal
------------------------

To set up Service Principal authentication, you must have:

* Your client ID, referred to in the Azure portal as the application ID.
* A secret authentication key for the application.
* Your Active Directory tenant id,
  referred to in the Azure portal as the directory ID.

The following tutorial describes where to find these values in the Azure portal:
https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/

Once you have the three required values, use them to instantiate a ``ServicePrincipalCredentials`` object:

.. code:: python

    from azure.common.credentials import ServicePrincipalCredentials

    credentials = ServicePrincipalCredentials(
        client_id = 'ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF',
        secret = '<KEY>',
        tenant = 'ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF'
    )



Using AD User/Password
----------------------

1. Connect to the Azure Classic Portal with your admin account
2. `Create a user in your default AAD <https://azure.microsoft.com/en-us/documentation/articles/active-directory-create-users/>`__. **You must NOT activate Multi-Factor Authentication!**
3. Go to Settings - Administrators
{'fraction_non_alphanumeric': 0.10393772893772894, 'fraction_numerical': 0.010531135531135532, 'mean_word_length': 4.17654028436019, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7299308', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1066, 'n_words': 448}