This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS> Invoke-MgRestMethod -Method Get -Uri "https://graph.microsoft.com/beta/users" | |
Name Value | |
---- ----- | |
@odata.context https://graph.microsoft.com/beta/$metadata#users | |
value {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xx… | |
@odata.nextLink https://graph.microsoft.com/beta/users?$skiptoken=RFNwdAIAAQAAAB19Y3FybC8hcm6lLmZsYWRtYXJrQGdtYWls… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS> Get-Command -Module Microsoft.Graph* "get*userprofile*" | |
CommandType Name Version Source | |
----------- ---- ------- ------ | |
Function Get-MgUserProfile 1.25.0 Microsoft.Graph.People | |
Function Get-MgUserProfileAccount 1.25.0 Microsoft.Graph.People | |
Function Get-MgUserProfileAddress 1.25.0 Microsoft.Graph.People | |
Function Get-MgUserProfileAnniversary 1.25.0 Microsoft.Graph.People | |
Function Get-MgUserProfileAward 1.25.0 Microsoft.Graph.People | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS> Find-MgGraphCommand -Uri "https://graph.microsoft.com/beta/users" | |
APIVersion: beta | |
Command Module Method URI OutputType Permissions | |
------- ------ ------ --- ---------- ----------- | |
Get-MgUser Users GET /users IMicrosoftGraphUser1 {DeviceManagementApps.Read.All, DeviceManagementApps.… | |
New-MgUser Users POST /users IMicrosoftGraphUser1 {DeviceManagementApps.ReadWrite.All, DeviceManagement… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET https://graph.microsoft.com/beta/users | |
Get-MgUser | |
# GET https://graph.microsoft.com/beta/users/<id>/authentication/methods | |
Get-MgUserAuthenticationMethod | |
# GET https://graph.microsoft.com/beta/roleManagement/directory/roleDefinitions/<id> | |
Get-MgRoleManagementDirectoryRoleDefinition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS> [Microsoft.Graph.PowerShell.Models.IMicrosoftGraphUser].GetProperties() | |
... | |
MemberType : Property | |
Name : UserType | |
DeclaringType : Microsoft.Graph.PowerShell.Models.IMicrosoftGraphUser | |
ReflectedType : Microsoft.Graph.PowerShell.Models.IMicrosoftGraphUser | |
MetadataToken : 385892877 | |
Module : Microsoft.Graph.Users.private.dll | |
IsCollectible : False | |
PropertyType : System.String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# we need to get the full help document to see the OUTPUT section | |
PS> Get-Help Get-MgUser -Full | |
... | |
INPUTS | |
Microsoft.Graph.PowerShell.Models.IUsersIdentity | |
OUTPUTS | |
Microsoft.Graph.PowerShell.Models.IMicrosoftGraphUser | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS> Select-MgProfile -Name beta | |
PS> Get-MgPolicyAuthorizationPolicy | gm | Where-Object { $_.Name -eq "PermissionGrantPolicyIdsAssignedToDefaultUserRole" } | |
TypeName: Microsoft.Graph.PowerShell.Models.MicrosoftGraphAuthorizationPolicy1 | |
Name MemberType Definition | |
---- ---------- ---------- | |
PermissionGrantPolicyIdsAssignedToDefaultUserRole Property string[] PermissionGrantPol… | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-MIDServerDownloadUrl { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true)] | |
[string[]] | |
$InstanceName, | |
[Parameter()] | |
[ValidateSet("windows", "linux")] | |
[string] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Get-ChildItem -File -Recurse | Get-Content | Select-String -Pattern 'resource "(azurerm_.+|azuread_.+)" ".*"' -AllMatches).Matches | | |
ForEach-Object { $_.Groups[1].Value } | | |
Sort-Object -Unique |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get lines of code in a powershell project | |
# Inspiration: https://www.limilabs.com/blog/source-lines-of-code-count-using-powershell | |
function Get-LinesOfCode { | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[string] | |
$Path = "." | |
) |