Archive for September, 2019


Azure AD custom extensions

How to work with custom extensions:

Reference:

https://docs.microsoft.com/en-us/powershell/azure/active-directory/using-extension-attributes-sample?view=azureadps-2.0

 

 

Examples:

 

# Connect to Azure AD with Global Administrator

Connect-AzureAD  

# Get a User and Read Extension Properties

$aadUser = Get-AzureADUser -ObjectId <youruser> $aadUser | Select -ExpandProperty ExtensionProperty  

# Serialize User Object to JSON

$aadUser.ToJson()  

# Explore Object Properties

$aadUser | Get-Member  

# How to: Add Extension Properties

# PS! Can only write to Cloud homed users

$aadUser = Get-AzureADUser ObjectId <yourclouduser>@mydomain.onmicrosoft.com
$extensionProp = New-Object System.Collections.Generic.Dictionary2[System.String,System.String]
$extensionProp.Add(extension_<YourTenantSchemaExtensionAppId>_msDS_ExtensionAttr1,ENTERPRISEPACK)
$extensionProp.Add(extension_<YourTenantSchemaExtensionAppId>_msDS_ExtensionAttr2,EMSPREMIUM)
Set-AzureADUser ObjectId $aadUser.ObjectId ExtensionProperty $extensionProp

# Check added Extension Properties

Get-AzureADUser -ObjectId <yourclouduser>@mydomain.onmicrosoft.com | Select -ExpandProperty ExtensionProperty

 #region List all users with Extension Properties

$aadUsers = Get-AzureADUser | Select DisplayName, ObjectId
$aadUsersExt = @()
ForEach ($aadUser in $aadUsers) {
    $user = Get-AzureADUser ObjectId $aadUser.ObjectId | Select ObjectId, DisplayName
    $userDetail = Get-AzureADUser ObjectId $aadUser.ObjectId | Select ExpandProperty ExtensionProperty
        foreach ($key in $userDetail.Keys)
        {
            if($key -like extension_<YourTenantSchemaExtensionAppId>_msDS_ExtensionAttr1)
            {
                $ext1 = $userDetail.$key
            }
            elseif($key -like extension_<YourTenantSchemaExtensionAppId>_msDS_ExtensionAttr2)
            {
                $ext2 = $userDetail.$key
            }
            else { $ext1 = ; $ext2 = }
        }
    $obj = [pscustomobject]@{DisplayName=$user.DisplayName; ObjectId=$user.ObjectId; Ext1=$ext1; Ext2=$ext2}
    $aadUsersExt += $obj
    }

# List only users with values for extension attributes

$aadUsersExt | Where {$_.Ext1 -or $_.Ext2} | FT  

# List all users

$aadUsersExt  

# Serialize users and extension attributes to JSON

$aadUsersExt | ConvertTo-Json

Advertisements

Compare self-managed Active Directory Domain Services, Azure Active Directory, and managed Azure Active Directory Domain Services: To provide applications, services, or devices access to a central identity, there are three common ways to use Active Directory-based services in Azure. This choice in identity solutions gives you the flexibility to use the most appropriate directory for your organization’s needs. For example, if you mostly manage cloud-only users that run mobile devices, it may not make sense to build and run your own Active Directory Domain Services identity solution. Instead, you could just use Azure Active Directory

DFIR ORC, where ORC stands for “Outil de Recherche de Compromission” in French, is a collection of specialized tools dedicated to reliably parse and collect critical artefacts such as the MFT, registry hives or event logs. It can also embed external tools and their configurations.

DFIR ORC collects data, but does not analyze it: it is not meant to triage machines. It cannot spy on an attacker either, as an EDR or HIDS/HIPS would. It rather provides a forensically relevant snapshot of machines running Microsoft Windows.

Links:

https://dfir-orc.github.io/

https://github.com/DFIR-ORC/dfir-orc

 

https://blogs.technet.microsoft.com/cbernier/2018/01/16/microsoft-flow-and-azure-ad-lets-automate/

 

 

How to clear credential manager entries:

https://blogs.technet.microsoft.com/rmilne/2019/01/11/script-to-clear-credman/

 

 

Microsoft has release a new PS  module to manage Azure Information Protection : AIPService. At the same time, MS is deprecating the previous AIP module called AADRM (for the 15th, July  2020). https://docs.microsoft.com/en-us/azure/information-protection/install-powershell

https://docs.microsoft.com/en-us/powershell/azure/aip/overview?view=azureipps

 

Windows 10 powertoys

https://www.theverge.com/2019/9/6/20852451/microsoft-windows-10-powertoys-download-features