- AzureAD
- Az Module
- MSOnline cmdlets
- AZ cli
Azure Active Directory PowerShell module version for Graph for Azure AD administrative tasks such as user management, domain management and for configuring single sign-on. The cmdlets listed here are different from the MSOnline cmdlets which are part of Azure Active Directory PowerShell version 1.0.
\n
Connect-AzureAD
Get-AzureADCurrentSessionInfo
Get-AzureADTenantDetail
Get-AzureADUser -All $true
Get-AzureADUser -ObjectId [email protected]
Get-AzureADUser -SearchString "admin"
Get-AzureADUser -All $true |?{$_.Displayname -match "admin"}
$app = Get-AzureADServicePrincipal -Searchstring "Microsoft Graph"
$app.AppRoles
Get-AzureADUser -All $true |%{$Properties = $_;$Properties.PSObject.Properties.Name | % {if ($Properties.$_ -match 'password'){"$($Properties.UserPrincipalName) - $_ - $($Properties.$_)"}}}
Get-AzureADUser -ObjectId [email protected] | fl *
Get-AzureADUser -All $true |?{$_.OnPremisesSecurityIdentifier -ne $null}
Get-AzureADUser -All $true |?{$_.OnPremisesSecurityIdentifier -eq $null}
Get-AzureADUser | Get-AzureADUserCreatedObject
Get-AzureADUserCreatedObject -objectid 03b6e9ae-b389-4c04-8269-623cbe4b0d25
Get-AzureADUserOwnedObject -ObjectId [email protected]
Get-AzureADGroup -all $true
Get-AzureADGroup -ObjectId 783a312d-0de2-4490-92e4-539b0e4ee03e
Get-AzureADGroup -All $true |?{$_.Displayname -match "admin"}
Dynamic Group Membership documentation
Get-AzureADMSGroup | ?{$_.GroupTypes -eq 'DynamicMembership'}
Get-AzureADGroupMember -ObjectId 783a312d-0de2-4490-92e4-539b0e4ee03e
Get-AzureADGroup -ObjectId 783a312d-0de2-4490-92e4-539b0e4ee03e | Get-AzureADGroupMember
Get-AzureADUser -SearchString 'jdoe' | Get-AzureADUserMembership
Get-AzureADUserMembership -ObjectId [email protected]
Get-AzureADGroup -All $true | ?{$_.OnPremisesSecurityIdentifier -ne $null}
Get-AzureADGroup -All $true | ?{$_.OnPremisesSecurityIdentifier -eq $null}
Get-AzureADUser -SearchString 'test' | Get-AzureADUserMembership Get-AzureADUserMembership -ObjectId [email protected]
Get-AzureADDirectoryRole
Get-AzureADMSRoleDefinition -Filter "displayName eq 'Global Administrator'"
Get-AzureADMSRoleDefinition | ?{$_.IsBuiltIn -match "False"}
--> PrincipalId = ObjectId of the group```\n
Get-AzureADMSRoleAssignment -Filter "PrincipalId eq '57ada729-a581-4d6f-9f16-3fe0961ada82'"
RoleDefinitionId
d6c631b5-76af-4147-8b79-eab0b187861d
05e8fe6f-05cb-4cac-bc26-a97175381949
Get-AzureADMSRoleDefinition -Filter "id eq '05e8fe6f-05cb-4cac-bc26-a97175381949'"
Get-AzureADDirectoryRoleMember -ObjectId a3dko37k-f433-4jg
Get-AzureADDirectoryRole -Filter "DisplayName eq 'Global Administrator'" | Get-AzureADDirectoryRoleMember
Get-AzureADDirectoryRole -Filter "DisplayName eq 'Global Administrator'" | Get-AzureADDirectoryRoleMember
Get-AzureADDevice -All $true | fl *
Get-AzureADDevice -All $true | Get-AzureADDeviceRegisteredUser
Get-AzureADDevice -All $true | Get-AzureADDeviceRegisteredOwner
Get-AzureADUserOwnedDevice -ObjectId [email protected]
Get-AzureADUserRegisteredDevice -ObjectId [email protected]
Get-AzureADDevice -objectid ff9f3fdb-1500-4b89-9ccd-1703f8ff9c91 | fl *
Get-AzureADDevice -All $true | ?{$_.IsCompliant -eq "True"}
Get-AzureADApplication -All $true
Get-AzureADApplication -ObjectId a1333e88-1278-41bf-8145-155a069ebed0 | fl *
Get-AzureADApplication -ObjectId a1333e88-1278-41bf-8145-155a069ebed0 | Get-AzureADApplicationOwner |fl *
Get-AzureADUser -ObjectId [email protected] | Get-AzureADUserAppRoleAssignment | fl *
Get-AzureADGroup -ObjectId 783a312d-0de2-4490-92e4-539b0e4ee03e | Get-AzureADGroupAppRoleAssignment | fl *
Get-AzureADServicePrincipal -All $true
Get-AzureADServicePrincipal -ObjectId fe4650ea-5ad8-45ad-a318-25cda5aa02f4 | fl *
Get-AzureADServicePrincipal -ObjectId cdddd16e-2611-4442-8f45-053e7c37a264 | Get-AzureADServicePrincipalCreatedObject
Get-AzureADServicePrincipal -Filter "DisplayName eq 'IntuneApp'" | Get-AzureADServiceAppRoleAssignment | fl *
Get-AzureADServicePrincipal -Filter "DisplayName eq 'IntuneApp'" | Get-AzureADServicePrincipalMembership | fl *
-https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-6.6.0
The Az PowerShell module is a set of cmdlets for managing Azure resources directly from PowerShell.
Connect-AzAccount
$creds = Get-Credential
Connect-AzAccount -Credential $creds
$passwd = ConvertTo-SecureString "Password123" -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ("[email protected]", $passwd)
Connect-AzureAD -Credential $creds
Connect-AzAccount -AccountId [email protected] -AccessToken eyJ0eXA
Get-AzContext
Get-AzContext -ListAvailable
Get-AzSubscription | fl *
Get-AzRoleAssignment
Get-AzRoleAssignment -ObjectId 0ccd6182-b034-4e13-a155-1021e7d22d22
Get-AzRoleAssignment -UserPrincipalName [email protected]
Get-AzResource
Get-AzADUser
Get-AzADUser -UserPrincipalName [email protected]
Get-AzADGroup
Get-AzADGroupMember -ObjectId 783a312d-0de2-4490-92e4-539b0e4ee03e
Get-AzResourceGroup
Get all the application objects registered with the current tenant (visible in App registration in Azure portal)
GetAzADApplication | fl *
Get-AZVM | fl *
Get-AzRoleDefinition | FT Name, IsCustom
Get-AzAccessToken
Connect-AzAccount -AccountId [email protected] -AccessToken eyJ0eXAFegerfiojEF423dez21dzfsFZa443
Connect-AzAccount -AccessToken $Token -GraphAccessToken $graphtoken -AccountId '62e44426-5c46-4e3c-8a89-f461d5d586f2'
(Get-AzAccessToken -Resource "https://graph.microsoft.com").Token
Connect-AzAccount -AccountId [email protected] -AccessToken eyJ0eXAFegerfiojEF423dez21dzfsFZa443 -GraphAccessToken eyJ0eXAiOiJKV1QiLCJhbGciO
Older MSOnline V1 PowerShell module for Azure Active Directory. Customers are encouraged to use the newer [Azure](https://docs.microsoft.com/en-us/powershell/module/azuread/?view=azureadps-2.0) Active Directory V2 PowerShell module instead of this module.
If the Azure portal is locked down it is still possible to access Azure AD user information via MSOnline cmdlets.
Import-Module MSOnline
Connect-MsolService
Get-MSolUser -All | fl
Get-MsolCompanyInformation
Get-MSolGroup –All
- https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
- https://docs.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest
The AZ CLI can be installed on multiple platforms, it is also available directly within Cloud Shell.
az login
az ad signed-in-user show
az configure
az ad signed-in-user list-owned-objects
az find "vm"
az find "az vm list"
az ad user list --output table
az account tenant list
az account subscription list
az ad signed-in-user show
az ad group member list -g "VM Admins" --query "[].[displayName]" -o table
az ad group member check --group "VM Admins" --member-id b71d21f6-8e09-4a9d-932a-cb73df519787
az webapp list
az network publip-ip list --o table