This file contains 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
/* | |
* Description: Simple IO class for php CLI | |
* Author: Mads Aune | |
*/ | |
if(!defined("STDIN")) { define('STDIN', fopen('php://stdin', 'r')); } | |
class CLI { | |
public static function getLine($prompt = '') { | |
echo $prompt . "> "; |
This file contains 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 SlowView { | |
process { $_; Start-Sleep -Milliseconds 500 } | |
} |
This file contains 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
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$True)] | |
[string] | |
$TenantName, | |
[Parameter(Mandatory=$True)] | |
[string] | |
$AppId, |
This file contains 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 = "." | |
) |
This file contains 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 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 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 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 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 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 |
OlderNewer