|
@@ -111,20 +111,24 @@ service associated with the client id. See [*Active Directory Library For Java*]
|
|
|
##### Generating the Service Principal
|
|
|
|
|
|
1. Go to [the portal](https://portal.azure.com)
|
|
|
-2. Under "Browse", look for Active Directory and click on it.
|
|
|
-3. Create "Web Application". Remember the name you create here - that is what you will add to your ADL account as authorized user.
|
|
|
+2. Under services in left nav, look for Azure Active Directory and click it.
|
|
|
+3. Using "App Registrations" in the menu, create "Web Application". Remember
|
|
|
+ the name you create here - that is what you will add to your ADL account
|
|
|
+ as authorized user.
|
|
|
4. Go through the wizard
|
|
|
-5. Once app is created, Go to app configuration, and find the section on "keys"
|
|
|
+5. Once app is created, go to "keys" under "settings" for the app
|
|
|
6. Select a key duration and hit save. Save the generated keys.
|
|
|
-7. Note down the properties you will need to auth:
|
|
|
- - The client ID
|
|
|
+7. Go back to the App Registrations page, and click on the "Endpoints" button
|
|
|
+ at the top
|
|
|
+ a. Note down the "Token Endpoint" URL
|
|
|
+8. Note down the properties you will need to auth:
|
|
|
+ - The "Application ID" of the Web App you created above
|
|
|
- The key you just generated above
|
|
|
- - The token endpoint (select "View endpoints" at the bottom of the page and copy/paste the OAuth2 .0 Token Endpoint value)
|
|
|
- - Resource: Always https://management.core.windows.net/ , for all customers
|
|
|
+ - The token endpoint
|
|
|
|
|
|
##### Adding the service principal to your ADL Account
|
|
|
1. Go to the portal again, and open your ADL account
|
|
|
-2. Select Users under Settings
|
|
|
+2. Select `Access control (IAM)`
|
|
|
3. Add your user name you created in Step 6 above (note that it does not show up in the list, but will be found if you searched for the name)
|
|
|
4. Add "Owner" role
|
|
|
|
|
@@ -153,6 +157,84 @@ Add the following properties to your `core-site.xml`
|
|
|
</property>
|
|
|
```
|
|
|
|
|
|
+#### Using MSI (Managed Service Identity)
|
|
|
+
|
|
|
+Azure VMs can be provisioned with "service identities" that are managed by the
|
|
|
+Identity extension within the VM. The advantage of doing this is that the
|
|
|
+credentials are managed by the extension, and do not have to be put into
|
|
|
+core-site.xml.
|
|
|
+
|
|
|
+To use MSI, the following two steps are needed:
|
|
|
+1. Modify the VM deployment template to specify the port number of the token
|
|
|
+ service exposed to localhost by the identity extension in the VM.
|
|
|
+2. Get your Azure ActiveDirectory Tenant ID:
|
|
|
+ 1. Go to [the portal](https://portal.azure.com)
|
|
|
+ 2. Under services in left nav, look for Azure Active Directory and click on it.
|
|
|
+ 3. Click on Properties
|
|
|
+ 4. Note down the GUID shown under "Directory ID" - this is your AAD tenant ID
|
|
|
+
|
|
|
+
|
|
|
+##### Configure core-site.xml
|
|
|
+Add the following properties to your `core-site.xml`
|
|
|
+
|
|
|
+```xml
|
|
|
+<property>
|
|
|
+ <name>fs.adl.oauth2.access.token.provider.type</name>
|
|
|
+ <value>Msi</value>
|
|
|
+</property>
|
|
|
+
|
|
|
+<property>
|
|
|
+ <name>fs.adl.oauth2.msi.port</name>
|
|
|
+ <value>PORT NUMBER FROM STEP 1 ABOVE</value>
|
|
|
+</property>
|
|
|
+
|
|
|
+<property>
|
|
|
+ <name>fs.adl.oauth2.msi.TenantGuid</name>
|
|
|
+ <value>AAD TENANT ID GUID FROM STEP 2 ABOVE</value>
|
|
|
+</property>
|
|
|
+```
|
|
|
+
|
|
|
+### Using Device Code Auth for interactive login
|
|
|
+
|
|
|
+**Note:** This auth method is suitable for running interactive tools, but will
|
|
|
+not work for jobs submitted to a cluster.
|
|
|
+
|
|
|
+To use user-based login, Azure ActiveDirectory provides login flow using
|
|
|
+device code.
|
|
|
+
|
|
|
+To use device code flow, user must first create a **Native** app registration
|
|
|
+in the Azure portal, and provide the client ID for the app as a config. Here
|
|
|
+are the steps:
|
|
|
+
|
|
|
+1. Go to [the portal](https://portal.azure.com)
|
|
|
+2. Under services in left nav, look for Azure Active Directory and click on it.
|
|
|
+3. Using "App Registrations" in the menu, create "Native Application".
|
|
|
+4. Go through the wizard
|
|
|
+5. Once app is created, note down the "Appplication ID" of the app
|
|
|
+6. Grant permissions to the app:
|
|
|
+ 1. Click on "Permissions" for the app, and then add "Azure Data Lake" and
|
|
|
+ "Windows Azure Service Management API" permissions
|
|
|
+ 2. Click on "Grant Permissions" to add the permissions to the app
|
|
|
+
|
|
|
+Add the following properties to your `core-site.xml`
|
|
|
+
|
|
|
+```xml
|
|
|
+<property>
|
|
|
+ <name>fs.adl.oauth2.devicecode.clientappid</name>
|
|
|
+ <value>APP ID FROM STEP 5 ABOVE</value>
|
|
|
+</property>
|
|
|
+```
|
|
|
+
|
|
|
+It is usually not desirable to add DeviceCode as the default token provider
|
|
|
+type. But it can be used when using a local command:
|
|
|
+```
|
|
|
+ hadoop fs -Dfs.adl.oauth2.access.token.provider.type=DeviceCode -ls ...
|
|
|
+```
|
|
|
+Running this will print a URL and device code that can be used to login from
|
|
|
+any browser (even on a different machine, outside of the ssh session). Once
|
|
|
+the login is done, the command continues.
|
|
|
+
|
|
|
+
|
|
|
#### Protecting the Credentials with Credential Providers
|
|
|
|
|
|
In many Hadoop clusters, the `core-site.xml` file is world-readable. To protect
|