[!ALERT] Please ensure you have completed the steps in the Lab Environment Configuration before continuing.
Reference: User chart
User | Are they in IP Users Group? | Registered for MFA/SSPR during setup? |
---|---|---|
Adam | YES | YES |
Bob | YES | NO |
Alice | YES | YES |
Evan | NO | NO |
===
-
[] Switch to @lab.VirtualMachine(Client01).SelectLink and log in with the password [email protected](Client01).Password+++.
-
[] Navigate to
https://portal.azure.com
.[!NOTE] If necessary, log in using the credentials below:
@lab.CloudCredential(134).Username
@lab.CloudCredential(134).Password
-
[] Browse to Azure Active Directory > Groups > New group.
-
[] Create a Security group named Identity Protection Users with assigned membership type.
-
[] Click Create, then add Adam, Bob, and Alice to the group.
- [] Navigate to Azure Active Directory > Password reset.
- [] From the Properties page, under the option Self Service Password Reset Enabled, choose All.
- [] Click Save.
- [] From the Authentication methods page, make the following choices:
- [] Number of methods required to reset: 1
- [] Methods available to users:
- [] Mobile app code (preview)
- [] Mobile phone
- [] Office phone
- [] Click Save.
- [] Methods available to users:
- [] Navigate to Azure Active Directory > User settings > Manage settings for access panel preview features.
- [] Under Users can use preview features for registering and managing security info, you can choose to enable for a Selected group of users or for All users.
===
- [] Navigate to Azure Active Directory > Security > MFA registration policy.
- [] Under Assignments, select Identity Protection Users.
- [] Set Enforce Policy to On.
-
[] In a new InPrivate window, log in to
https://portal.office.com
using the credentials belowadamj@@lab.CloudCredential(134).TenantName
pass@word1
-
[] Adam will be prompted to register for MFA.
-
[] Close the InPrivate window.
-
[] In a new InPrivate window, log in to
https://portal.office.com
using the credentials belowAliceA@@lab.CloudCredential(134).TenantName
pass@word1
-
[] Alice will be prompted to register for MFA.
-
[] Close the InPrivate window.
===
##First, we are going to configure the sign-in risk policy
- [] Switch to @lab.VirtualMachine(Client01).SelectLink and log in with the password [email protected](Client01).Password+++.
- [] Navigate to
https://portal.azure.com/?Microsoft_AAD_IAM_ipcv2=true&Microsoft_AAD_IAM_securityarea=true#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Security
- [] Click on the Security blade and then select Sign-in risk policy
- [] Under Assignments users, click on Select individuals and groups and then select the Identity Protection Users group. Click Done
- [] Under Conditions, ensure that sign-in risk is set to Medium and above
- [] Under Controls, ensure that access is set to require multi-factor authentication
- [] Set Enforce Policy to On
##Now, let’s configure the user-risk policy
- [] Navigate to
https://portal.azure.com/?Microsoft_AAD_IAM_ipcv2=true&Microsoft_AAD_IAM_securityarea=true#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Security
- [] Click on the Security blade and then select User risk policy
- [] Under Assignments users, click on Select individuals and groups and then select the Identity Protection Users group. Click Done
- [] Under Conditions, set user risk is set to High
- [] Under Controls, ensure that access is set to require password change
- [] Set Enforce Policy to On
===
Let’s see what happens when users try to sign in from the Tor Browser, which anonymizes their IP and can be used by malicious actors.
-
[] Log in to @lab.VirtualMachine(Client03).SelectLink and log in with the password [email protected](Client01).Password+++.
-
[] Navigate to
https://portal.office.com
and log-in with the credentials below:EvanG@@lab.CloudCredential(134).TenantName
pass@word1
- [] Notice how they are not blocked because they are not targeted by the risky sign-ins policies
-
[] Now, open a new Tor window and log-in to ```https://portal.office.com with the credentials below
```adamj@@lab.CloudCredential(134).TenantName``` ```pass@word1```
- [] Notice how you are prompted for MFA due to the risky sign-ins policy
-
[] To generate an additional risky sign-in, open a new Tor window and log-in to
https://portal.office.com++ with
AliceA@@lab.CloudCredential(134).TenantName``` -
[] Notice how you are prompted for MFA due to the risky sign-ins policy
##What happens if a user is targeted by the risky sign-ins policy but has not yet registered for MFA?
-
[] Open a new Tor window and log-in to
https://portal.office.com
with the credentials below:BobW@@lab.CloudCredential(134).TenantName
pass@word1
- [] Notice how you are blocked because the user has not registered for MFA yet and is thus unable to beat the MFA challenge prompted by the risky sign-ins policy
-
[] So that Bob can respond to future MFA attempts, open an Edge browser window and now navigate to portal.office.com and log-in as Bob
- [] You will be prompted to register for MFA ===
There are four steps to accessing Identity Protection data through Microsoft Graph:
- [] Create a new app registration.
- [] Use this secret and a few other pieces of information to authenticate to Microsoft Graph, where you receive an authentication token.
- [] Use this token to make requests to the API endpoint and get Identity Protection data back.
-
[] On the Active Directory page, in the Manage section, click App registrations.
!IMAGEh5fd84va.jpg
-
[] In the menu on the top, click New application registration.
!IMAGEvptami21.jpg
-
[] On the Create page, perform the following steps:
!IMAGEuh5cjkmi.jpg
- [] In the Name textBox, type a name for your application (e.g.: AADIP Risk Event API Application).
- [] As Type, select Web Application And / Or Web API.
- [] In the Sign-on URL textBox, type
http://localhost
. - [] Click Create.
-
[] To open the Settings page, in the applications list, click your newly created app registration.
-
[] Copy the Application ID and paste it into a new text document. This will be needed later in the lab.
===
-
[] On the Settings page, click Required permissions.
!IMAGE87aolleh.jpg
-
[] On the Required permissions page, in the toolbar on the top, click Add.
!IMAGE3yfprrsu.jpg
-
[] On the Add API access page, click Select an API.
!IMAGEdwvs40oh.jpg
-
[] On the Select an API page, select Microsoft Graph, and then click Select.
!IMAGEc2wo5n3e.jpg
-
[] On the Add API access page, click Select permissions.
!IMAGEk275899m.jpg
-
[] On the Enable Access page, click Read all identity risk information, and then click Select.
!IMAGEwlcqechy.jpg
-
[] On the Add API access page, click Done.
-
[] On the Required Permissions page, click Grant Permissions, and then click Yes.
!IMAGE3i07c4dz.jpg ===
-
[] On the Settings page, click Keys.
!IMAGEto0mwhls.jpg
-
[] On the Keys page, perform the following steps:
!IMAGE3xrwo38o.jpg
- [] In the Key description textBox, type a description (for example, AADIP Risk Event).
- [] As Duration, select In 1 year.
- [] Click Save.
- [] Copy the key value, and then paste it into a safe location.
Since we will use this value later on, copy the Client Secret into the text file where you stored the client id.
[!Note] If you lose this key, you will have to return to this section and create a new key. Keep this key a secret: anyone who has it can access your data. ===
At this point, you should have specified the following values in your text file:
-
The client ID
-
The key
Now that we have configured the app registration and retrieved the values needed to authenticate, we can query the IdentityRiskEvents API using PowerShell.
First, let’s assess how many risk events we have that are medium or high risk. These are the events that have the capability to trigger the sign-in or user-risk policies. Since they have a medium or high likelihood of user compromise, remediating these events should be a priority.
-
[] Open a PowerShell ISE window and, in the script pane, type the PowerShell code below.
-
[] Insert the saved Client ID and key for the values of ClientID and ClientSecret variable and click Run.
##Get all your medium or high-risk risk events $ClientID = "ClientID" # Should be a ~36 hex character string; insert your info here $ClientSecret = "ClientSecret" # Should be a ~44 character string; insert your info here $tenantdomain = "@lab.CloudCredential(134).TenantName" # For example, contoso.onmicrosoft.com $loginURL = "https://login.microsoft.com" $resource = "https://graph.microsoft.com" $body = @{grant_type="client_credentials";resource=$resource;client_id=$ClientID;client_secret=$ClientSecret} $oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$tenantdomain/oauth2/token?api-version=beta -Body $body Write-Output $oauth if ($oauth.access_token -ne $null) { $headerParams = @{'Authorization'="$($oauth.token_type) $($oauth.access_token)"} $url = "https://graph.microsoft.com/beta/identityRiskEvents?`$filter=riskLevel eq 'high' or riskLevel eq 'medium'" Write-Output $url $myReport = (Invoke-WebRequest -UseBasicParsing -Headers $headerParams -Uri $url) foreach ($event in ($myReport.Content | ConvertFrom-Json).value) { Write-Output $event } } else { Write-Host "ERROR: No Access Token" }
When you believe a user may have been compromised, you can better understand the state of their risk by getting all of their risk events. Similarly, if you have users that you believe may be more likely targets of compromise, you can proactively retrieve their risky events.
Since we know that Adam had some risky-sign ins, let’s query their risk events.
-
[] In the PowerShell ISE, open a new file and, in the script pane, type the PowerShell code below.
-
[] Insert the saved Client ID and key for the values of ClientID and ClientSecret variable and click Run.
##Get a specific user's risk events $ClientID = "ClientID" # Should be a ~36 hex character string; insert your info here $ClientSecret = "ClientSecret" # Should be a ~44 character string; insert your info here $tenantdomain = "@lab.CloudCredential(134).TenantName" # For example, contoso.onmicrosoft.com $loginURL = "https://login.microsoft.com" $resource = "https://graph.microsoft.com" $body = @{grant_type="client_credentials";resource=$resource;client_id=$ClientID;client_secret=$ClientSecret} $oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$tenantdomain/oauth2/token?api-version=beta -Body $body Write-Output $oauth if ($oauth.access_token -ne $null) { $headerParams = @{'Authorization'="$($oauth.token_type) $($oauth.access_token)"} $url = "https://graph.microsoft.com/beta/identityRiskEvents?`$filter=userID eq '<Adam’s user ID>'" Write-Output $url $myReport = (Invoke-WebRequest -UseBasicParsing -Headers $headerParams -Uri $url) foreach ($event in ($myReport.Content | ConvertFrom-Json).value) { Write-Output $event } } else { Write-Host "ERROR: No Access Token" }
===
Remember our risky sign-ins from earlier? Let’s take a look at them in the Azure portal
- [] Navigate to
https://portal.azure.com/?Microsoft_AAD_IAM_ipcv2=true&Microsoft_AAD_IAM_securityarea=true#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Security
- [] Click on the Security blade and then select Risky sign-ins
- [] You should see the Tor sign ins from Adam, Bob, and Evan. To dive deeper, click on a specific sign-in record
- [] In the details drawer, you can toggle through the basic info, device info, risk info tabs to learn more about that particular sign-in
Now that we have taken a look at risky sign-ins, let’s find out what happens if Identity Protection detects a high-risk user. For the purposes of this lab, we will force a user to go to high-risk
- [] Navigate to
https://portal.azure.com/?Microsoft_AAD_IAM_ipcv2=true&Microsoft_AAD_IAM_securityarea=true#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Security
- [] Click on the Security blade and then select Risky sign-ins
- [] Click on the risky sign-in record for Bob and select confirmed compromise
- [] Now, open a new InPrivate window and try to log-in to portal.office.com as Bob
- [] You will be prompted to reset Bob’s password