Microsoft.Graph.Entra.psm1
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ Set-StrictMode -Version 5 function Get-EntraIdentityProvider { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["IdentityProviderBaseId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgIdentityProvider @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name Type -Value identityProviderType Add-Member -InputObject $_ -MemberType AliasProperty -Name Name -Value DisplayName Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipalOAuth2PermissionGrant { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalOauth2PermissionGrant @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraApplicationExtensionProperty { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgApplicationExtensionProperty @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraApplicationServiceEndpoint { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalEndpoint @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraGroupPermissionGrant { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgGroupPermissionGrant @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraIdentityProvider { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ClientId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Name, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Type, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ClientSecret ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{} if($null -ne $PSBoundParameters["Id"]) { $params["IdentityProviderBaseId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["Type"]) { $body["identityProviderType"] = $PSBoundParameters["Type"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Name"]) { $body["displayName"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["ClientId"]) { $body["clientId"] = $PSBoundParameters["ClientId"] } if($null -ne $PSBoundParameters["ClientSecret"]) { $body["clientSecret"] = $PSBoundParameters["ClientSecret"] } $body["@odata.type"] = "#microsoft.graph.socialIdentityProvider" $params["BodyParameter"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgIdentityProvider @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Add-EntraGroupOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["RefObjectId"]) { $TmpValue = $PSBoundParameters["RefObjectId"] $Value = @{ "@odata.id" = "https://graph.microsoft.com/beta/users/$TmpValue"} $params["BodyParameter"] = $Value } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgGroupOwnerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Revoke-EntraUserAllRefreshToken { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Revoke-MgUserSignInSession @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraGroup { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"; ObjectId = "Id"} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $Value = "mailNickName eq '$TmpValue' or (mail eq '$TmpValue' or (displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')))" $params["Filter"] = $Value } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgGroup @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraApplicationExtensionProperty { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ExtensionPropertyId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["ExtensionPropertyId"]) { $params["ExtensionPropertyId"] = $PSBoundParameters["ExtensionPropertyId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgApplicationExtensionProperty @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraUser { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PostalCode, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $MailNickName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $ShowInAddressList, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Department, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $TelephoneNumber, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PreferredLanguage, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Mobile, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $JobTitle, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ConsentProvidedForMinor, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PhysicalDeliveryOfficeName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PasswordPolicies, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsCompromised, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.SignInName]] $SignInNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $OtherMails, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserState, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ImmutableId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $City, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AgeGroup, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.Dictionary`2[System.String,System.String]] $ExtensionProperty, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UsageLocation, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserStateChangedOn, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Boolean]] $AccountEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Country, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserPrincipalName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $GivenName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $StreetAddress, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [Microsoft.Open.AzureAD.Model.PasswordProfile] $PasswordProfile, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $State, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $CompanyName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $FacsimileTelephoneNumber, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Surname, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $CreationType ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["PostalCode"]) { $params["PostalCode"] = $PSBoundParameters["PostalCode"] } if($null -ne $PSBoundParameters["MailNickName"]) { $params["MailNickName"] = $PSBoundParameters["MailNickName"] } if($null -ne $PSBoundParameters["ShowInAddressList"]) { $params["ShowInAddressList"] = $PSBoundParameters["ShowInAddressList"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["Mobile"]) { $params["MobilePhone"] = $PSBoundParameters["Mobile"] } if($null -ne $PSBoundParameters["JobTitle"]) { $params["JobTitle"] = $PSBoundParameters["JobTitle"] } if($null -ne $PSBoundParameters["ConsentProvidedForMinor"]) { $params["ConsentProvidedForMinor"] = $PSBoundParameters["ConsentProvidedForMinor"] } if($null -ne $PSBoundParameters["PhysicalDeliveryOfficeName"]) { $params["PhysicalDeliveryOfficeName"] = $PSBoundParameters["PhysicalDeliveryOfficeName"] } if($null -ne $PSBoundParameters["OtherMails"]) { $params["OtherMails"] = $PSBoundParameters["OtherMails"] } if($null -ne $PSBoundParameters["PasswordPolicies"]) { $params["PasswordPolicies"] = $PSBoundParameters["PasswordPolicies"] } if($null -ne $PSBoundParameters["IsCompromised"]) { $params["IsCompromised"] = $PSBoundParameters["IsCompromised"] } if($null -ne $PSBoundParameters["SignInNames"]) { $params["Identities"] = $PSBoundParameters["SignInNames"] } if($null -ne $PSBoundParameters["PreferredLanguage"]) { $params["PreferredLanguage"] = $PSBoundParameters["PreferredLanguage"] } if($null -ne $PSBoundParameters["UserState"]) { $params["ExternalUserState"] = $PSBoundParameters["UserState"] } if($null -ne $PSBoundParameters["ImmutableId"]) { $params["OnPremisesImmutableId"] = $PSBoundParameters["ImmutableId"] } if($null -ne $PSBoundParameters["City"]) { $params["City"] = $PSBoundParameters["City"] } if($null -ne $PSBoundParameters["AgeGroup"]) { $params["AgeGroup"] = $PSBoundParameters["AgeGroup"] } if($null -ne $PSBoundParameters["ExtensionProperty"]) { $params["ExtensionProperty"] = $PSBoundParameters["ExtensionProperty"] } if($null -ne $PSBoundParameters["UsageLocation"]) { $params["UsageLocation"] = $PSBoundParameters["UsageLocation"] } if($null -ne $PSBoundParameters["UserStateChangedOn"]) { $params["ExternalUserStateChangeDateTime"] = $PSBoundParameters["UserStateChangedOn"] } if($null -ne $PSBoundParameters["AccountEnabled"]) { $params["AccountEnabled"] = $PSBoundParameters["AccountEnabled"] } if($null -ne $PSBoundParameters["Country"]) { $params["Country"] = $PSBoundParameters["Country"] } if($null -ne $PSBoundParameters["UserPrincipalName"]) { $params["UserPrincipalName"] = $PSBoundParameters["UserPrincipalName"] } if($null -ne $PSBoundParameters["GivenName"]) { $params["GivenName"] = $PSBoundParameters["GivenName"] } if($null -ne $PSBoundParameters["PasswordProfile"]) { $TmpValue = $PSBoundParameters["PasswordProfile"] $Value = @{ forceChangePasswordNextSignIn = $TmpValue.ForceChangePasswordNextLogin forceChangePasswordNextSignInWithMfa = $TmpValue.EnforceChangePasswordPolicy password = $TmpValue.Password } $params["passwordProfile"] = $Value } if($null -ne $PSBoundParameters["UserType"]) { $params["UserType"] = $PSBoundParameters["UserType"] } if($null -ne $PSBoundParameters["StreetAddress"]) { $params["StreetAddress"] = $PSBoundParameters["StreetAddress"] } if($null -ne $PSBoundParameters["State"]) { $params["State"] = $PSBoundParameters["State"] } if($null -ne $PSBoundParameters["Department"]) { $params["Department"] = $PSBoundParameters["Department"] } if($null -ne $PSBoundParameters["CompanyName"]) { $params["CompanyName"] = $PSBoundParameters["CompanyName"] } if($null -ne $PSBoundParameters["FacsimileTelephoneNumber"]) { $params["FacsimileTelephoneNumber"] = $PSBoundParameters["FacsimileTelephoneNumber"] } if($null -ne $PSBoundParameters["Surname"]) { $params["Surname"] = $PSBoundParameters["Surname"] } if($null -ne $PSBoundParameters["TelephoneNumber"]) { $params["BusinessPhones"] = @($PSBoundParameters["TelephoneNumber"]) } if($null -ne $PSBoundParameters["CreationType"]) { $params["CreationType"] = $PSBoundParameters["CreationType"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $params = $params | ConvertTo-Json $response = Invoke-GraphRequest -Headers $customHeaders -Uri 'https://graph.microsoft.com/v1.0/users?$select=*' -Method POST -Body $params $response = $response | ConvertTo-Json | ConvertFrom-Json $response | ForEach-Object { if ($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name UserState -Value ExternalUserState Add-Member -InputObject $_ -MemberType AliasProperty -Name UserStateChangedOn -Value ExternalUserStateChangeDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value mobilePhone Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name ImmutableId -Value onPremisesImmutableId Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value onPremisesProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value BusinessPhones $userData = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser]::new() $_.PSObject.Properties | ForEach-Object { $userData | Add-Member -MemberType NoteProperty -Name $_.Name -Value $_.Value -Force } } } $userData } } function Remove-EntraGroupLifecyclePolicy { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupLifecyclePolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgGroupLifecyclePolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDomain { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["Name"]) { $params["DomainId"] = $PSBoundParameters["Name"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDomain @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name Name -Value Id $propsToConvert = @('State') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } $response } } function New-EntraDomain { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsDefaultForCloudRedirections, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Name, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $SupportedServices, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsDefault ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["IsDefaultForCloudRedirections"]) { $params["IsDefaultForCloudRedirections"] = $PSBoundParameters["IsDefaultForCloudRedirections"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Name"]) { $params["Id"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["SupportedServices"]) { $params["SupportedServices"] = $PSBoundParameters["SupportedServices"] } if($null -ne $PSBoundParameters["IsDefault"]) { $params["IsDefault"] = $PSBoundParameters["IsDefault"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgDomain @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name Name -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Reset-EntraLifeCycleGroup { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-MgRenewGroup @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraGroupMember { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/groups' $properties = '$select=*' $Method = "GET" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.GroupId)/members?$properties" } if($null -ne $PSBoundParameters["All"]) { $URI = "$baseUri/$($params.GroupId)/members?$properties" } if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] if ($topCount -gt 999) { $minTop = 999 $URI = "$baseUri/$($params.GroupId)/members?`$top=999&$properties" } else{ $URI = "$baseUri/$($params.GroupId)/members?`$top=$topCount&$properties" } } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method | ConvertTo-Json -Depth 10 | ConvertFrom-Json $data = $response try { $data = @($response.value) $all = $All.IsPresent $increment = $topCount - $data.Count while (($response.'@odata.nextLink' -and (($all -and ($increment -lt 0)) -or $increment -gt 0))) { $URI = $response.'@odata.nextLink' if ($increment -gt 0) { $topValue = [Math]::Min($increment, 999) if($minTop){ $URI = $URI.Replace("`$top=$minTop", "`$top=$topValue") } else{ $URI = $URI.Replace("`$top=$topCount", "`$top=$topValue") } $increment -= $topValue } $response = Invoke-GraphRequest -Uri $URI -Method $Method $data += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } } catch {} $data | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $serviceprincipal = @() if (($data.count -eq 0) -or $data.'@odata.type' -notcontains 'microsoft.graph.servicePrincipal') { $URI = "$baseUri/$($params.GroupId)/members/microsoft.graph.servicePrincipal?$properties" $topCount = $Top - $data.count if ($PSBoundParameters.ContainsKey("Top") -and $topCount -gt 0) { $increment = $topCount - $data.Count $increment = 1 $hasNextLink = $false do { $topValue = [Math]::Min($topCount, 999) $URI = "$baseUri/$($params.GroupId)/members/microsoft.graph.servicePrincipal?`$top=$topValue&$properties" $response = Invoke-GraphRequest -Uri $URI -Method $Method -Headers $customHeaders $serviceprincipal += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json $hasNextLink = $null -ne $response.PSObject.Properties.Match('@odata.nextLink') $increment-- } while ($increment -gt 0 -and $hasNextLink) } elseif($null -eq $PSBoundParameters["Top"]){ $response = Invoke-GraphRequest -Uri $URI -Method $Method -Headers $customHeaders $serviceprincipal += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } try{ $serviceprincipal | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType NoteProperty -Name '@odata.type' -Value '#microsoft.graph.servicePrincipal' -Force } } $data += $serviceprincipal } catch {} } if($data){ $userList = @() foreach ($response in $data) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject if (-not ($response -is [psobject])) { $response = [pscustomobject]@{ Value = $response } } $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Remove-EntraTrustedCertificateAuthority { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.CertificateAuthorityInformation] $CertificateAuthorityInformation ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $tenantId = (Get-MgContext).TenantId $params["Uri"] = "/v1.0/organization/$tenantId/certificateBasedAuthConfiguration" $params["Method"] = "POST" $certNotFound = $true $modifiedCert = $PSBoundParameters["CertificateAuthorityInformation"] $previousCerts = @() Get-EntraTrustedCertificateAuthority | ForEach-Object { if(($_.TrustedIssuer -eq $modifiedCert.TrustedIssuer) -and ($_.TrustedIssuerSki -eq $modifiedCert.TrustedIssuerSki)){ $certNotFound = $false } else{ $previousCerts += $_ } } if($certNotFound){ Throw [System.Management.Automation.PSArgumentException] "Provided certificate authority not found on the server. Please make sure you have provided the correct information in trustedIssuer and trustedIssuerSki fields." } $body = @{ certificateAuthorities = @() } $previousCerts | ForEach-Object { $isRoot = $false if("RootAuthority" -eq $_.AuthorityType){ $isRoot = $true } $cert = @{ isRootAuthority = $isRoot certificateRevocationListUrl = $_.CrlDistributionPoint deltaCertificateRevocationListUrl = $_.DeltaCrlDistributionPoint certificate = [convert]::tobase64string($_.TrustedCertificate) } $body.certificateAuthorities += $cert } $params["Body"] = ConvertTo-Json $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders | ConvertTo-Json -Depth 5 | ConvertFrom-Json $certificateList = @() foreach ($data in $response) { $certificateType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphCertificateBasedAuthConfiguration $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $certificateType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $certificateList += $certificateType } $certificateList } } function Get-EntraServicePrincipalAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalAppRoleAssignedTo @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraGroup { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $GroupTypes, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsAssignableToRole, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Boolean]] $SecurityEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Visibility, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Boolean]] $MailEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $MailNickname ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["GroupTypes"]) { $params["GroupTypes"] = $PSBoundParameters["GroupTypes"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["IsAssignableToRole"]) { $params["IsAssignableToRole"] = $PSBoundParameters["IsAssignableToRole"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["SecurityEnabled"]) { $params["SecurityEnabled"] = $PSBoundParameters["SecurityEnabled"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["Visibility"]) { $params["Visibility"] = $PSBoundParameters["Visibility"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["MailEnabled"]) { $params["MailEnabled"] = $PSBoundParameters["MailEnabled"] } if($null -ne $PSBoundParameters["MailNickname"]) { $params["MailNickname"] = $PSBoundParameters["MailNickname"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgGroup @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraDirectoryRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DirectoryScopeId, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $RoleDefinitionId, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $PrincipalId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["DirectoryScopeId"]) { $params["DirectoryScopeId"] = $PSBoundParameters["DirectoryScopeId"] } if($null -ne $PSBoundParameters["RoleDefinitionId"]) { $params["RoleDefinitionId"] = $PSBoundParameters["RoleDefinitionId"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["PrincipalId"]) { $params["PrincipalId"] = $PSBoundParameters["PrincipalId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgRoleManagementDirectoryRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Select-EntraGroupIdsUserIsMemberOf { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.GroupIdsForMembershipCheck] $GroupIdsForMembershipCheck ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $initalResponse = Get-MgUserMemberOfAsGroup -Headers $customHeaders -UserId $params["UserId"] $response = $initalResponse | Where-Object -Filterscript {$_.ID -in ($GroupIdsForMembershipCheck.GroupIds)} if($response){ $response.ID } } } function Get-EntraTrustedCertificateAuthority { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $TrustedIssuer, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $TrustedIssuerSki, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params["OrganizationId"] = (Get-MgContext).TenantId if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["TrustedIssuerSki"]) { $trustedIssuerSki = $PSBoundParameters["TrustedIssuerSki"] } if($null -ne $PSBoundParameters["TrustedIssuer"]) { $trustedIssuer = $PSBoundParameters["TrustedIssuer"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $responseData = Get-MgOrganizationCertificateBasedAuthConfiguration @params -Headers $customHeaders $response= @() if($responseData){ $responseData.CertificateAuthorities | ForEach-Object { if ( ([string]::IsNullOrEmpty($TrustedIssuer) -and [string]::IsNullOrEmpty($TrustedIssuerSki)) -or (![string]::IsNullOrEmpty($TrustedIssuer) -and ![string]::IsNullOrEmpty($TrustedIssuerSki) -and $_.Issuer -eq $TrustedIssuer -and $_.IssuerSki -eq $TrustedIssuerSki) -or (![string]::IsNullOrEmpty($TrustedIssuer) -and [string]::IsNullOrEmpty($TrustedIssuerSki) -and $_.Issuer -eq $TrustedIssuer) -or (![string]::IsNullOrEmpty($TrustedIssuerSki) -and [string]::IsNullOrEmpty($TrustedIssuer) -and $_.IssuerSki -eq $TrustedIssuerSki)) { $data = @{ AuthorityType = "IntermediateAuthority" TrustedCertificate = $_.Certificate CrlDistributionPoint = $_.CertificateRevocationListUrl DeltaCrlDistributionPoint = $_.DeltaCertificateRevocationListUrl TrustedIssuer = $_.Issuer TrustedIssuerSki = $_.IssuerSki } if($_.IsRootAuthority){ $data.AuthorityType = "RootAuthority" } $dataJson = ConvertTo-Json $data $response += [Newtonsoft.Json.JsonConvert]::DeserializeObject($dataJson, [Microsoft.Open.AzureAD.Model.CertificateAuthorityInformation]) } } } $response } } function Remove-EntraApplicationKeyCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $KeyId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["KeyId"]) { $params["KeyId"] = $PSBoundParameters["KeyId"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgApplicationKey @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserLicenseDetail { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserLicenseDetail @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Add-EntraServicePrincipalOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["RefObjectId"]) { $TmpValue = $PSBoundParameters["RefObjectId"] $Value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$TmpValue"} $params["BodyParameter"] = $Value } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgServicePrincipalOwnerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraApplicationKey { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $KeyId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Proof, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["KeyId"]) { $params["KeyId"] = $PSBoundParameters["KeyId"] } if($null -ne $PSBoundParameters["Proof"]) { $params["Proof"] = $PSBoundParameters["Proof"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgApplicationKey @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipalDelegatedPermissionClassification { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ServicePrincipalId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["DelegatedPermissionClassificationId"] = $PSBoundParameters["Id"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["ServicePrincipalId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalDelegatedPermissionClassification @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraServicePrincipalKeyCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $KeyId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["KeyId"]) { $params["KeyId"] = $PSBoundParameters["KeyId"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgServicePrincipalKey @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraUser { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgUser @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Update-EntraSignedInUserPassword { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Security.SecureString] $CurrentPassword, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Security.SecureString] $NewPassword ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["NewPassword"]) { $params["NewPassword"] = $PSBoundParameters["NewPassword"] } if($null -ne $PSBoundParameters["CurrentPassword"]) { $params["CurrentPassword"] = $PSBoundParameters["CurrentPassword"] } $currsecur = [System.Runtime.InteropServices.Marshal]::SecureStringToGlobalAllocUnicode($params.CurrentPassword) $curr = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($currsecur) $newsecur = [System.Runtime.InteropServices.Marshal]::SecureStringToGlobalAllocUnicode($params.NewPassword) $new = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($newsecur) $params["Url"] = "https://graph.microsoft.com/v1.0/me/changePassword" $body = @{ currentPassword = $curr newPassword = $new } $body = $body | ConvertTo-Json Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $params.Url -Method POST -Body $body $response } } function Add-EntraDeviceRegisteredOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["RefObjectId"]) { $TmpValue = $PSBoundParameters["RefObjectId"] $Value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$TmpValue"} $params["BodyParameter"] = $Value } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgDeviceRegisteredOwnerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraUserThumbnailPhoto { [CmdletBinding(DefaultParameterSetName = 'File')] param ( [Parameter(ParameterSetName = "Stream", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.IO.Stream] $FileStream, [Parameter(ParameterSetName = "ByteArray", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Byte[]] $ImageByteArray, [Parameter(ParameterSetName = "File", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $FilePath, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Parameter(ParameterSetName = "Stream")] [Parameter(ParameterSetName = "File")] [Parameter(ParameterSetName = "ByteArray")] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["FileStream"]) { $params["FileStream"] = $PSBoundParameters["FileStream"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ImageByteArray"]) { $params["ImageByteArray"] = $PSBoundParameters["ImageByteArray"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["FilePath"]) { $params["InFile"] = $PSBoundParameters["FilePath"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Set-MgUserPhotoContent @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraApplication { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"; ObjectId = "Id"} if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $Value = "displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')" $params["Filter"] = $Value } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"`$_ : `$(`$params[`$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgApplication @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name InformationalUrls -Value Info $propsToConvert = @( 'AddIns','Logo','AppRoles','GroupMembershipClaims','IdentifierUris','Info', 'IsDeviceOnlyAuthSupported','KeyCredentials','Oauth2RequirePostResponse','OptionalClaims', 'ParentalControlSettings','PasswordCredentials','Api','PublicClient', 'PublisherDomain','Web','RequiredResourceAccess','SignInAudience') try { foreach ($prop in $propsToConvert) { if($prop -eq 'AppRoles'){ $myAppRoles = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.AppRole] foreach ($appRole in $_.$prop) { $hash = New-Object Microsoft.Open.AzureAD.Model.AppRole foreach ($propertyName in $hash.psobject.Properties.Name) { $hash.$propertyName = $appRole.$propertyName } $myAppRoles.Add($hash) } $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($myAppRoles) -Force } else { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } catch {} } foreach ($credType in @('KeyCredentials', 'PasswordCredentials')) { if ($null -ne $_.PSObject.Properties[$credType]) { $_.$credType | ForEach-Object { try { if ($null -ne $_.EndDateTime -or $null -ne $_.StartDateTime) { Add-Member -InputObject $_ -MemberType NoteProperty -Name EndDate -Value $_.EndDateTime Add-Member -InputObject $_ -MemberType NoteProperty -Name StartDate -Value $_.StartDateTime $_.PSObject.Properties.Remove('EndDateTime') $_.PSObject.Properties.Remove('StartDateTime') } } catch {} } } } } $response } } function Set-EntraApplicationVerifiedPublisher { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.MSGraph.Model.SetVerifiedPublisherRequest] $SetVerifiedPublisherRequest, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $AppObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["SetVerifiedPublisherRequest"]) { $params["SetVerifiedPublisherRequest"] = $PSBoundParameters["SetVerifiedPublisherRequest"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["AppObjectId"]) { $params["AppObjectId"] = $PSBoundParameters["AppObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Set-MgApplicationVerifiedPublisher @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDeviceRegisteredUser { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/devices' $properties = '$select=*' $Method = "GET" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.DeviceId)/registeredUsers?$properties" } if($null -ne $PSBoundParameters["All"]) { $URI = "$baseUri/$($params.DeviceId)/registeredUsers?$properties" } if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] $URI = "$baseUri/$($params.DeviceId)/registeredUsers?`$top=$topCount&$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value $response = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name ImmutableId -Value onPremisesImmutableId Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value mobilePhone Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value onPremisesProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value BusinessPhones Add-Member -InputObject $_ -MemberType AliasProperty -Name UserState -Value ExternalUserState Add-Member -InputObject $_ -MemberType AliasProperty -Name UserStateChangedOn -Value ExternalUserStateChangeDateTime } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Add-EntraDirectoryRoleMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["RefObjectId"]) { $TmpValue = $PSBoundParameters["RefObjectId"] $Value = "https://graph.microsoft.com/v1.0/directoryObjects/$TmpValue" $params["OdataId"] = $Value } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DirectoryRoleId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgDirectoryRoleMemberByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraServicePrincipalDelegatedPermissionClassification { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ServicePrincipalId ) PROCESS{ $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand Remove-MgServicePrincipalDelegatedPermissionClassification -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"] -DelegatedPermissionClassificationId $PSBoundParameters["Id"] } } function Get-EntraAuthorizationPolicy { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgPolicyAuthorizationPolicy @params -Headers $customHeaders $response | ForEach-Object { if ($null -ne $_) { $propsToConvert = @('DefaultUserRolePermissions') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } $response } } function Select-EntraGroupIdsServicePrincipalIsMemberOf { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.GroupIdsForMembershipCheck] $GroupIdsForMembershipCheck ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $initalResponse = Get-MgServicePrincipalMemberOf @params -Headers $customHeaders $response = $initalResponse | Where-Object -Filterscript {$_.Id -in ($GroupIdsForMembershipCheck.GroupIds)} if($response){ $response.Id } } } function Set-EntraApplicationLogo { [CmdletBinding(DefaultParameterSetName = 'File')] param ( [Parameter(ParameterSetName = "Stream", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.IO.Stream] $FileStream, [Parameter(ParameterSetName = "ByteArray", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Byte[]] $ImageByteArray, [Parameter(ParameterSetName = "File", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $FilePath, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Parameter(ParameterSetName = "Stream")] [Parameter(ParameterSetName = "File")] [Parameter(ParameterSetName = "ByteArray")] [System.String] $ObjectId ) PROCESS { try{ $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/v1.0/applications' $Method = "PUT" if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.ApplicationId)/logo" } if($null -ne $PSBoundParameters["FilePath"]){ $params["FilePath"] = $PSBoundParameters["FilePath"] $isUrl = [System.Uri]::IsWellFormedUriString($($params.FilePath), [System.UriKind]::Absolute) $isLocalFile = [System.IO.File]::Exists($($params.FilePath)) if($isUrl){ $logoBytes = (Invoke-WebRequest $($params.FilePath)).Content } elseif($isLocalFile){ $logoBytes = [System.IO.File]::ReadAllBytes($($params.FilePath)) } else{ Write-Error -Message "FilePath is invalid" -ErrorAction Stop } } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method -ContentType "image/*" -Body $logoBytes } catch [System.Net.WebException]{ Write-Error -Message "FilePath is invalid. Invalid or malformed url" -ErrorAction Stop } } } function Get-EntraContactDirectReport { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["OrgContactId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgContactDirectReport @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Add-EntraGroupMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["RefObjectId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["RefObjectId"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgGroupMember @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraConditionalAccessPolicy { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["ConditionalAccessPolicyId"] = $PSBoundParameters["PolicyId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgIdentityConditionalAccessPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Add-EntraServicePrincipalDelegatedPermissionClassification { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $PermissionId, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[Microsoft.Open.MSGraph.Model.DelegatedPermissionClassification+ClassificationEnum]] $Classification, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ServicePrincipalId, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $PermissionName ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["PermissionId"]) { $params["PermissionId"] = $PSBoundParameters["PermissionId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Classification"]) { $params["Classification"] = $PSBoundParameters["Classification"] } if($null -ne $PSBoundParameters["ServicePrincipalId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"] } if($null -ne $PSBoundParameters["PermissionName"]) { $params["PermissionName"] = $PSBoundParameters["PermissionName"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgServicePrincipalDelegatedPermissionClassification @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraServicePrincipalAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $AppRoleAssignmentId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["AppRoleAssignmentId"]) { $params["AppRoleAssignmentId"] = $PSBoundParameters["AppRoleAssignmentId"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgServicePrincipalAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDomainNameReference { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/v1.0/domains' $properties = '$select=*' $Method = "GET" $keysChanged = @{ObjectId = "Id"} if($null -ne $PSBoundParameters["Name"]) { $params["DomainId"] = $PSBoundParameters["Name"] $URI = "$baseUri/$($params.DomainId)/domainNameReferences?$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value $response = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value deletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value onPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name ImmutableId -Value onPremisesImmutableId Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value mobilePhone Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value onPremisesProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value businessPhones Add-Member -InputObject $_ -MemberType AliasProperty -Name UserState -Value externalUserState Add-Member -InputObject $_ -MemberType AliasProperty -Name UserStateChangedOn -Value externalUserStateChangeDate } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Set-EntraConditionalAccessPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ConditionalAccessSessionControls] $SessionControls, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $State, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ConditionalAccessConditionSet] $Conditions, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ConditionalAccessGrantControls] $GrantControls ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["Id"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["SessionControls"]) { $TmpValue = $PSBoundParameters["SessionControls"] if($TmpValue.ApplicationEnforcedRestrictions){ $ApplicationEnforcedRestrictions = @{} $ApplicationEnforcedRestrictions["IsEnabled"] = $TmpValue.ApplicationEnforcedRestrictions.IsEnabled } if($TmpValue.CloudAppSecurity){ $CloudAppSecurity = @{} $CloudAppSecurity["IsEnabled"] = $TmpValue.CloudAppSecurity.IsEnabled $CloudAppSecurity["CloudAppSecurityType"] = $TmpValue.CloudAppSecurity.CloudAppSecurityType } if($TmpValue.PersistentBrowser){ $PersistentBrowser = @{} $PersistentBrowser["IsEnabled"] = $TmpValue.PersistentBrowser.IsEnabled $PersistentBrowser["Mode"] = $TmpValue.PersistentBrowser.Mode } if($TmpValue.SignInFrequency){ $SignInFrequency = @{} $SignInFrequency["IsEnabled"] = $TmpValue.SignInFrequency.IsEnabled $SignInFrequency["Type"] = $TmpValue.SignInFrequency.Type $SignInFrequency["Value"] = $TmpValue.SignInFrequency.Value } $hash = @{} if($TmpValue.ApplicationEnforcedRestrictions) { $hash["ApplicationEnforcedRestrictions"] = $ApplicationEnforcedRestrictions } if($TmpValue.CloudAppSecurity) { $hash["CloudAppSecurity"] = $CloudAppSecurity } if($TmpValue.SignInFrequency) { $hash["SignInFrequency"] = $SignInFrequency } if($TmpValue.PersistentBrowser) { $hash["PersistentBrowser"] = $PersistentBrowser } $Value = $hash $params["SessionControls"] = $Value } if($null -ne $PSBoundParameters["State"]) { $params["State"] = $PSBoundParameters["State"] } if($null -ne $PSBoundParameters["Conditions"]) { $TmpValue = $PSBoundParameters["Conditions"] if($TmpValue.Applications){ $Applications=@{} $Applications["IncludeApplications"] = $TmpValue.Applications.IncludeApplications $Applications["ExcludeApplications"] = $TmpValue.Applications.ExcludeApplications $Applications["IncludeUserActions"] = $TmpValue.Applications.IncludeUserActions $Applications["IncludeProtectionLevels"] = $TmpValue.Applications.IncludeProtectionLevels } if($TmpValue.Locations){ $Locations = @{} $Locations["IncludeLocations"] = $TmpValue.Locations.IncludeLocations $Locations["ExcludeLocations"] = $TmpValue.Locations.ExcludeLocations } if($TmpValue.Platforms){ $Platforms = @{} $Platforms["IncludePlatforms"] = $TmpValue.Platforms.IncludePlatforms $Platforms["ExcludePlatforms"] = $TmpValue.Platforms.ExcludePlatforms } if($TmpValue.Users){ $Users = @{} $Users["IncludeUsers"] = $TmpValue.Users.IncludeUsers $Users["ExcludeUsers"] = $TmpValue.Users.ExcludeUsers $Users["IncludeGroups"] = $TmpValue.Users.IncludeGroups $Users["ExcludeGroups"] = $TmpValue.Users.ExcludeGroups $Users["IncludeRoles"] = $TmpValue.Users.IncludeRoles $Users["ExcludeRoles"] = $TmpValue.Users.ExcludeRoles } $hash = @{} if($TmpValue.Applications) {$hash["Applications"] = $Applications } if($TmpValue.ClientAppTypes) { $hash["ClientAppTypes"] = $TmpValue.ClientAppTypes } if($TmpValue.Locations) { $hash["Locations"] = $Locations } if($TmpValue.Platforms) { $hash["Platforms"] = $Platforms } if($TmpValue.SignInRiskLevels) { $hash["SignInRiskLevels"] = $TmpValue.SignInRiskLevels } if($TmpValue.Users) { $hash["Users"] = $Users } $Value = $hash $params["Conditions"] = $Value } if($null -ne $PSBoundParameters["PolicyId"]) { $params["ConditionalAccessPolicyId"] = $PSBoundParameters["PolicyId"] } if($null -ne $PSBoundParameters["GrantControls"]) { $TmpValue = $PSBoundParameters["GrantControls"] $hash = @{} if($TmpValue._Operator) { $hash["Operator"] = $TmpValue._Operator } if($TmpValue.BuiltInControls) { $hash["BuiltInControls"] = $TmpValue.BuiltInControls } if($TmpValue.CustomAuthenticationFactors) { $hash["CustomAuthenticationFactors"] = $TmpValue.CustomAuthenticationFactors } if($TmpValue.TermsOfUse) { $hash["TermsOfUse"] = $TmpValue.TermsOfUse } $Value = $hash $params["GrantControls"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgIdentityConditionalAccessPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraAdministrativeUnitMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $MemberId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["Id"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["MemberId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["MemberId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDirectoryAdministrativeUnitMemberByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserOAuth2PermissionGrant { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserOAuth2PermissionGrant @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraOAuth2PermissionGrant { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgOAuth2PermissionGrant @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraIdentityProvider { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $ClientId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Name, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Type, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $ClientSecret ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{} if($null -ne $PSBoundParameters["Id"]) { $params["IdentityProviderBaseId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["Type"]) { $body["identityProviderType"] = $PSBoundParameters["Type"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Name"]) { $body["displayName"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["ClientId"]) { $body["clientId"] = $PSBoundParameters["ClientId"] } if($null -ne $PSBoundParameters["ClientSecret"]) { $body["clientSecret"] = $PSBoundParameters["ClientSecret"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } $body["@odata.type"] = "#microsoft.graph.socialIdentityProvider" $params["BodyParameter"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgIdentityProvider @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name Name -Value DisplayName Add-Member -InputObject $_ -MemberType AliasProperty -Name Type -Value identityProviderType } } $response } } function Remove-EntraDeletedDirectoryObject { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $Method = "DELETE" $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["Id"]) { $params["Id"] = $PSBoundParameters["Id"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $URI = "https://graph.microsoft.com/v1.0/directory/deletedItems/$Id" $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method $Method $response } } function Revoke-EntraSignedInUserAllRefreshToken { [CmdletBinding(DefaultParameterSetName = '')] param ( ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri 'https://graph.microsoft.com/v1.0/me/revokeSignInSessions' -Method POST).value if($response){ $responseType = New-Object Microsoft.Graph.PowerShell.Models.ComponentsMwc6EoResponsesRevokesigninsessionsresponseContentApplicationJsonSchema $responseType.Value= $response $responseType } } } function Get-EntraContactMembership { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["OrgContactId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgContactMemberOf @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraNamedLocationPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsTrusted, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.IpRange]] $IpRanges, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.CountriesAndRegion]] $CountriesAndRegions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IncludeUnknownCountriesAndRegions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $OdataType ) PROCESS { $body = @{} $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["IncludeUnknownCountriesAndRegions"]) { $body["IncludeUnknownCountriesAndRegions"] = $PSBoundParameters["IncludeUnknownCountriesAndRegions"] } if($null -ne $PSBoundParameters["Id"]) { $body["Id"] = $PSBoundParameters["Id"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["IsTrusted"]) { $body["IsTrusted"] = $PSBoundParameters["IsTrusted"] } if($null -ne $PSBoundParameters["OdataType"]) { $body["@odata.type"] = $PSBoundParameters["OdataType"] } if($null -ne $PSBoundParameters["CountriesAndRegions"]) { $body["CountriesAndRegions"] = $PSBoundParameters["CountriesAndRegions"] } if($null -ne $PSBoundParameters["IpRanges"]) { $Tmp = $PSBoundParameters["IpRanges"] $hash =@() foreach($i in $Tmp){ $hash += @{cidrAddress=$i.CidrAddress} } $body["IpRanges"] = $hash } if($null -ne $PSBoundParameters["DisplayName"]) { $body["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } $params["BodyParameter"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgIdentityConditionalAccessNamedLocation @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id $propsToConvert = @('ipRanges') try { foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } catch {} } } $response } } function Confirm-EntraDomain { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.CrossCloudVerificationCodeBody] $CrossCloudVerificationCode ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["Name"]) { $params["DomainId"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["CrossCloudVerificationCode"]) { $params["CrossCloudVerificationCode"] = $PSBoundParameters["CrossCloudVerificationCode"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Confirm-MgDomain @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraServicePrincipalOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $OwnerId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["OwnerId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["OwnerId"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgServicePrincipalOwnerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraUserAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $AppRoleAssignmentId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["AppRoleAssignmentId"]) { $params["AppRoleAssignmentId"] = $PSBoundParameters["AppRoleAssignmentId"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgUserAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraDirectoryRoleAssignment { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["UnifiedRoleAssignmentId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgRoleManagementDirectoryRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraIdentityProvider { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["IdentityProviderBaseId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgIdentityProvider @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDeletedApplication { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"; ObjectId = "Id"} if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $Value = "displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')" $params["Filter"] = $Value } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDirectoryDeletedItemAsApplication @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id $propsToConvert = @( 'AddIns','AppRoles','GroupMembershipClaims','IdentifierUris','Info', 'IsDeviceOnlyAuthSupported','KeyCredentials','OptionalClaims', 'ParentalControlSettings','PasswordCredentials','Api','PublicClient', 'PublisherDomain','Web','RequiredResourceAccess') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } Add-Member -InputObject $_ -MemberType AliasProperty -Name AppLogoUrl -Value Logo Add-Member -InputObject $_ -MemberType AliasProperty -Name InformationalUrls -Value Info Add-Member -InputObject $_ -MemberType AliasProperty -Name HomePage -Value Web.HomePageUrl Add-Member -InputObject $_ -MemberType AliasProperty -Name LogoutUrl -Value Web.LogoutUrl Add-Member -InputObject $_ -MemberType AliasProperty -Name ReplyUrls -Value Web.RedirectUris Add-Member -InputObject $_ -MemberType AliasProperty -Name KnownClientApplications -Value Api.KnownClientApplications Add-Member -InputObject $_ -MemberType AliasProperty -Name PreAuthorizedApplications -Value Api.PreAuthorizedApplications Add-Member -InputObject $_ -MemberType AliasProperty -Name Oauth2AllowImplicitFlow -Value Web.Oauth2AllowImplicitFlow } } $response } } function Get-EntraExtensionProperty { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsSyncedFromOnPremises ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["IsSyncedFromOnPremises"]) { $params["IsSyncedFromOnPremises"] = $PSBoundParameters["IsSyncedFromOnPremises"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDirectoryObjectAvailableExtensionProperty @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Select-EntraGroupIdsGroupIsMemberOf { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.GroupIdsForMembershipCheck] $GroupIdsForMembershipCheck ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["GroupIdsForMembershipCheck"]) { $GroupIdData = Get-EntraGroup -All } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $initalResponse = Get-MgGroupMemberOf @params -Headers $customHeaders $response = $initalResponse | Where-Object -Filterscript {$_.Id -in ($GroupIdsForMembershipCheck.GroupIds)} $result=@() if($response){ $result = $response.Id } $notMember = $GroupIdsForMembershipCheck.GroupIds | Where-Object -Filterscript { $_ -notin $result } foreach ($Id in $notMember) { if ($GroupIdData.Id -notcontains $Id) { Write-Error "Error occurred while executing SelectEntraGroupIdsGroupIsMemberOf Code: Request_BadRequest Message: Invalid GUID:$Id" return } } if($response){ $response.Id } } } function Remove-EntraDeviceRegisteredUser { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $UserId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["UserId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["UserId"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDeviceRegisteredUserByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraGroup { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $GroupTypes, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsAssignableToRole, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $SecurityEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Visibility, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $MailEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $MailNickname ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["GroupTypes"]) { $params["GroupTypes"] = $PSBoundParameters["GroupTypes"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["IsAssignableToRole"]) { $params["IsAssignableToRole"] = $PSBoundParameters["IsAssignableToRole"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["SecurityEnabled"]) { $params["SecurityEnabled"] = $PSBoundParameters["SecurityEnabled"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["Visibility"]) { $params["Visibility"] = $PSBoundParameters["Visibility"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["MailEnabled"]) { $params["MailEnabled"] = $PSBoundParameters["MailEnabled"] } if($null -ne $PSBoundParameters["MailNickname"]) { $params["MailNickname"] = $PSBoundParameters["MailNickname"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgGroup @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Add-EntraLifecyclePolicyGroup { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $GroupId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupLifecyclePolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["GroupId"]) { $params["GroupId"] = $PSBoundParameters["GroupId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Add-MgGroupToLifecyclePolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraAdministrativeUnit { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDirectoryAdministrativeUnit @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDeletedGroup { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["DirectoryObjectId"] = $PSBoundParameters["Id"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $Value = "mailNickName eq '$TmpValue' or (mail eq '$TmpValue' or (displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')))" $params["Filter"] = $Value } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDirectoryDeletedItemAsGroup @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraAuthorizationPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AllowEmailVerifiedUsersToJoinOrganization, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AllowedToUseSSPR, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AllowedToSignUpEmailBasedSubscriptions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $BlockMsolPowerShell, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.DefaultUserRolePermissions] $DefaultUserRolePermissions ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["AllowEmailVerifiedUsersToJoinOrganization"]) { $params["AllowEmailVerifiedUsersToJoinOrganization"] = $PSBoundParameters["AllowEmailVerifiedUsersToJoinOrganization"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["AllowedToUseSSPR"]) { $params["AllowedToUseSSPR"] = $PSBoundParameters["AllowedToUseSSPR"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["AllowedToSignUpEmailBasedSubscriptions"]) { $params["AllowedToSignUpEmailBasedSubscriptions"] = $PSBoundParameters["AllowedToSignUpEmailBasedSubscriptions"] } if($null -ne $PSBoundParameters["BlockMsolPowerShell"]) { $params["BlockMsolPowerShell"] = $PSBoundParameters["BlockMsolPowerShell"] } if($null -ne $PSBoundParameters["DefaultUserRolePermissions"]) { $TmpValue = $PSBoundParameters["DefaultUserRolePermissions"] $hash = @{} $hash["AllowedToCreateApps"] = $TmpValue.AllowedToCreateApps $hash["AllowedToCreateSecurityGroups"] = $TmpValue.AllowedToCreateSecurityGroups $hash["AllowedToReadOtherUsers"] = $TmpValue.AllowedToReadOtherUsers $hash["PermissionGrantPoliciesAssigned"] = $TmpValue.PermissionGrantPoliciesAssigned $Value = $hash $params["DefaultUserRolePermissions"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgPolicyAuthorizationPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraGroupOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $OwnerId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["OwnerId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["OwnerId"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgGroupOwnerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraDirectoryRoleDefinition { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["UnifiedRoleDefinitionId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgRoleManagementDirectoryRoleDefinition @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraApplicationPasswordCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $KeyId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["KeyId"]) { $params["KeyId"] = $PSBoundParameters["KeyId"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgApplicationPassword @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipalOwnedObject { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalOwnedObject @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDirectoryRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["UnifiedRoleAssignmentId"] = $PSBoundParameters["Id"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["SearchString"]) { $params["SearchString"] = $PSBoundParameters["SearchString"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgRoleManagementDirectoryRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserOwnedObject { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } $URI = "/v1.0/users/$($params.UserId)/ownedObjects" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" $URI = "/v1.0/users/$($params.UserId)/ownedObjects?$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $Method = "GET" $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value; $Top = $null if ($null -ne $PSBoundParameters["Top"]) { $Top = $PSBoundParameters["Top"] } if($null -ne $Top){ $userList = @() $response | ForEach-Object { if ($null -ne $_ -and $Top -gt 0) { $data = $_ | ConvertTo-Json -Depth 10 | ConvertFrom-Json $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType $Top = $Top - 1 } } $userList } else { $userList = @() $response | ForEach-Object { if ($null -ne $_) { $data = $_ | ConvertTo-Json -Depth 10 | ConvertFrom-Json $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } } $userList } } } function Remove-EntraLifecyclePolicyGroup { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $GroupId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupLifecyclePolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["GroupId"]) { $params["GroupId"] = $PSBoundParameters["GroupId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgGroupFromLifecyclePolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraDomain { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Name"]) { $params["DomainId"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDomain @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraContact { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{ObjectId = "Id"} if($null -ne $PSBoundParameters["ObjectId"]) { $params["OrgContactId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgContact @params -Headers $customHeaders $response | ForEach-Object { if ($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value Phones Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value ServiceProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value Phones $propsToConvert = @('Addresses','Manager','Phones') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } $response } } function Set-EntraGroupLifecyclePolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AlternateNotificationEmails, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ManagedGroupTypes, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Int32]] $GroupLifetimeInDays ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupLifecyclePolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["AlternateNotificationEmails"]) { $params["AlternateNotificationEmails"] = $PSBoundParameters["AlternateNotificationEmails"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ManagedGroupTypes"]) { $params["ManagedGroupTypes"] = $PSBoundParameters["ManagedGroupTypes"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["GroupLifetimeInDays"]) { $params["GroupLifetimeInDays"] = $PSBoundParameters["GroupLifetimeInDays"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgGroupLifecyclePolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraGroupAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgGroupAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDirectoryRoleDefinition { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"} if($null -ne $PSBoundParameters["Id"]) { $params["UnifiedRoleDefinitionId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $Value = "startswith(displayName,'$TmpValue')" $params["Filter"] = $Value } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgRoleManagementDirectoryRoleDefinition @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { $propsToConvert = @('RolePermissions') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraPermissionGrantConditionSet { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ConditionSetType, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["Id"]) { $params["PermissionGrantConditionSetId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["ConditionSetType"]) { $conditionalSet = $PSBoundParameters["ConditionSetType"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["PermissionGrantPolicyId"] = $PSBoundParameters["PolicyId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if("$conditionalSet" -eq "includes"){ $response = Get-MgPolicyPermissionGrantPolicyInclude @params -Headers $customHeaders } elseif("$conditionalSet" -eq "excludes"){ $response = Get-MgPolicyPermissionGrantPolicyExclude @params -Headers $customHeaders } else{ Write-Error("Message: Resource not found for the segment '$conditionalSet'.") return } $response } function Remove-EntraGroupMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $MemberId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["MemberId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["MemberId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgGroupMemberByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipalCreatedObject { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalCreatedObject @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraApplicationKeyCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand (Get-MgApplication -Headers $customHeaders -ApplicationId $PSBoundParameters["ObjectId"]).KeyCredentials } } function Get-EntraServicePrincipalOwner { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalOwner @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id $propsToConvert = @('appRoles','oauth2PermissionScopes') try{ foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } }catch{} } } $response } } function Get-EntraUserThumbnailPhoto { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $FilePath, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Boolean] $View, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $FileName, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["FilePath"]) { $params["FilePath"] = $PSBoundParameters["FilePath"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["View"]) { $params["View"] = $PSBoundParameters["View"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["FileName"]) { $params["FileName"] = $PSBoundParameters["FileName"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserPhoto @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipalKeyCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $response = (Get-MgServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"]).KeyCredentials $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name EndDate -Value EndDateTime } } $response } function Remove-EntraDevice { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDevice @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserExtension { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserExtension @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserCreatedObject { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserCreatedObject @params -Headers $customHeaders $properties = @{ ObjectId = "Id" DeletionTimestamp = "deletedDateTime" AppOwnerTenantId = "appOwnerOrganizationId" } $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties foreach ($prop in $properties.GetEnumerator()) { $propertyName = $prop.Name $propertyValue = $prop.Value if ($_.PSObject.Properties.Match($propertyName)) { $_ | Add-Member -MemberType AliasProperty -Name $propertyName -Value $propertyValue } } $propsToConvert = @('keyCredentials','passwordCredentials','requiredResourceAccess') foreach ($prop in $propsToConvert) { try { if($_.PSObject.Properties.Match($prop)) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } catch {} } } } $response } } function Set-EntraNamedLocationPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $OdataType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.CountriesAndRegion]] $CountriesAndRegions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsTrusted, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.IpRange]] $IpRanges, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IncludeUnknownCountriesAndRegions ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{} if($null -ne $PSBoundParameters["IncludeUnknownCountriesAndRegions"]) { $body["IncludeUnknownCountriesAndRegions"] = $PSBoundParameters["IncludeUnknownCountriesAndRegions"] } if($null -ne $PSBoundParameters["Id"]) { $body["Id"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["NamedLocationId"] = $PSBoundParameters["PolicyId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["IsTrusted"]) { $body["IsTrusted"] = $PSBoundParameters["IsTrusted"] } if($null -ne $PSBoundParameters["OdataType"]) { $body["@odata.type"] = $PSBoundParameters["OdataType"] } if($null -ne $PSBoundParameters["CountriesAndRegions"]) { $body["CountriesAndRegions"] = $PSBoundParameters["CountriesAndRegions"] } if($null -ne $PSBoundParameters["IpRanges"]) { $Tmp = $PSBoundParameters["IpRanges"] $hash =@() foreach($i in $Tmp){ $hash += @{cidrAddress=$i.CidrAddress} } $body["IpRanges"] = $hash } if($null -ne $PSBoundParameters["DisplayName"]) { $body["DisplayName"] = $PSBoundParameters["DisplayName"] } $params["BodyParameter"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgIdentityConditionalAccessNamedLocation @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraDirectoryRoleDefinition { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.RolePermission]] $RolePermissions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Version, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ResourceScopes, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $TemplateId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["UnifiedRoleDefinitionId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["RolePermissions"]) { $TmpValue = $PSBoundParameters["RolePermissions"] $Value = @() foreach($val in $TmpValue) { $Temp = $val | ConvertTo-Json $hash = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { $hash[$_.Name] = $_.Value } $Value += $hash } $params["RolePermissions"] = $Value } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["IsEnabled"]) { $params["IsEnabled"] = $PSBoundParameters["IsEnabled"] } if($null -ne $PSBoundParameters["Version"]) { $params["Version"] = $PSBoundParameters["Version"] } if($null -ne $PSBoundParameters["ResourceScopes"]) { $params["ResourceScopes"] = $PSBoundParameters["ResourceScopes"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["TemplateId"]) { $params["TemplateId"] = $PSBoundParameters["TemplateId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgRoleManagementDirectoryRoleDefinition @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraContactManager { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["OrgContactId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgContactManager @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraPermissionGrantConditionSet { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Permissions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ClientApplicationTenantIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $ClientApplicationsFromVerifiedPublisherOnly, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ConditionSetType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ClientApplicationIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ResourceApplication, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ClientApplicationPublisherIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PermissionClassification, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PermissionType ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ClientApplicationTenantIds"]) { $params["ClientApplicationTenantIds"] = $PSBoundParameters["ClientApplicationTenantIds"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ClientApplicationsFromVerifiedPublisherOnly"]) { $params["ClientApplicationsFromVerifiedPublisherOnly"] = $PSBoundParameters["ClientApplicationsFromVerifiedPublisherOnly"] } if($null -ne $PSBoundParameters["ClientApplicationPublisherIds"]) { $params["ClientApplicationPublisherIds"] = $PSBoundParameters["ClientApplicationPublisherIds"] } if($null -ne $PSBoundParameters["PermissionType"]) { $params["PermissionType"] = $PSBoundParameters["PermissionType"] } if($null -ne $PSBoundParameters["ConditionSetType"]) { $conditionalSet = $PSBoundParameters["ConditionSetType"] } if($null -ne $PSBoundParameters["Permissions"]) { $params["Permissions"] = $PSBoundParameters["Permissions"] } if($null -ne $PSBoundParameters["ClientApplicationIds"]) { $params["ClientApplicationIds"] = $PSBoundParameters["ClientApplicationIds"] } if($null -ne $PSBoundParameters["Id"]) { $params["PermissionGrantConditionSetId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["ResourceApplication"]) { $params["ResourceApplication"] = $PSBoundParameters["ResourceApplication"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["PermissionClassification"]) { $params["PermissionClassification"] = $PSBoundParameters["PermissionClassification"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["PermissionGrantPolicyId"] = $PSBoundParameters["PolicyId"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if("$conditionalSet" -eq "includes"){ $response = Update-MgPolicyPermissionGrantPolicyInclude @params -Headers $customHeaders } elseif("$conditionalSet" -eq "excludes"){ $response = Update-MgPolicyPermissionGrantPolicyExclude @params -Headers $customHeaders } else{ Write-Error("Message: Resource not found for the segment '$conditionalSet'.") return } $response } } function Get-EntraApplicationOwner { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/applications' $properties = '$select=*' $Method = "GET" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.ApplicationId)/owners?$properties" } if($null -ne $PSBoundParameters["All"]) { $URI = "$baseUri/$($params.ApplicationId)/owners?$properties" } if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] $URI = "$baseUri/$($params.ApplicationId)/owners?`$top=$topCount&$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value $response = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Remove-EntraScopedRoleMembership { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ScopedRoleMembershipId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["Id"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["ScopedRoleMembershipId"]) { $params["ScopedRoleMembershipId"] = $PSBoundParameters["ScopedRoleMembershipId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDirectoryAdministrativeUnitScopedRoleMember @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraUserExtension { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ExtensionValue, [Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ExtensionName, [Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Parameter(ParameterSetName = "SetMultiple", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "SetMultiple", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Collections.Generic.Dictionary`2[System.String,System.String]] $ExtensionNameValues ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["ExtensionValue"]) { $params["ExtensionValue"] = $PSBoundParameters["ExtensionValue"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ExtensionName"]) { $params["ExtensionName"] = $PSBoundParameters["ExtensionName"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["Id"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["ExtensionNameValues"]) { $params["ExtensionNameValues"] = $PSBoundParameters["ExtensionNameValues"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgUserExtension @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraLifecyclePolicyGroup { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgGroupLifecyclePolicyByGroup @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserManager { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $Method = "GET" $keysChanged = @{ObjectId = "Id"} if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } $URI = "https://graph.microsoft.com/v1.0/users/$($params.UserId)/manager?`$select=*" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" $URI = "https://graph.microsoft.com/v1.0/users/$($params.UserId)/manager?$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $URI = "https://graph.microsoft.com/v1.0/users/$($params.UserId)/manager?`$select=*" $response = Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method -ErrorAction Stop try { $response = $response | ConvertTo-Json -Depth 5 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } catch {} } } function New-EntraServicePrincipalAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $ResourceId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $PrincipalId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["AppRoleId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["ResourceId"]) { $params["ResourceId"] = $PSBoundParameters["ResourceId"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["PrincipalId"]) { $params["PrincipalId"] = $PSBoundParameters["PrincipalId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgServicePrincipalAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Add-EntraApplicationOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } $newOwner = @{} if($null -ne $PSBoundParameters["RefObjectId"]) { $newOwner["@odata.id"] = "https://graph.microsoft.com/v1.0/directoryObjects/"+$PSBoundParameters["RefObjectId"] $params["BodyParameter"] = $newOwner } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") New-MgApplicationOwnerByRef @params -Headers $customHeaders } function Remove-EntraApplication { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgApplication @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraGroupAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $ResourceId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $PrincipalId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["AppRoleId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["ResourceId"]) { $params["ResourceId"] = $PSBoundParameters["ResourceId"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["PrincipalId"]) { $params["PrincipalId"] = $PSBoundParameters["PrincipalId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgGroupAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Add-EntraDeviceRegisteredUser { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["RefObjectId"]) { $TmpValue = $PSBoundParameters["RefObjectId"] $Value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$TmpValue"} $params["BodyParameter"] = $Value } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgDeviceRegisteredUserByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraTrustedCertificateAuthority { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.CertificateAuthorityInformation] $CertificateAuthorityInformation ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $tenantId = (Get-MgContext).TenantId $params["Uri"] = "/v1.0/organization/$tenantId/certificateBasedAuthConfiguration" $params["Method"] = "POST" $certNotFound = $true $modifiedCert = $PSBoundParameters["CertificateAuthorityInformation"] $previusCerts = @() Get-EntraTrustedCertificateAuthority | ForEach-Object { if(($_.TrustedIssuer -eq $modifiedCert.TrustedIssuer) -and ($_.TrustedIssuerSki -eq $modifiedCert.TrustedIssuerSki)){ $previusCerts += $modifiedCert $certNotFound = $false } else{ $previusCerts += $_ } } if($certNotFound){ Throw [System.Management.Automation.PSArgumentException] "Provided certificate authority not found on the server. Please make sure you have provided the correct information in trustedIssuer and trustedIssuerSki fields." } $body = @{ certificateAuthorities = @() } $previusCerts | ForEach-Object { $isRoot = $false if("RootAuthority" -eq $_.AuthorityType){ $isRoot = $true } $cert = @{ isRootAuthority = $isRoot certificateRevocationListUrl = $_.CrlDistributionPoint deltaCertificateRevocationListUrl = $_.DeltaCrlDistributionPoint certificate = [convert]::tobase64string($_.TrustedCertificate) } $body.certificateAuthorities += $cert } $params["Body"] = ConvertTo-Json $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders $customObject = [PSCustomObject]@{ "@odata.context" = $response["@odata.context"] certificateAuthorities = @{ AuthorityType = if ($response.certificateAuthorities.isRootAuthority) { "RootAuthority" } else { "" } CrlDistributionPoint = $response.certificateAuthorities.certificateRevocationListUrl DeltaCrlDistributionPoint = $response.certificateAuthorities.deltaCertificateRevocationListUrl TrustedCertificate = [Convert]::FromBase64String($response.certificateAuthorities.certificate) TrustedIssuer = $response.certificateAuthorities.issuer TrustedIssuerSki = $response.certificateAuthorities.issuerSki } Id = $response.id } $customObject = $customObject | ConvertTo-Json -depth 5 | ConvertFrom-Json $certificateList = @() foreach ($certAuthority in $customObject) { $certificateType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphCertificateBasedAuthConfiguration $certAuthority.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value Add-Member -InputObject $certificateType -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $certificateList += $certificateType } $certificateList } } function Remove-EntraOAuth2PermissionGrant { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["OAuth2PermissionGrantId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgOAuth2PermissionGrant @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserOwnedDevice { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserOwnedDevice @params -Headers $customHeaders $response | ForEach-Object { if ($null -ne $_) { $propsToConvert = @('AdditionalProperties') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } $response } } function Remove-EntraGroup { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgGroup @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraUserLicense { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.AssignedLicenses] $AssignedLicenses ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] $UserId = $PSBoundParameters["ObjectId"] } $jsonBody = @{ addLicenses = @(if ($PSBoundParameters.AssignedLicenses.AddLicenses) { $PSBoundParameters.AssignedLicenses.AddLicenses | Select-Object @{Name='skuId'; Expression={$_.'skuId' -replace 's', 's'.ToLower()}} } else { @() }) removeLicenses = @(if ($PSBoundParameters.AssignedLicenses.RemoveLicenses) { $PSBoundParameters.AssignedLicenses.RemoveLicenses } else { @() }) } | ConvertTo-Json $customHeaders['Content-Type'] = 'application/json' $graphApiEndpoint = "https://graph.microsoft.com/v1.0/users/$UserId/microsoft.graph.assignLicense" Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $graphApiEndpoint -Method Post -Body $jsonBody $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraApplicationVerifiedPublisher { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $AppObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["AppObjectId"]) { $params["AppObjectId"] = $PSBoundParameters["AppObjectId"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Clear-MgApplicationVerifiedPublisher @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraPermissionGrantConditionSet { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Permissions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ClientApplicationTenantIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $ClientApplicationsFromVerifiedPublisherOnly, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ConditionSetType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ClientApplicationIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ResourceApplication, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ClientApplicationPublisherIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PermissionClassification, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PermissionType ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["PermissionType"]) { $params["PermissionType"] = $PSBoundParameters["PermissionType"] } if($null -ne $PSBoundParameters["PermissionClassification"]) { $params["PermissionClassification"] = $PSBoundParameters["PermissionClassification"] } if($null -ne $PSBoundParameters["ResourceApplication"]) { $params["ResourceApplication"] = $PSBoundParameters["ResourceApplication"] } if($null -ne $PSBoundParameters["Permissions"]) { $params["Permissions"] = $PSBoundParameters["Permissions"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ClientApplicationTenantIds"]) { $params["ClientApplicationTenantIds"] = $PSBoundParameters["ClientApplicationTenantIds"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["PermissionGrantPolicyId"] = $PSBoundParameters["PolicyId"] } if($null -ne $PSBoundParameters["ConditionSetType"]) { $conditionalSet = $PSBoundParameters["ConditionSetType"] } if($null -ne $PSBoundParameters["ClientApplicationsFromVerifiedPublisherOnly"]) { $params["ClientApplicationsFromVerifiedPublisherOnly"] = $PSBoundParameters["ClientApplicationsFromVerifiedPublisherOnly"] } if($null -ne $PSBoundParameters["ClientApplicationPublisherIds"]) { $params["ClientApplicationPublisherIds"] = $PSBoundParameters["ClientApplicationPublisherIds"] } if($null -ne $PSBoundParameters["ClientApplicationIds"]) { $params["ClientApplicationIds"] = $PSBoundParameters["ClientApplicationIds"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if("$conditionalSet" -eq "includes"){ $response = New-MgPolicyPermissionGrantPolicyInclude @params -Headers $customHeaders } elseif("$conditionalSet" -eq "excludes"){ $response = New-MgPolicyPermissionGrantPolicyExclude @params -Headers $customHeaders } else{ Write-Error("Message: Resource not found for the segment '$conditionalSet'.") return } $response } } function Remove-EntraUserExtension { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ParameterSetName = "SetMultiple", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Collections.Generic.List`1[System.String]] $ExtensionNames, [Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ExtensionName, [Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Parameter(ParameterSetName = "SetMultiple", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ExtensionNames"]) { $params["ExtensionNames"] = $PSBoundParameters["ExtensionNames"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ExtensionName"]) { $params["ExtensionName"] = $PSBoundParameters["ExtensionName"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ExtensionId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgUserExtension @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraApplicationKey { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [Microsoft.Open.MSGraph.Model.KeyCredential] $KeyCredential, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.PasswordCredential] $PasswordCredential, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Proof, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["KeyCredential"]) { $params["KeyCredential"] = $PSBoundParameters["KeyCredential"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["PasswordCredential"]) { $params["PasswordCredential"] = $PSBoundParameters["PasswordCredential"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Proof"]) { $params["Proof"] = $PSBoundParameters["Proof"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Add-MgApplicationKey @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipalMembership { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalTransitiveMemberOf @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraApplicationPassword { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [Microsoft.Open.MSGraph.Model.PasswordCredential] $PasswordCredential, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["PasswordCredential"]) { $TmpValue = $PSBoundParameters["PasswordCredential"] $hash = @{} $TmpValue.PSObject.Properties | ForEach-Object { if ($_.Value) { $hash[$_.Name] = $_.Value } } $Value = $hash $params["PasswordCredential"] = $Value } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Add-MgApplicationPassword @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDomainVerificationDnsRecord { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Name"]) { $params["DomainId"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDomainVerificationDnsRecord @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name DnsRecordId -Value Id Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraGroupAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $AppRoleAssignmentId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["AppRoleAssignmentId"]) { $params["AppRoleAssignmentId"] = $PSBoundParameters["AppRoleAssignmentId"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgGroupAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraApplicationPasswordCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } # TODO : Invoke API and apply the correct Select query $response = (Get-MgApplication -Headers $customHeaders -ApplicationId $PSBoundParameters["ObjectId"]).PasswordCredentials if($null -ne $PSBoundParameters["Property"]) { $response | Select-Object $PSBoundParameters["Property"] } else { $response } } function New-EntraDevice { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Boolean]] $AccountEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.AlternativeSecurityId]] $AlternativeSecurityIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsCompliant, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DeviceTrustType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.DateTime]] $ApproximateLastLogonTimeStamp, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Int32]] $DeviceObjectVersion, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $DevicePhysicalIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ProfileType, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DeviceOSVersion, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsManaged, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DeviceOSType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $SystemLabels, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DeviceMetadata, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DeviceId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["AccountEnabled"]) { $params["AccountEnabled"] = $PSBoundParameters["AccountEnabled"] } if($null -ne $PSBoundParameters["AlternativeSecurityIds"]) { $params["AlternativeSecurityIds"] = $PSBoundParameters["AlternativeSecurityIds"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["IsCompliant"]) { $params["IsCompliant"] = $PSBoundParameters["IsCompliant"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["DeviceTrustType"]) { $params["DeviceTrustType"] = $PSBoundParameters["DeviceTrustType"] } if($null -ne $PSBoundParameters["ApproximateLastLogonTimeStamp"]) { $params["ApproximateLastLogonTimeStamp"] = $PSBoundParameters["ApproximateLastLogonTimeStamp"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["DeviceObjectVersion"]) { $params["DeviceObjectVersion"] = $PSBoundParameters["DeviceObjectVersion"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["DevicePhysicalIds"]) { $params["DevicePhysicalIds"] = $PSBoundParameters["DevicePhysicalIds"] } if($null -ne $PSBoundParameters["ProfileType"]) { $params["ProfileType"] = $PSBoundParameters["ProfileType"] } if($null -ne $PSBoundParameters["DeviceOSVersion"]) { $params["DeviceOSVersion"] = $PSBoundParameters["DeviceOSVersion"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["IsManaged"]) { $params["IsManaged"] = $PSBoundParameters["IsManaged"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["DeviceOSType"]) { $params["DeviceOSType"] = $PSBoundParameters["DeviceOSType"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["SystemLabels"]) { $params["SystemLabels"] = $PSBoundParameters["SystemLabels"] } if($null -ne $PSBoundParameters["DeviceMetadata"]) { $params["DeviceMetadata"] = $PSBoundParameters["DeviceMetadata"] } if($null -ne $PSBoundParameters["DeviceId"]) { $params["DeviceId"] = $PSBoundParameters["DeviceId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgDevice @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDirectoryRoleTemplate { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDirectoryRoleTemplate @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraUserPassword { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Security.SecureString] $Password, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Boolean] $ForceChangePasswordNextLogin, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Boolean] $EnforceChangePasswordPolicy ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $userId = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["Password"]) { $Temp = $PSBoundParameters["Password"] $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Temp) $PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["ForceChangePasswordNextLogin"]) { $ForceChangePasswordNextSignIn = $PSBoundParameters["ForceChangePasswordNextLogin"] } if($null -ne $PSBoundParameters["EnforceChangePasswordPolicy"]) { $ForceChangePasswordNextSignInWithMfa = $PSBoundParameters["EnforceChangePasswordPolicy"] } $PasswordProfile = @{} if($null -ne $PSBoundParameters["ForceChangePasswordNextLogin"]) { $PasswordProfile["ForceChangePasswordNextSignIn"] = $ForceChangePasswordNextSignIn } if($null -ne $PSBoundParameters["EnforceChangePasswordPolicy"]) { $PasswordProfile["ForceChangePasswordNextSignInWithMfa"] = $ForceChangePasswordNextSignInWithMfa } if($null -ne $PSBoundParameters["Password"]) { $PasswordProfile["password"] = $PlainPassword } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgUser -Headers $customHeaders -UserId $userId -PasswordProfile $PasswordProfile @params $response } } function Get-EntraGroupOwner { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/groups' $properties = '$select=*' $Method = "GET" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["ObjectId"]) { $params["GroupId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.GroupId)/owners?$properties" } if($null -ne $PSBoundParameters["All"]) { $URI = "$baseUri/$($params.GroupId)/owners?$properties" } if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] $URI = "$baseUri/$($params.GroupId)/owners?`$top=$topCount&$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value $response = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Get-EntraPermissionGrantPolicy { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["PermissionGrantPolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgPolicyPermissionGrantPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDomainServiceConfigurationRecord { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Name"]) { $params["DomainId"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDomainServiceConfigurationRecord @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name DnsRecordId -Value Id Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Restore-EntraDeletedDirectoryObject { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["Id"]) { $params["DirectoryObjectId"] = $PSBoundParameters["Id"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Restore-MgDirectoryDeletedItem @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType NoteProperty -Name OdataType -value $_.AdditionalProperties['@odata.type'] } } $response } } function Remove-EntraPermissionGrantPolicy { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["PermissionGrantPolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgPolicyPermissionGrantPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraConditionalAccessPolicy { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["ConditionalAccessPolicyId"] = $PSBoundParameters["PolicyId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgIdentityConditionalAccessPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserRegisteredDevice { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserRegisteredDevice @params -Headers $customHeaders $response | ForEach-Object { if ($null -ne $_) { $propsToConvert = @('AdditionalProperties') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } $response } } function Get-EntraContract { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{ObjectId = "Id"} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ContractId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgContract @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraDirectoryRoleDefinition { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.RolePermission]] $RolePermissions, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Boolean]] $IsEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Version, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ResourceScopes, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $TemplateId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["RolePermissions"]) { $TmpValue = $PSBoundParameters["RolePermissions"] $Temp = @{ allowedResourceActions = $TmpValue.allowedResourceActions condition = $TmpValue.condition } $Value = $Temp $params["RolePermissions"] = $Value } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["IsEnabled"]) { $params["IsEnabled"] = $PSBoundParameters["IsEnabled"] } if($null -ne $PSBoundParameters["Version"]) { $params["Version"] = $PSBoundParameters["Version"] } if($null -ne $PSBoundParameters["ResourceScopes"]) { $params["ResourceScopes"] = $PSBoundParameters["ResourceScopes"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["TemplateId"]) { $params["TemplateId"] = $PSBoundParameters["TemplateId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgRoleManagementDirectoryRoleDefinition @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraTrustedCertificateAuthority { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.CertificateAuthorityInformation] $CertificateAuthorityInformation ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $tenantId = (Get-MgContext).TenantId $params["Uri"] = "/v1.0/organization/$tenantId/certificateBasedAuthConfiguration" $params["Method"] = "POST" $newCert = $PSBoundParameters["CertificateAuthorityInformation"] $previousCerts = @() Get-EntraTrustedCertificateAuthority | ForEach-Object { $previousCerts += $_ if(($_.TrustedIssuer -eq $newCert.TrustedIssuer) -and ($_.TrustedIssuerSki -eq $newCert.TrustedIssuerSki)){ Throw [System.Management.Automation.PSArgumentException] "A certificate already exists on the server with associated trustedIssuer and trustedIssuerSki fields." } } $previousCerts += $newCert $body = @{ certificateAuthorities = @() } $previousCerts | ForEach-Object { $isRoot = $false if("RootAuthority" -eq $_.AuthorityType){ $isRoot = $true } $cert = @{ isRootAuthority = $isRoot certificateRevocationListUrl = $_.CrlDistributionPoint deltaCertificateRevocationListUrl = $_.DeltaCrlDistributionPoint certificate = [convert]::tobase64string($_.TrustedCertificate) } $body.certificateAuthorities += $cert } $params["Body"] = ConvertTo-Json $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders $customObject = [PSCustomObject]@{ "@odata.context" = $response["@odata.context"] certificateAuthorities = @{ AuthorityType = if ($response.certificateAuthorities.isRootAuthority) { "RootAuthority" } else { "" } CrlDistributionPoint = $response.certificateAuthorities.certificateRevocationListUrl DeltaCrlDistributionPoint = $response.certificateAuthorities.deltaCertificateRevocationListUrl TrustedCertificate = [Convert]::FromBase64String($response.certificateAuthorities.certificate) TrustedIssuer = $response.certificateAuthorities.issuer TrustedIssuerSki = $response.certificateAuthorities.issuerSki } Id = $response.id } $customObject = $customObject | ConvertTo-Json -depth 5 | ConvertFrom-Json $certificateList = @() foreach ($certAuthority in $customObject) { $certificateType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphCertificateBasedAuthConfiguration $certAuthority.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value Add-Member -InputObject $certificateType -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $certificateList += $certificateType } $certificateList } } function Set-EntraUser { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PostalCode, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $MailNickName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $ShowInAddressList, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Department, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $TelephoneNumber, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PreferredLanguage, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Mobile, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $JobTitle, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ConsentProvidedForMinor, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PhysicalDeliveryOfficeName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PasswordPolicies, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsCompromised, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.SignInName]] $SignInNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $OtherMails, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserState, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ImmutableId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $City, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AgeGroup, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.Dictionary`2[System.String,System.String]] $ExtensionProperty, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UsageLocation, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $State, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AccountEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Country, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserPrincipalName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $GivenName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $StreetAddress, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.AzureAD.Model.PasswordProfile] $PasswordProfile, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $CompanyName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $FacsimileTelephoneNumber, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Surname, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $CreationType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $UserStateChangedOn ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["PostalCode"]) { $params["PostalCode"] = $PSBoundParameters["PostalCode"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["MailNickName"]) { $params["MailNickName"] = $PSBoundParameters["MailNickName"] } if($null -ne $PSBoundParameters["ShowInAddressList"]) { $params["ShowInAddressList"] = $PSBoundParameters["ShowInAddressList"] } if($null -ne $PSBoundParameters["Department"]) { $params["Department"] = $PSBoundParameters["Department"] } if($null -ne $PSBoundParameters["TelephoneNumber"]) { $params["BusinessPhones"] = $PSBoundParameters["TelephoneNumber"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["PreferredLanguage"]) { $params["PreferredLanguage"] = $PSBoundParameters["PreferredLanguage"] } if($null -ne $PSBoundParameters["Mobile"]) { $params["MobilePhone"] = $PSBoundParameters["Mobile"] } if($null -ne $PSBoundParameters["JobTitle"]) { $params["JobTitle"] = $PSBoundParameters["JobTitle"] } if($null -ne $PSBoundParameters["ConsentProvidedForMinor"]) { $params["ConsentProvidedForMinor"] = $PSBoundParameters["ConsentProvidedForMinor"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PhysicalDeliveryOfficeName"]) { $params["PhysicalDeliveryOfficeName"] = $PSBoundParameters["PhysicalDeliveryOfficeName"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PasswordPolicies"]) { $params["PasswordPolicies"] = $PSBoundParameters["PasswordPolicies"] } if($null -ne $PSBoundParameters["IsCompromised"]) { $params["IsCompromised"] = $PSBoundParameters["IsCompromised"] } if($null -ne $PSBoundParameters["SignInNames"]) { $params["Identities"] = $PSBoundParameters["SignInNames"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["OtherMails"]) { $params["OtherMails"] = $PSBoundParameters["OtherMails"] } if($null -ne $PSBoundParameters["UserState"]) { $params["ExternalUserState"] = $PSBoundParameters["UserState"] } if($null -ne $PSBoundParameters["ImmutableId"]) { $params["OnPremisesImmutableId"] = $PSBoundParameters["ImmutableId"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["City"]) { $params["City"] = $PSBoundParameters["City"] } if($null -ne $PSBoundParameters["AgeGroup"]) { $params["AgeGroup"] = $PSBoundParameters["AgeGroup"] } if($null -ne $PSBoundParameters["ExtensionProperty"]) { $params["ExtensionProperty"] = $PSBoundParameters["ExtensionProperty"] } if($null -ne $PSBoundParameters["UsageLocation"]) { $params["UsageLocation"] = $PSBoundParameters["UsageLocation"] } if($null -ne $PSBoundParameters["State"]) { $params["State"] = $PSBoundParameters["State"] } if($null -ne $PSBoundParameters["AccountEnabled"]) { $params["AccountEnabled"] = $PSBoundParameters["AccountEnabled"] } if($null -ne $PSBoundParameters["Country"]) { $params["Country"] = $PSBoundParameters["Country"] } if($null -ne $PSBoundParameters["UserPrincipalName"]) { $params["UserPrincipalName"] = $PSBoundParameters["UserPrincipalName"] } if($null -ne $PSBoundParameters["GivenName"]) { $params["GivenName"] = $PSBoundParameters["GivenName"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["UserType"]) { $params["UserType"] = $PSBoundParameters["UserType"] } if($null -ne $PSBoundParameters["StreetAddress"]) { $params["StreetAddress"] = $PSBoundParameters["StreetAddress"] } if($null -ne $PSBoundParameters["PasswordProfile"]) { $TmpValue = $PSBoundParameters["PasswordProfile"] $Value = @{ forceChangePasswordNextSignIn = $TmpValue.ForceChangePasswordNextLogin forceChangePasswordNextSignInWithMfa = $TmpValue.EnforceChangePasswordPolicy password = $TmpValue.Password } $params["PasswordProfile"] = $Value } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["CompanyName"]) { $params["CompanyName"] = $PSBoundParameters["CompanyName"] } if($null -ne $PSBoundParameters["FacsimileTelephoneNumber"]) { $params["FacsimileTelephoneNumber"] = $PSBoundParameters["FacsimileTelephoneNumber"] } if($null -ne $PSBoundParameters["Surname"]) { $params["Surname"] = $PSBoundParameters["Surname"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["CreationType"]) { $params["CreationType"] = $PSBoundParameters["CreationType"] } if($null -ne $PSBoundParameters["UserStateChangedOn"]) { $params["ExternalUserStateChangeDateTime"] = $PSBoundParameters["UserStateChangedOn"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgUser @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserDirectReport { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/users' $properties = '$select=*' $Method = "GET" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.UserId)/directReports?$properties" } if($null -ne $PSBoundParameters["All"]) { $URI = "$baseUri/$($params.UserId)/directReports?$properties" } if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] $URI = "$baseUri/$($params.UserId)/directReports?`$top=$topCount&$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value $response = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name ImmutableId -Value onPremisesImmutableId Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value mobilePhone Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value onPremisesProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value BusinessPhones Add-Member -InputObject $_ -MemberType AliasProperty -Name UserState -Value ExternalUserState Add-Member -InputObject $_ -MemberType AliasProperty -Name UserStateChangedOn -Value ExternalUserStateChangeDateTime } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Remove-EntraDirectoryRoleMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $MemberId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DirectoryRoleId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["MemberId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["MemberId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDirectoryRoleMemberByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraApplicationOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $OwnerId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectID"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectID"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["OwnerId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["OwnerId"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgApplicationOwnerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraDomain { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsDefaultForCloudRedirections, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $SupportedServices, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsDefault ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["Name"]) { $params["DomainId"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["IsDefaultForCloudRedirections"]) { $params["IsDefaultForCloudRedirections"] = $PSBoundParameters["IsDefaultForCloudRedirections"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["SupportedServices"]) { $params["SupportedServices"] = $PSBoundParameters["SupportedServices"] } if($null -ne $PSBoundParameters["IsDefault"]) { $params["IsDefault"] = $PSBoundParameters["IsDefault"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgDomain @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraNamedLocationPolicy { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["NamedLocationId"] = $PSBoundParameters["PolicyId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgIdentityConditionalAccessNamedLocation @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraApplication { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AddIn]] $AddIns, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $SignInAudience, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.RequiredResourceAccess]] $RequiredResourceAccess, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ApiApplication] $Api, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ParentalControlSettings] $ParentalControlSettings, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.OptionalClaims] $OptionalClaims, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $TokenEncryptionKeyId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.KeyCredential]] $KeyCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $IdentifierUris, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $GroupMembershipClaims, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.WebApplication] $Web, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsDeviceOnlyAuthSupported, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsFallbackPublicClient, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.PublicClientApplication] $PublicClient, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Tags, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.InformationalUrl] $InformationalUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.PasswordCredential]] $PasswordCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AppRole]] $AppRoles ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["Api"]) { $TmpValue = $PSBoundParameters["Api"] $Temp = $TmpValue | ConvertTo-Json $Value = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { $Value[$_.Name] = $_.Value } $params["Api"] = $Value } if($null -ne $PSBoundParameters["OptionalClaims"]) { $TmpValue = $PSBoundParameters["OptionalClaims"] $Temp = $TmpValue | ConvertTo-Json $Value = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { $Value[$_.Name] = $_.Value } $params["OptionalClaims"] = $Value } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["Tags"]) { $params["Tags"] = $PSBoundParameters["Tags"] } if($null -ne $PSBoundParameters["Web"]) { $TmpValue = $PSBoundParameters["Web"] $Value = @{} if($TmpValue.HomePageUrl) { $Value["HomePageUrl"] = $TmpValue.HomePageUrl } if($TmpValue.LogoutUrl) { $Value["LogoutUrl"] = $TmpValue.LogoutUrl } if($TmpValue.RedirectUris) { $Value["RedirectUris"] = $TmpValue.RedirectUris } if($TmpValue.ImplicitGrantSettings) { $Value["ImplicitGrantSettings"] = $TmpValue.ImplicitGrantSettings } $params["Web"] = $Value } if($null -ne $PSBoundParameters["IsFallbackPublicClient"]) { $params["IsFallbackPublicClient"] = $PSBoundParameters["IsFallbackPublicClient"] } if($null -ne $PSBoundParameters["RequiredResourceAccess"]) { $TmpValue = $PSBoundParameters["RequiredResourceAccess"] $Value = $TmpValue | ConvertTo-Json $params["RequiredResourceAccess"] = $Value } if($null -ne $PSBoundParameters["PublicClient"]) { $TmpValue = $PSBoundParameters["PublicClient"] $Temp = $TmpValue | ConvertTo-Json $Value = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { $Value[$_.Name] = $_.Value } $params["PublicClient"] = $Value } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["IsDeviceOnlyAuthSupported"]) { $params["IsDeviceOnlyAuthSupported"] = $PSBoundParameters["IsDeviceOnlyAuthSupported"] } if($null -ne $PSBoundParameters["KeyCredentials"]) { $TmpValue = $PSBoundParameters["KeyCredentials"] $a = @() $inpu = $TmpValue foreach($v in $inpu) { $hash = @{} if($TmpValue.CustomKeyIdentifier) { $hash["CustomKeyIdentifier"] = $v.CustomKeyIdentifier } if($TmpValue.EndDateTime) { $hash["EndDateTime"] = $v.EndDateTime } if($TmpValue.Key) { $hash["Key"] = $v.Key } if($TmpValue.StartDateTime) { $hash["StartDateTime"] = $v.StartDateTime } if($TmpValue.Type) { $hash["Type"] = $v.Type } if($TmpValue.Usage) { $hash["Usage"] = $v.Usage } if($TmpValue.DisplayName) { $hash["DisplayName"] = $v.DisplayName } if($TmpValue.KeyId) { $hash["KeyId"] = $v.KeyId } $a += $hash } $Value = $a $params["KeyCredentials"] = $Value } if($null -ne $PSBoundParameters["TokenEncryptionKeyId"]) { $params["TokenEncryptionKeyId"] = $PSBoundParameters["TokenEncryptionKeyId"] } if($null -ne $PSBoundParameters["IdentifierUris"]) { $params["IdentifierUris"] = $PSBoundParameters["IdentifierUris"] } if($null -ne $PSBoundParameters["ParentalControlSettings"]) { $TmpValue = $PSBoundParameters["ParentalControlSettings"] $Temp = $TmpValue | ConvertTo-Json $Value = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { $Value[$_.Name] = $_.Value } $params["ParentalControlSettings"] = $Value } if($null -ne $PSBoundParameters["GroupMembershipClaims"]) { $params["GroupMembershipClaims"] = $PSBoundParameters["GroupMembershipClaims"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["AddIns"]) { $TmpValue = $PSBoundParameters["AddIns"] $Value = @() $Properties = @() foreach($prop in $TmpValue.Properties) { $Temp = $prop | ConvertTo-Json $hash = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { $hash[$_.Name] = $_.Value } $Properties += $hash } foreach($data in $TmpValue) { $hash = @{ Id= $data.Id Type = $data.Type Properties = $Properties } $Value += $hash } $params["AddIns"] = $Value } if($null -ne $PSBoundParameters["AppRoles"]) { $TmpValue = $PSBoundParameters["AppRoles"] $a = @() $inpu = $TmpValue foreach($v in $inpu) { $hash = @{} if($TmpValue.AllowedMemberTypes) { $hash["AllowedMemberTypes"] = $v.AllowedMemberTypes } if($TmpValue.Description) { $hash["Description"] = $v.Description } if($TmpValue.DisplayName) { $hash["DisplayName"] = $v.DisplayName } if($TmpValue.Id) { $hash["Id"] = $v.Id } if($TmpValue.IsEnabled) { $hash["IsEnabled"] = $v.IsEnabled } if($TmpValue.Origin) { $hash["Origin"] = $v.Origin } if($TmpValue.Value) { $hash["Value"] = $v.Value } $a += $hash } $Value = $a $params["AppRoles"] = $Value } if($null -ne $PSBoundParameters["PasswordCredentials"]) { $TmpValue = $PSBoundParameters["PasswordCredentials"] $a = @() $inpu = $TmpValue foreach($v in $inpu) { $hash = @{} if($TmpValue.CustomKeyIdentifier) { $hash["CustomKeyIdentifier"] = $v.CustomKeyIdentifier } if($TmpValue.EndDateTime) { $hash["EndDateTime"] = $v.EndDateTime } if($TmpValue.Hint) { $hash["Hint"] = $v.Hint } if($TmpValue.StartDateTime) { $hash["StartDateTime"] = $v.StartDateTime } if($TmpValue.SecretText) { $hash["SecretText"] = $v.SecretText } if($TmpValue.DisplayName) { $hash["DisplayName"] = $v.DisplayName } if($TmpValue.KeyId) { $hash["KeyId"] = $v.KeyId } $a += $hash } $Value = $a $params["PasswordCredentials"] = $Value } if($null -ne $PSBoundParameters["SignInAudience"]) { $params["SignInAudience"] = $PSBoundParameters["SignInAudience"] } if($null -ne $PSBoundParameters["InformationalUrl"]) { $TmpValue = $PSBoundParameters["InformationalUrl"] $Temp = $TmpValue | ConvertTo-Json $Value = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { $Value[$_.Name] = $_.Value } $params["Info"] = $Value } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgApplication @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDevice { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"; ObjectId = "Id"} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $Value = "displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')" $params["Filter"] = $Value } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDevice @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name DeviceTrustType -Value TrustType Add-Member -InputObject $_ -MemberType AliasProperty -Name DeviceOSVersion -Value OperatingSystemVersion Add-Member -InputObject $_ -MemberType AliasProperty -Name DevicePhysicalIds -Value PhysicalIds Add-Member -InputObject $_ -MemberType AliasProperty -Name ComplianceExpiryTime -Value ComplianceExpirationDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DeviceObjectVersion -Value DeviceVersion Add-Member -InputObject $_ -MemberType AliasProperty -Name ApproximateLastLogonTimestamp -Value ApproximateLastSignInDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DeviceOSType -Value OperatingSystem Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUser { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $topCount = $null $upnPresent = $false $baseUri = 'https://graph.microsoft.com/v1.0/users' $properties = '$select=Id,AccountEnabled,AgeGroup,OfficeLocation,AssignedLicenses,AssignedPlans,City,CompanyName,ConsentProvidedForMinor,Country,CreationType,Department,DisplayName,GivenName,OnPremisesImmutableId,JobTitle,LegalAgeGroupClassification,Mail,MailNickName,MobilePhone,OnPremisesSecurityIdentifier,OtherMails,PasswordPolicies,PasswordProfile,PostalCode,PreferredLanguage,ProvisionedPlans,OnPremisesProvisioningErrors,ProxyAddresses,RefreshTokensValidFromDateTime,ShowInAddressList,State,StreetAddress,Surname,BusinessPhones,UsageLocation,UserPrincipalName,ExternalUserState,ExternalUserStateChangeDateTime,UserType,OnPremisesLastSyncDateTime,ImAddresses,SecurityIdentifier,OnPremisesUserPrincipalName,ServiceProvisioningErrors,IsResourceAccount,OnPremisesExtensionAttributes,DeletedDateTime,OnPremisesSyncEnabled,EmployeeType,EmployeeHireDate,CreatedDateTime,EmployeeOrgData,preferredDataLocation,Identities,onPremisesSamAccountName,EmployeeId,EmployeeLeaveDateTime,AuthorizationInfo,FaxNumber,OnPremisesDistinguishedName,OnPremisesDomainName,IsLicenseReconciliationNeeded,signInSessionsValidFromDateTime' $params["Method"] = "GET" $params["Uri"] = "$baseUri/?$properties" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" $params["Uri"] = "$baseUri/?$properties" } if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] if ($topCount -gt 999) { $params["Uri"] += "&`$top=999" } else{ $params["Uri"] += "&`$top=$topCount" } } if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $SearchString = "`$search=`"userprincipalname:$TmpValue`" OR `"state:$TmpValue`" OR `"mailNickName:$TmpValue`" OR `"mail:$TmpValue`" OR `"jobTitle:$TmpValue`" OR `"displayName:$TmpValue`" OR `"department:$TmpValue`" OR `"country:$TmpValue`" OR `"city:$TmpValue`"" $params["Uri"] += "&$SearchString" $customHeaders['ConsistencyLevel'] = 'eventual' } if($null -ne $PSBoundParameters["ObjectId"]) { $UserId = $PSBoundParameters["ObjectId"] if ($UserId -match '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'){ $f = '$' + 'Filter' $Filter = "UserPrincipalName eq '$UserId'" $params["Uri"] += "&$f=$Filter" $upnPresent = $true } else{ $params["Uri"] = "$baseUri/$($UserId)?$properties" } } if($null -ne $PSBoundParameters["Filter"]) { $Filter = $PSBoundParameters["Filter"] $f = '$' + 'Filter' $params["Uri"] += "&$f=$Filter" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders if ($upnPresent -and ($null -eq $response.value -or $response.value.Count -eq 0)) { Write-Error "Resource '$ObjectId' does not exist or one of its queried reference-property objects are not present. Status: 404 (NotFound) ErrorCode: Request_ResourceNotFound" } $data = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json try { $data = $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json $all = $All.IsPresent $increment = $topCount - $data.Count while (($response.'@odata.nextLink' -and (($all -and ($increment -lt 0)) -or $increment -gt 0))) { $params["Uri"] = $response.'@odata.nextLink' if ($increment -gt 0) { $topValue = [Math]::Min($increment, 999) $params["Uri"] = $params["Uri"].Replace('$top=999', "`$top=$topValue") $increment -= $topValue } $response = Invoke-GraphRequest @params $data += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } } catch {} $data | ForEach-Object { if ($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name UserState -Value ExternalUserState Add-Member -InputObject $_ -MemberType AliasProperty -Name UserStateChangedOn -Value ExternalUserStateChangeDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value mobilePhone Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name ImmutableId -Value onPremisesImmutableId Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value onPremisesProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value BusinessPhones } } if($data){ $userList = @() foreach ($response in $data) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function New-EntraServicePrincipalPasswordCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $CustomKeyIdentifier, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Value, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.DateTime]] $EndDate, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.DateTime]] $StartDate ) $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{ passwordCredential = @{ startDateTime = $PSBoundParameters["StartDate"]; endDateTime = $PSBoundParameters["EndDate"]; } } $response = Add-MgServicePrincipalPassword -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"] -BodyParameter $body $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name EndDate -Value EndDateTime } } $response } function Get-EntraGroupLifecyclePolicy { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["GroupLifecyclePolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgGroupLifecyclePolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDeviceRegisteredOwner { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/devices' $properties = '$select=*' $Method = "GET" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.DeviceId)/registeredOwners?$properties" } if($null -ne $PSBoundParameters["All"]) { $URI = "$baseUri/$($params.DeviceId)/registeredOwners?$properties" } if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] $URI = "$baseUri/$($params.DeviceId)/registeredOwners?`$top=$topCount&$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value $response = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name ImmutableId -Value onPremisesImmutableId Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value mobilePhone Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value onPremisesProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value BusinessPhones Add-Member -InputObject $_ -MemberType AliasProperty -Name UserState -Value ExternalUserState Add-Member -InputObject $_ -MemberType AliasProperty -Name UserStateChangedOn -Value ExternalUserStateChangeDateTime } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Get-EntraNamedLocationPolicy { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["NamedLocationId"] = $PSBoundParameters["PolicyId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgIdentityConditionalAccessNamedLocation @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id $propsToConvert = @('ipRanges') try { foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } catch {} } } $response } } function Remove-EntraDeletedApplication { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDirectoryDeletedItem @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Select-EntraGroupIdsContactIsMemberOf { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Microsoft.Open.AzureAD.Model.GroupIdsForMembershipCheck] $GroupIdsForMembershipCheck ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["OrgContactId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $initalResponse = Get-MgContactMemberOfAsGroup @params -Headers $customHeaders $response = $initalResponse | Where-Object -Filterscript {$_.Id -in ($GroupIdsForMembershipCheck.GroupIds)} if($response){ $response.Id } } } function Remove-EntraServicePrincipalPasswordCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $KeyId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS{ $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand Remove-MgServicePrincipalPassword -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"] -KeyId $PSBoundParameters["KeyId"] } } function Get-EntraObjectByObjectId { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Collections.Generic.List`1[System.String]] $ObjectIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Types, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{} $URI = 'https://graph.microsoft.com/v1.0/directoryObjects/microsoft.graph.getByIds?$select=*' if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" $URI = "https://graph.microsoft.com/v1.0/directoryObjects/microsoft.graph.getByIds?$properties" } if($null -ne $PSBoundParameters["Types"]) { $body["Types"] = $PSBoundParameters["Types"] } if($null -ne $PSBoundParameters["ObjectIds"]) { $body["Ids"] = $PSBoundParameters["ObjectIds"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Uri $URI -Method POST -Body $body -Headers $customHeaders | ConvertTo-Json -depth 10 | ConvertFrom-Json try { $response = $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } catch {} if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function Remove-EntraContact { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["OrgContactId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgContact @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipalAppRoleAssignedTo { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipalAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraDeviceRegisteredOwner { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $OwnerId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["OwnerId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["OwnerId"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgDeviceRegisteredOwnerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraPermissionGrantPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["Id"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgPolicyPermissionGrantPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraServicePrincipal { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $AlternativeNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PublisherName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ReplyUrls, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AppRoleAssignmentRequired, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.KeyCredential]] $KeyCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ServicePrincipalNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $LogoutUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ErrorUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $SamlMetadataUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AccountEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ServicePrincipalType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Tags, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.PasswordCredential]] $PasswordCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Homepage, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AppId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["AlternativeNames"]) { $params["AlternativeNames"] = $PSBoundParameters["AlternativeNames"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["PublisherName"]) { $params["PublisherName"] = $PSBoundParameters["PublisherName"] } if($null -ne $PSBoundParameters["ReplyUrls"]) { $params["ReplyUrls"] = $PSBoundParameters["ReplyUrls"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["AppRoleAssignmentRequired"]) { $params["AppRoleAssignmentRequired"] = $PSBoundParameters["AppRoleAssignmentRequired"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["KeyCredentials"]) { $params["KeyCredentials"] = $PSBoundParameters["KeyCredentials"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ServicePrincipalNames"]) { $params["ServicePrincipalNames"] = $PSBoundParameters["ServicePrincipalNames"] } if($null -ne $PSBoundParameters["LogoutUrl"]) { $params["LogoutUrl"] = $PSBoundParameters["LogoutUrl"] } if($null -ne $PSBoundParameters["ErrorUrl"]) { $params["ErrorUrl"] = $PSBoundParameters["ErrorUrl"] } if($null -ne $PSBoundParameters["SamlMetadataUrl"]) { $params["SamlMetadataUrl"] = $PSBoundParameters["SamlMetadataUrl"] } if($null -ne $PSBoundParameters["AccountEnabled"]) { $params["AccountEnabled"] = $PSBoundParameters["AccountEnabled"] } if($null -ne $PSBoundParameters["ServicePrincipalType"]) { $params["ServicePrincipalType"] = $PSBoundParameters["ServicePrincipalType"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["Tags"]) { $params["Tags"] = $PSBoundParameters["Tags"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["PasswordCredentials"]) { $params["PasswordCredentials"] = $PSBoundParameters["PasswordCredentials"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["Homepage"]) { $params["Homepage"] = $PSBoundParameters["Homepage"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["AppId"]) { $params["AppId"] = $PSBoundParameters["AppId"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgServicePrincipal @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraPermissionGrantConditionSet { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ConditionSetType, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PolicyId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ConditionSetType"]) { $conditionalSet = $PSBoundParameters["ConditionSetType"] } if($null -ne $PSBoundParameters["PolicyId"]) { $params["PermissionGrantPolicyId"] = $PSBoundParameters["PolicyId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Id"]) { $params["PermissionGrantConditionSetId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if("$conditionalSet" -eq "includes"){ $response = Remove-MgPolicyPermissionGrantPolicyInclude @params -Headers $customHeaders } elseif("$conditionalSet" -eq "excludes"){ $response = Remove-MgPolicyPermissionGrantPolicyExclude @params -Headers $customHeaders } else{ Write-Error("Message: Resource not found for the segment '$conditionalSet'.") return } $response } } function Get-EntraServicePrincipalPasswordCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $response = (Get-MgServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"]).PasswordCredentials $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name EndDate -Value EndDateTime } } $response } function Get-EntraDirectoryRoleMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/v1.0/directoryRoles' $properties = '$select=*' $Method = "GET" if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ObjectId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.ObjectId)/members?$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).value $response = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name LastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name Mobile -Value mobilePhone Add-Member -InputObject $_ -MemberType AliasProperty -Name ProvisioningErrors -Value ServiceProvisioningErrors Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value businessPhones } } if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } } function New-EntraGroupLifecyclePolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $AlternateNotificationEmails, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $ManagedGroupTypes, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Int32]] $GroupLifetimeInDays ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["AlternateNotificationEmails"]) { $params["AlternateNotificationEmails"] = $PSBoundParameters["AlternateNotificationEmails"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ManagedGroupTypes"]) { $params["ManagedGroupTypes"] = $PSBoundParameters["ManagedGroupTypes"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["GroupLifetimeInDays"]) { $params["GroupLifetimeInDays"] = $PSBoundParameters["GroupLifetimeInDays"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgGroupLifecyclePolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraConditionalAccessPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ConditionalAccessSessionControls] $SessionControls, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $State, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ConditionalAccessConditionSet] $Conditions, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ConditionalAccessGrantControls] $GrantControls ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["Id"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["SessionControls"]) { $TmpValue = $PSBoundParameters["SessionControls"] $Value = @{} $TmpValue.PSObject.Properties | foreach { $propName = $_.Name $propValue = $_.Value if ($propValue -is [System.Object]) { $nestedProps = @{} $propValue.PSObject.Properties | foreach { $nestedPropName = $_.Name $nestedPropValue = $_.Value $nestedProps[$nestedPropName] = $nestedPropValue } $Value[$propName] = $nestedProps } } $params["SessionControls"] = $Value } if($null -ne $PSBoundParameters["State"]) { $params["State"] = $PSBoundParameters["State"] } if($null -ne $PSBoundParameters["Conditions"]) { $TmpValue = $PSBoundParameters["Conditions"] $Value = @{} $TmpValue.PSObject.Properties | foreach { $propName = $_.Name $propValue = $_.Value if ($propName -eq 'clientAppTypes') { $Value[$propName] = $propValue } elseif ($propValue -is [System.Object]) { $nestedProps = @{} $propValue.PSObject.Properties | foreach { $nestedPropName = $_.Name $nestedPropValue = $_.Value $nestedProps[$nestedPropName] = $nestedPropValue } $Value[$propName] = $nestedProps } } $params["Conditions"] = $Value } if($null -ne $PSBoundParameters["GrantControls"]) { $TmpValue = $PSBoundParameters["GrantControls"] $hash = @{} if($TmpValue._Operator) { $hash["Operator"] = $TmpValue._Operator } if($null -ne $TmpValue.BuiltInControls) { $hash["BuiltInControls"] = $TmpValue.BuiltInControls } if($TmpValue.CustomAuthenticationFactors) { $hash["CustomAuthenticationFactors"] = $TmpValue.CustomAuthenticationFactors } if($TmpValue.TermsOfUse) { $hash["TermsOfUse"] = $TmpValue.TermsOfUse } $Value = $hash $params["GrantControls"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgIdentityConditionalAccessPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraUserManager { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgUserManagerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraServicePrincipal { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PublisherName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ReplyUrls, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AppRoleAssignmentRequired, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.KeyCredential]] $KeyCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ServicePrincipalNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $LogoutUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ErrorUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $SamlMetadataUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AccountEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ServicePrincipalType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Tags, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $AlternativeNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.PasswordCredential]] $PasswordCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Homepage, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $AppId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["PublisherName"]) { $params["PublisherName"] = $PSBoundParameters["PublisherName"] } if($null -ne $PSBoundParameters["ReplyUrls"]) { $params["ReplyUrls"] = $PSBoundParameters["ReplyUrls"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["AppRoleAssignmentRequired"]) { $params["AppRoleAssignmentRequired"] = $PSBoundParameters["AppRoleAssignmentRequired"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["KeyCredentials"]) { $TmpValue = $PSBoundParameters["KeyCredentials"] $a = @() $input = $TmpValue foreach($v in $input) { $hash = @{ CustomKeyIdentifier= $v.CustomKeyIdentifier EndDateTime = $v.EndDate Key= $v.Value StartDateTime= $v.StartDate Type= $v.Type Usage= $v.Usage } $a += $hash } $Value = $a $params["KeyCredentials"] = $Value } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ServicePrincipalNames"]) { $params["ServicePrincipalNames"] = $PSBoundParameters["ServicePrincipalNames"] } if($null -ne $PSBoundParameters["LogoutUrl"]) { $params["LogoutUrl"] = $PSBoundParameters["LogoutUrl"] } if($null -ne $PSBoundParameters["ErrorUrl"]) { $params["ErrorUrl"] = $PSBoundParameters["ErrorUrl"] } if($null -ne $PSBoundParameters["SamlMetadataUrl"]) { $params["SamlMetadataUrl"] = $PSBoundParameters["SamlMetadataUrl"] } if($null -ne $PSBoundParameters["AccountEnabled"]) { $TmpValue = $PSBoundParameters["AccountEnabled"] $Value = $null if (-not [bool]::TryParse($TmpValue, [ref]$Value)) { throw 'Invalid input for AccountEnabled' return } $params["AccountEnabled"] = $Value } if($null -ne $PSBoundParameters["ServicePrincipalType"]) { $params["ServicePrincipalType"] = $PSBoundParameters["ServicePrincipalType"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["Tags"]) { $params["Tags"] = $PSBoundParameters["Tags"] } if($null -ne $PSBoundParameters["AlternativeNames"]) { $params["AlternativeNames"] = $PSBoundParameters["AlternativeNames"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["PasswordCredentials"]) { $TmpValue = $PSBoundParameters["PasswordCredentials"] $a = @() $input = $TmpValue foreach($v in $input) { $hash = @{ CustomKeyIdentifier= $v.CustomKeyIdentifier EndDateTime = $v.EndDate SecretText= $v.Value StartDateTime= $v.StartDate } $a += $hash } $Value = $a $params["PasswordCredentials"] = $Value } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["Homepage"]) { $params["Homepage"] = $PSBoundParameters["Homepage"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["AppId"]) { $params["AppId"] = $PSBoundParameters["AppId"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgServicePrincipal @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name AppOwnerTenantId -Value AppOwnerOrganizationId Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDirectoryRole { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{ObjectId = "Id"} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DirectoryRoleId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDirectoryRole @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraServicePrincipal { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"; ObjectId = "Id"} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["SearchString"]) { $TmpValue = $PSBoundParameters["SearchString"] $Value = "displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')" $params["Filter"] = $Value } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Filter"]) { $TmpValue = $PSBoundParameters["Filter"] foreach($i in $keysChanged.GetEnumerator()){ $TmpValue = $TmpValue.Replace($i.Key, $i.Value) } $Value = $TmpValue $params["Filter"] = $Value } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgServicePrincipal @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraUserManager { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["RefObjectId"]) { $TmpValue = $PSBoundParameters["RefObjectId"] $Value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/users/$TmpValue"} $params["BodyParameter"] = $Value } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Set-MgUserManagerByRef @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraTenantDetail { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $SecurityComplianceNotificationPhones, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $MarketingNotificationEmails, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $TechnicalNotificationMails, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.AzureAD.Model.PrivacyProfile] $PrivacyProfile, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $SecurityComplianceNotificationMails ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["MarketingNotificationEmails"]) { $params["MarketingNotificationEmails"] = $PSBoundParameters["MarketingNotificationEmails"] } if($null -ne $PSBoundParameters["SecurityComplianceNotificationMails"]) { $params["SecurityComplianceNotificationMails"] = $PSBoundParameters["SecurityComplianceNotificationMails"] } if($null -ne $PSBoundParameters["SecurityComplianceNotificationPhones"]) { $params["SecurityComplianceNotificationPhones"] = $PSBoundParameters["SecurityComplianceNotificationPhones"] } if($null -ne $PSBoundParameters["TechnicalNotificationMails"]) { $params["TechnicalNotificationMails"] = $PSBoundParameters["TechnicalNotificationMails"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================") $params["OrganizationId"] = (Get-MgOrganization).Id Update-MgOrganization @params -Headers $customHeaders } } function New-EntraApplicationExtensionProperty { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DataType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Name, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $TargetObjects ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["DataType"]) { $params["DataType"] = $PSBoundParameters["DataType"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Name"]) { $params["Name"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["TargetObjects"]) { $params["TargetObjects"] = $PSBoundParameters["TargetObjects"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgApplicationExtensionProperty @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraUserAppRoleAssignment { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $ResourceId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $PrincipalId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["AppRoleId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["ResourceId"]) { $params["ResourceId"] = $PSBoundParameters["ResourceId"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["PrincipalId"]) { $params["PrincipalId"] = $PSBoundParameters["PrincipalId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgUserAppRoleAssignment @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraDeletedDirectoryObject { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["Id"]) { $params["DirectoryObjectId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDirectoryDeletedItem @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraApplicationLogo { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $FilePath, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Boolean] $View, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $FileName ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/v1.0/applications' $Method = "GET" if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] $URI = "$baseUri/$($params.ApplicationId)" } if($null -ne $PSBoundParameters["FilePath"]){ $params["FilePath"] = $PSBoundParameters["FilePath"] $imageExtensions = @(".jpg", ".jpeg", ".png", ".gif", ".bmp") if(-not (Test-Path $($params.FilePath) -PathType Leaf) -and $imageExtensions -notcontains [System.IO.Path]::GetExtension($($params.FilePath))){ Write-Error -Message "Get-EntraApplicationLogo : FilePath is invalid" break; } } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $logoUrl = (Invoke-GraphRequest -Headers $customHeaders -Uri $URI -Method $Method).Info.logoUrl if($null -ne $logoUrl){ try { Invoke-WebRequest -Uri $logoUrl -OutFile $($params.FilePath) } catch { } } } } function Set-EntraDevice { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $DevicePhysicalIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.AlternativeSecurityId]] $AlternativeSecurityIds, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DeviceId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ProfileType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsManaged, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.DateTime]] $ApproximateLastLogonTimeStamp, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $SystemLabels, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AccountEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DeviceTrustType, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DeviceMetadata, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsCompliant, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DeviceOSVersion, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Int32]] $DeviceObjectVersion, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DeviceOSType ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["DevicePhysicalIds"]) { $params["PhysicalIds"] = $PSBoundParameters["DevicePhysicalIds"] } if($null -ne $PSBoundParameters["AlternativeSecurityIds"]) { $TmpValue = $PSBoundParameters["AlternativeSecurityIds"] $key = [System.Text.Encoding]::UTF8.GetString($TmpValue.key) $Temp = @{ alternativeSecurityIds = @( @{ type = $TmpValue.type key = [System.Text.Encoding]::ASCII.GetBytes($key) } ) } $Value = $Temp $params["BodyParameter"] = $Value } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["DeviceId"]) { $params["DeviceId1"] = $PSBoundParameters["DeviceId"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ProfileType"]) { $params["ProfileType"] = $PSBoundParameters["ProfileType"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["IsManaged"]) { $params["IsManaged"] = $PSBoundParameters["IsManaged"] } if($null -ne $PSBoundParameters["ApproximateLastLogonTimeStamp"]) { $params["ApproximateLastSignInDateTime"] = $PSBoundParameters["ApproximateLastLogonTimeStamp"] } if($null -ne $PSBoundParameters["SystemLabels"]) { $params["SystemLabels"] = $PSBoundParameters["SystemLabels"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["AccountEnabled"]) { $params["AccountEnabled"] = $PSBoundParameters["AccountEnabled"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["DeviceTrustType"]) { $params["TrustType"] = $PSBoundParameters["DeviceTrustType"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DeviceId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["DeviceMetadata"]) { $params["DeviceMetadata"] = $PSBoundParameters["DeviceMetadata"] } if($null -ne $PSBoundParameters["IsCompliant"]) { $params["IsCompliant"] = $PSBoundParameters["IsCompliant"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["DeviceOSVersion"]) { $params["OperatingSystemVersion"] = $PSBoundParameters["DeviceOSVersion"] } if($null -ne $PSBoundParameters["DeviceObjectVersion"]) { $params["DeviceVersion"] = $PSBoundParameters["DeviceObjectVersion"] } if($null -ne $PSBoundParameters["DeviceOSType"]) { $params["OperatingSystem"] = $PSBoundParameters["DeviceOSType"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgDevice @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Set-EntraPermissionGrantPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["Id"]) { $params["PermissionGrantPolicyId"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Update-MgPolicyPermissionGrantPolicy @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraApplication { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AddIn]] $AddIns, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $SignInAudience, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.RequiredResourceAccess]] $RequiredResourceAccess, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ApiApplication] $Api, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.ParentalControlSettings] $ParentalControlSettings, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.OptionalClaims] $OptionalClaims, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $TokenEncryptionKeyId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.KeyCredential]] $KeyCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $IdentifierUris, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $GroupMembershipClaims, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.WebApplication] $Web, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsDeviceOnlyAuthSupported, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsFallbackPublicClient, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.PublicClientApplication] $PublicClient, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Tags, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.InformationalUrl] $InformationalUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.PasswordCredential]] $PasswordCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AppRole]] $AppRoles ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["AddIns"]) { $TmpValue = $PSBoundParameters["AddIns"] $Temp = $TmpValue | ConvertTo-Json $Value = $Temp $params["AddIns"] = $Value } if($null -ne $PSBoundParameters["SignInAudience"]) { $params["SignInAudience"] = $PSBoundParameters["SignInAudience"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["RequiredResourceAccess"]) { $TmpValue = $PSBoundParameters["RequiredResourceAccess"] $Value = $TmpValue | ConvertTo-Json $params["RequiredResourceAccess"] = $Value } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["Api"]) { $TmpValue = $PSBoundParameters["Api"] $Temp = $TmpValue | ConvertTo-Json $Value = $Temp $params["Api"] = $Value } if($null -ne $PSBoundParameters["ParentalControlSettings"]) { $TmpValue = $PSBoundParameters["ParentalControlSettings"] $Temp = $TmpValue | ConvertTo-Json $Value = $Temp $params["ParentalControlSettings"] = $Value } if($null -ne $PSBoundParameters["OptionalClaims"]) { $TmpValue = $PSBoundParameters["OptionalClaims"] $Temp = $TmpValue | ConvertTo-Json $Value = $Temp $params["OptionalClaims"] = $Value } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["TokenEncryptionKeyId"]) { $params["TokenEncryptionKeyId"] = $PSBoundParameters["TokenEncryptionKeyId"] } if($null -ne $PSBoundParameters["KeyCredentials"]) { $TmpValue = $PSBoundParameters["KeyCredentials"] $a = @() $input = $TmpValue foreach($v in $input) { $hash = @{ CustomKeyIdentifier= $v.CustomKeyIdentifier EndDateTime = $v.EndDateTime Key= $v.Key StartDateTime= $v.StartDateTime Type= $v.Type Usage= $v.Usage } $a += $hash } $Value = $a $params["KeyCredentials"] = $Value } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["IdentifierUris"]) { $params["IdentifierUris"] = $PSBoundParameters["IdentifierUris"] } if($null -ne $PSBoundParameters["GroupMembershipClaims"]) { $params["GroupMembershipClaims"] = $PSBoundParameters["GroupMembershipClaims"] } if($null -ne $PSBoundParameters["Web"]) { $TmpValue = $PSBoundParameters["Web"] $Temp = $TmpValue | ConvertTo-Json $Value = $Temp $params["Web"] = $Value } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["IsDeviceOnlyAuthSupported"]) { $params["IsDeviceOnlyAuthSupported"] = $PSBoundParameters["IsDeviceOnlyAuthSupported"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["IsFallbackPublicClient"]) { $params["IsFallbackPublicClient"] = $PSBoundParameters["IsFallbackPublicClient"] } if($null -ne $PSBoundParameters["PublicClient"]) { $TmpValue = $PSBoundParameters["PublicClient"] $Temp = $TmpValue | ConvertTo-Json $Value = $Temp $params["PublicClient"] = $Value } if($null -ne $PSBoundParameters["Tags"]) { $params["Tags"] = $PSBoundParameters["Tags"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["InformationalUrl"]) { $TmpValue = $PSBoundParameters["InformationalUrl"] $Temp = $TmpValue | ConvertTo-Json $Value = $Temp $params["Info"] = $Value } if($null -ne $PSBoundParameters["PasswordCredentials"]) { $TmpValue = $PSBoundParameters["PasswordCredentials"] $a = @() $input = $TmpValue foreach($v in $input) { $Temp = $v | ConvertTo-Json $hash = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { if($null -ne $_.Value){ $hash[$_.Name] = $_.Value }} $a += $hash } $Value = $a $params["PasswordCredentials"] = $Value } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["AppRoles"]) { $TmpValue = $PSBoundParameters["AppRoles"] $a = @() $input = $TmpValue foreach($v in $input) { $Temp = $v | ConvertTo-Json $hash = @{} (ConvertFrom-Json $Temp).psobject.properties | Foreach { if($null -ne $_.Value){ $hash[$_.Name] = $_.Value }} $a += $hash } $Value = $a $params["AppRoles"] = $Value } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgApplication @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraSubscribedSku { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["SubscribedSkuId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("========================================================================= ") $response = Get-MgSubscribedSku @params -Headers $customHeaders $response | ForEach-Object { if ($null -ne $_) { $propsToConvert = @('PrepaidUnits') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } $response } } function Remove-EntraApplicationPassword { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $KeyId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["KeyId"]) { $params["KeyId"] = $PSBoundParameters["KeyId"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgApplicationPassword @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraUserMembership { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["UserId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgUserMemberOf @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -NotePropertyMembers $_.AdditionalProperties Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraApplicationKeyCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $CustomKeyIdentifier, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Value, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.DateTime]] $EndDate, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[Microsoft.Open.AzureAD.Graph.PowerShell.Custom.KeyType]] $Type, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[Microsoft.Open.AzureAD.Graph.PowerShell.Custom.KeyUsage]] $Usage, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.DateTime]] $StartDate ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["CustomKeyIdentifier"]) { $params["CustomKeyIdentifier"] = $PSBoundParameters["CustomKeyIdentifier"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["Value"]) { $params["Value"] = $PSBoundParameters["Value"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["EndDate"]) { $params["EndDate"] = $PSBoundParameters["EndDate"] } if($null -ne $PSBoundParameters["Type"]) { $params["Type"] = $PSBoundParameters["Type"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["Usage"]) { $params["Usage"] = $PSBoundParameters["Usage"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["StartDate"]) { $params["StartDate"] = $PSBoundParameters["StartDate"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Add-MgApplicationKey @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Enable-EntraDirectoryRole { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $RoleTemplateId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["RoleTemplateId"]) { $params["RoleTemplateId"] = $PSBoundParameters["RoleTemplateId"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgDirectoryRole @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Remove-EntraServicePrincipal { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Remove-MgServicePrincipal @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Restore-EntraDeletedApplication { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $IdentifierUris, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["IdentifierUris"]) { $params["IdentifierUris"] = $PSBoundParameters["IdentifierUris"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Restore-MgDirectoryDeletedItem @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType NoteProperty -Name Homepage -value $_.AdditionalProperties['web']['homePageUrl'] Add-Member -InputObject $_ -MemberType NoteProperty -Name ReplyUrls -value $_.AdditionalProperties['web']['redirectUris'] Add-Member -InputObject $_ -MemberType NoteProperty -Name ParentalControlSettings -value $_.AdditionalProperties['parentalControlSettings'] Add-Member -InputObject $_ -MemberType NoteProperty -Name PasswordCredentials -value $_.AdditionalProperties['passwordCredentials'] Add-Member -InputObject $_ -MemberType NoteProperty -Name KeyCredentials -value $_.AdditionalProperties['keyCredentials'] Add-Member -InputObject $_ -MemberType NoteProperty -Name AddIns -value $_.AdditionalProperties['addIns'] Add-Member -InputObject $_ -MemberType NoteProperty -Name AppId -value $_.AdditionalProperties['appId'] Add-Member -InputObject $_ -MemberType NoteProperty -Name AppRoles -value $_.AdditionalProperties['appRoles'] Add-Member -InputObject $_ -MemberType NoteProperty -Name DisplayName -value $_.AdditionalProperties['displayName'] Add-Member -InputObject $_ -MemberType NoteProperty -Name IdentifierUris -value $_.AdditionalProperties['identifierUris'] Add-Member -InputObject $_ -MemberType NoteProperty -Name KnownClientApplications -value $_.AdditionalProperties['api']['knownClientApplications'] Add-Member -InputObject $_ -MemberType NoteProperty -Name Oauth2Permissions -value $_.AdditionalProperties['api']['oauth2PermissionScopes'] Add-Member -InputObject $_ -MemberType NoteProperty -Name PreAuthorizedApplications -value $_.AdditionalProperties['api']['preAuthorizedApplications'] Add-Member -InputObject $_ -MemberType NoteProperty -Name PublicClient -value $_.AdditionalProperties['publicClient'] Add-Member -InputObject $_ -MemberType NoteProperty -Name PublisherDomain -value $_.AdditionalProperties['publisherDomain'] Add-Member -InputObject $_ -MemberType NoteProperty -Name RequiredResourceAccess -value $_.AdditionalProperties['requiredResourceAccess'] Add-Member -InputObject $_ -MemberType NoteProperty -Name SignInAudience -value $_.AdditionalProperties['signInAudience'] Add-Member -InputObject $_ -MemberType NoteProperty -Name ObjectType -value $_.AdditionalProperties['@odata.type'] Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimestamp -Value DeletedDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function New-EntraInvitation { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.User] $InvitedUser, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $InvitedUserType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $InvitedUserDisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $SendInvitationMessage, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo] $InvitedUserMessageInfo, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $InvitedUserEmailAddress, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $InviteRedirectUrl ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["InvitedUser"]) { $TmpValue = $PSBoundParameters["InvitedUser"] $Temp = @{} foreach ($property in $TmpValue.PSObject.Properties) { $Temp[$property.Name] = $property.Value } $params["InvitedUser"] = $Temp } if($null -ne $PSBoundParameters["InvitedUserMessageInfo"]) { $TmpValue = $PSBoundParameters["InvitedUserMessageInfo"] $Temp = @{} $Temp["CustomizedMessageBody"] = $TmpValue.CustomizedMessageBody $Temp["MessageLanguage"] = $TmpValue.MessageLanguage $Temp["CcRecipients"] = $TmpValue.CcRecipients $Value = $Temp $params["InvitedUserMessageInfo"] = $Value } if($null -ne $PSBoundParameters["InvitedUserType"]) { $params["InvitedUserType"] = $PSBoundParameters["InvitedUserType"] } if($null -ne $PSBoundParameters["SendInvitationMessage"]) { $params["SendInvitationMessage"] = $PSBoundParameters["SendInvitationMessage"] } if($null -ne $PSBoundParameters["InvitedUserEmailAddress"]) { $params["InvitedUserEmailAddress"] = $PSBoundParameters["InvitedUserEmailAddress"] } if($null -ne $PSBoundParameters["InvitedUserDisplayName"]) { $params["InvitedUserDisplayName"] = $PSBoundParameters["InvitedUserDisplayName"] } if($null -ne $PSBoundParameters["InviteRedirectUrl"]) { $params["InviteRedirectUrl"] = $PSBoundParameters["InviteRedirectUrl"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = New-MgInvitation @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } } function Get-EntraTenantDetail { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Property"]) { $params["Property"] = $PSBoundParameters["Property"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgOrganization @params -Headers $customHeaders $response | ForEach-Object { if ($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name CompanyLastDirSyncTime -Value OnPremisesLastSyncDateTime Add-Member -InputObject $_ -MemberType AliasProperty -Name DirSyncEnabled -Value OnPremisesSyncEnabled Add-Member -InputObject $_ -MemberType AliasProperty -Name TelephoneNumber -Value BusinessPhones $propsToConvert = @('AssignedPlans','ProvisionedPlans','VerifiedDomains','PrivacyProfile') foreach ($prop in $propsToConvert) { $value = $_.$prop | ConvertTo-Json -Depth 10 | ConvertFrom-Json $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force } } } $response } } function New-EntraApplicationPasswordCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $CustomKeyIdentifier, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Value, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.DateTime]] $EndDate, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.DateTime]] $StartDate ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body=@{} if($null -ne $PSBoundParameters["StartDate"]) { $body["startDateTime"] = $PSBoundParameters["StartDate"] } if($null -ne $PSBoundParameters["EndDate"]) { $body["endDateTime"] = $PSBoundParameters["EndDate"] } if($null -ne $PSBoundParameters["CustomKeyIdentifier"]) { $body["displayName"] = $PSBoundParameters["CustomKeyIdentifier"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["ApplicationId"] = $PSBoundParameters["ObjectId"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } $params["PasswordCredential"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("========================================================================= ") $response = Add-MgApplicationPassword @params -Headers $customHeaders $response | ForEach-Object { If($_.DisplayName){ $Value = [System.Text.Encoding]::ASCII.GetBytes($_.DisplayName) Add-Member -InputObject $_ -MemberType NoteProperty -Name CustomKeyIdentifier -Value $Value -Force } Add-Member -InputObject $_ -MemberType AliasProperty -Name Value -Value SecretText } $response } } function Get-EntraUnsupportedCommand { Throw [System.NotSupportedException] "This commands is currently not supported by the Microsoft Graph Entra PowerShell." } function Enable-EntraAzureADAlias { Set-Alias -Name Get-AzureADMSIdentityProvider -Value Get-EntraIdentityProvider -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipalOAuth2PermissionGrant -Value Get-EntraServicePrincipalOAuth2PermissionGrant -Scope Global -Force Set-Alias -Name Get-AzureADApplicationExtensionProperty -Value Get-EntraApplicationExtensionProperty -Scope Global -Force Set-Alias -Name Get-AzureADApplicationServiceEndpoint -Value Get-EntraApplicationServiceEndpoint -Scope Global -Force Set-Alias -Name Get-AzureADMSGroupPermissionGrant -Value Get-EntraGroupPermissionGrant -Scope Global -Force Set-Alias -Name Set-AzureADMSIdentityProvider -Value Set-EntraIdentityProvider -Scope Global -Force Set-Alias -Name Add-AzureADGroupOwner -Value Add-EntraGroupOwner -Scope Global -Force Set-Alias -Name Revoke-AzureADUserAllRefreshToken -Value Revoke-EntraUserAllRefreshToken -Scope Global -Force Set-Alias -Name Get-AzureADGroup -Value Get-EntraGroup -Scope Global -Force Set-Alias -Name Remove-AzureADApplicationExtensionProperty -Value Remove-EntraApplicationExtensionProperty -Scope Global -Force Set-Alias -Name New-AzureADUser -Value New-EntraUser -Scope Global -Force Set-Alias -Name Remove-AzureADMSGroupLifecyclePolicy -Value Remove-EntraGroupLifecyclePolicy -Scope Global -Force Set-Alias -Name Get-AzureADDomain -Value Get-EntraDomain -Scope Global -Force Set-Alias -Name New-AzureADDomain -Value New-EntraDomain -Scope Global -Force Set-Alias -Name Reset-AzureADMSLifeCycleGroup -Value Reset-EntraLifeCycleGroup -Scope Global -Force Set-Alias -Name Get-AzureADGroupMember -Value Get-EntraGroupMember -Scope Global -Force Set-Alias -Name Remove-AzureADTrustedCertificateAuthority -Value Remove-EntraTrustedCertificateAuthority -Scope Global -Force Set-Alias -Name Get-AzureADServiceAppRoleAssignment -Value Get-EntraServicePrincipalAppRoleAssignment -Scope Global -Force Set-Alias -Name New-AzureADMSGroup -Value New-EntraGroup -Scope Global -Force Set-Alias -Name New-AzureADMSRoleAssignment -Value New-EntraDirectoryRoleAssignment -Scope Global -Force Set-Alias -Name Select-AzureADGroupIdsUserIsMemberOf -Value Select-EntraGroupIdsUserIsMemberOf -Scope Global -Force Set-Alias -Name Get-AzureADTrustedCertificateAuthority -Value Get-EntraTrustedCertificateAuthority -Scope Global -Force Set-Alias -Name Remove-AzureADApplicationKeyCredential -Value Remove-EntraApplicationKeyCredential -Scope Global -Force Set-Alias -Name Get-AzureADUserLicenseDetail -Value Get-EntraUserLicenseDetail -Scope Global -Force Set-Alias -Name Add-AzureADServicePrincipalOwner -Value Add-EntraServicePrincipalOwner -Scope Global -Force Set-Alias -Name Remove-AzureADMSApplicationKey -Value Remove-EntraApplicationKey -Scope Global -Force Set-Alias -Name Get-AzureADMSServicePrincipalDelegatedPermissionClassification -Value Get-EntraServicePrincipalDelegatedPermissionClassification -Scope Global -Force Set-Alias -Name Remove-AzureADServicePrincipalKeyCredential -Value Remove-EntraServicePrincipalKeyCredential -Scope Global -Force Set-Alias -Name Remove-AzureADUser -Value Remove-EntraUser -Scope Global -Force Set-Alias -Name Update-AzureADSignedInUserPassword -Value Update-EntraSignedInUserPassword -Scope Global -Force Set-Alias -Name Add-AzureADDeviceRegisteredOwner -Value Add-EntraDeviceRegisteredOwner -Scope Global -Force Set-Alias -Name Set-AzureADUserThumbnailPhoto -Value Set-EntraUserThumbnailPhoto -Scope Global -Force Set-Alias -Name Get-AzureADApplication -Value Get-EntraApplication -Scope Global -Force Set-Alias -Name Set-AzureADMSApplicationVerifiedPublisher -Value Set-EntraApplicationVerifiedPublisher -Scope Global -Force Set-Alias -Name Get-AzureADDeviceRegisteredUser -Value Get-EntraDeviceRegisteredUser -Scope Global -Force Set-Alias -Name Add-AzureADDirectoryRoleMember -Value Add-EntraDirectoryRoleMember -Scope Global -Force Set-Alias -Name Remove-AzureADMSServicePrincipalDelegatedPermissionClassification -Value Remove-EntraServicePrincipalDelegatedPermissionClassification -Scope Global -Force Set-Alias -Name Get-AzureADMSAuthorizationPolicy -Value Get-EntraAuthorizationPolicy -Scope Global -Force Set-Alias -Name Select-AzureADGroupIdsServicePrincipalIsMemberOf -Value Select-EntraGroupIdsServicePrincipalIsMemberOf -Scope Global -Force Set-Alias -Name Set-AzureADApplicationLogo -Value Set-EntraApplicationLogo -Scope Global -Force Set-Alias -Name Get-AzureADContactDirectReport -Value Get-EntraContactDirectReport -Scope Global -Force Set-Alias -Name Add-AzureADGroupMember -Value Add-EntraGroupMember -Scope Global -Force Set-Alias -Name Remove-AzureADMSConditionalAccessPolicy -Value Remove-EntraConditionalAccessPolicy -Scope Global -Force Set-Alias -Name Add-AzureADMSServicePrincipalDelegatedPermissionClassification -Value Add-EntraServicePrincipalDelegatedPermissionClassification -Scope Global -Force Set-Alias -Name Remove-AzureADServiceAppRoleAssignment -Value Remove-EntraServicePrincipalAppRoleAssignment -Scope Global -Force Set-Alias -Name Get-AzureADDomainNameReference -Value Get-EntraDomainNameReference -Scope Global -Force Set-Alias -Name Set-AzureADMSConditionalAccessPolicy -Value Set-EntraConditionalAccessPolicy -Scope Global -Force Set-Alias -Name Remove-AzureADMSAdministrativeUnitMember -Value Remove-EntraAdministrativeUnitMember -Scope Global -Force Set-Alias -Name Get-AzureADUserOAuth2PermissionGrant -Value Get-EntraUserOAuth2PermissionGrant -Scope Global -Force Set-Alias -Name Get-AzureADOAuth2PermissionGrant -Value Get-EntraOAuth2PermissionGrant -Scope Global -Force Set-Alias -Name New-AzureADMSIdentityProvider -Value New-EntraIdentityProvider -Scope Global -Force Set-Alias -Name Remove-AzureADMSDeletedDirectoryObject -Value Remove-EntraDeletedDirectoryObject -Scope Global -Force Set-Alias -Name Revoke-AzureADSignedInUserAllRefreshToken -Value Revoke-EntraSignedInUserAllRefreshToken -Scope Global -Force Set-Alias -Name Get-AzureADContactMembership -Value Get-EntraContactMembership -Scope Global -Force Set-Alias -Name New-AzureADMSNamedLocationPolicy -Value New-EntraNamedLocationPolicy -Scope Global -Force Set-Alias -Name Confirm-AzureADDomain -Value Confirm-EntraDomain -Scope Global -Force Set-Alias -Name Remove-AzureADServicePrincipalOwner -Value Remove-EntraServicePrincipalOwner -Scope Global -Force Set-Alias -Name Remove-AzureADUserAppRoleAssignment -Value Remove-EntraUserAppRoleAssignment -Scope Global -Force Set-Alias -Name Remove-AzureADMSRoleAssignment -Value Remove-EntraDirectoryRoleAssignment -Scope Global -Force Set-Alias -Name Remove-AzureADMSIdentityProvider -Value Remove-EntraIdentityProvider -Scope Global -Force Set-Alias -Name Get-AzureADDeletedApplication -Value Get-EntraDeletedApplication -Scope Global -Force Set-Alias -Name Get-AzureADExtensionProperty -Value Get-EntraExtensionProperty -Scope Global -Force Set-Alias -Name Select-AzureADGroupIdsGroupIsMemberOf -Value Select-EntraGroupIdsGroupIsMemberOf -Scope Global -Force Set-Alias -Name Remove-AzureADDeviceRegisteredUser -Value Remove-EntraDeviceRegisteredUser -Scope Global -Force Set-Alias -Name Set-AzureADMSGroup -Value Set-EntraGroup -Scope Global -Force Set-Alias -Name Add-AzureADMSLifecyclePolicyGroup -Value Add-EntraLifecyclePolicyGroup -Scope Global -Force Set-Alias -Name Get-AzureADUserAppRoleAssignment -Value Get-EntraUserAppRoleAssignment -Scope Global -Force Set-Alias -Name Remove-AzureADMSAdministrativeUnit -Value Remove-EntraAdministrativeUnit -Scope Global -Force Set-Alias -Name Get-AzureADMSDeletedGroup -Value Get-EntraDeletedGroup -Scope Global -Force Set-Alias -Name Set-AzureADMSAuthorizationPolicy -Value Set-EntraAuthorizationPolicy -Scope Global -Force Set-Alias -Name Remove-AzureADGroupOwner -Value Remove-EntraGroupOwner -Scope Global -Force Set-Alias -Name Remove-AzureADMSRoleDefinition -Value Remove-EntraDirectoryRoleDefinition -Scope Global -Force Set-Alias -Name Remove-AzureADApplicationPasswordCredential -Value Remove-EntraApplicationPasswordCredential -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipalOwnedObject -Value Get-EntraServicePrincipalOwnedObject -Scope Global -Force Set-Alias -Name Get-AzureADMSRoleAssignment -Value Get-EntraDirectoryRoleAssignment -Scope Global -Force Set-Alias -Name Get-AzureADUserOwnedObject -Value Get-EntraUserOwnedObject -Scope Global -Force Set-Alias -Name Remove-AzureADMSLifecyclePolicyGroup -Value Remove-EntraLifecyclePolicyGroup -Scope Global -Force Set-Alias -Name Remove-AzureADDomain -Value Remove-EntraDomain -Scope Global -Force Set-Alias -Name Get-AzureADContact -Value Get-EntraContact -Scope Global -Force Set-Alias -Name Set-AzureADMSGroupLifecyclePolicy -Value Set-EntraGroupLifecyclePolicy -Scope Global -Force Set-Alias -Name Get-AzureADGroupAppRoleAssignment -Value Get-EntraGroupAppRoleAssignment -Scope Global -Force Set-Alias -Name Get-AzureADMSRoleDefinition -Value Get-EntraDirectoryRoleDefinition -Scope Global -Force Set-Alias -Name Get-AzureADMSPermissionGrantConditionSet -Value Get-EntraPermissionGrantConditionSet -Scope Global -Force Set-Alias -Name Remove-AzureADGroupMember -Value Remove-EntraGroupMember -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipalCreatedObject -Value Get-EntraServicePrincipalCreatedObject -Scope Global -Force Set-Alias -Name Get-AzureADApplicationKeyCredential -Value Get-EntraApplicationKeyCredential -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipalOwner -Value Get-EntraServicePrincipalOwner -Scope Global -Force Set-Alias -Name Get-AzureADUserThumbnailPhoto -Value Get-EntraUserThumbnailPhoto -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipalKeyCredential -Value Get-EntraServicePrincipalKeyCredential -Scope Global -Force Set-Alias -Name Remove-AzureADDevice -Value Remove-EntraDevice -Scope Global -Force Set-Alias -Name Get-AzureADUserExtension -Value Get-EntraUserExtension -Scope Global -Force Set-Alias -Name Get-AzureADUserCreatedObject -Value Get-EntraUserCreatedObject -Scope Global -Force Set-Alias -Name Set-AzureADMSNamedLocationPolicy -Value Set-EntraNamedLocationPolicy -Scope Global -Force Set-Alias -Name Set-AzureADMSRoleDefinition -Value Set-EntraDirectoryRoleDefinition -Scope Global -Force Set-Alias -Name Get-AzureADContactManager -Value Get-EntraContactManager -Scope Global -Force Set-Alias -Name Set-AzureADMSPermissionGrantConditionSet -Value Set-EntraPermissionGrantConditionSet -Scope Global -Force Set-Alias -Name Get-AzureADApplicationOwner -Value Get-EntraApplicationOwner -Scope Global -Force Set-Alias -Name Remove-AzureADMSScopedRoleMembership -Value Remove-EntraScopedRoleMembership -Scope Global -Force Set-Alias -Name Set-AzureADUserExtension -Value Set-EntraUserExtension -Scope Global -Force Set-Alias -Name Get-AzureADMSLifecyclePolicyGroup -Value Get-EntraLifecyclePolicyGroup -Scope Global -Force Set-Alias -Name Get-AzureADUserManager -Value Get-EntraUserManager -Scope Global -Force Set-Alias -Name New-AzureADServiceAppRoleAssignment -Value New-EntraServicePrincipalAppRoleAssignment -Scope Global -Force Set-Alias -Name Add-AzureADApplicationOwner -Value Add-EntraApplicationOwner -Scope Global -Force Set-Alias -Name Remove-AzureADApplication -Value Remove-EntraApplication -Scope Global -Force Set-Alias -Name New-AzureADGroupAppRoleAssignment -Value New-EntraGroupAppRoleAssignment -Scope Global -Force Set-Alias -Name Add-AzureADDeviceRegisteredUser -Value Add-EntraDeviceRegisteredUser -Scope Global -Force Set-Alias -Name Set-AzureADTrustedCertificateAuthority -Value Set-EntraTrustedCertificateAuthority -Scope Global -Force Set-Alias -Name Remove-AzureADOAuth2PermissionGrant -Value Remove-EntraOAuth2PermissionGrant -Scope Global -Force Set-Alias -Name Get-AzureADUserOwnedDevice -Value Get-EntraUserOwnedDevice -Scope Global -Force Set-Alias -Name Remove-AzureADGroup -Value Remove-EntraGroup -Scope Global -Force Set-Alias -Name Set-AzureADUserLicense -Value Set-EntraUserLicense -Scope Global -Force Set-Alias -Name Remove-AzureADMSApplicationVerifiedPublisher -Value Remove-EntraApplicationVerifiedPublisher -Scope Global -Force Set-Alias -Name New-AzureADMSPermissionGrantConditionSet -Value New-EntraPermissionGrantConditionSet -Scope Global -Force Set-Alias -Name Remove-AzureADUserExtension -Value Remove-EntraUserExtension -Scope Global -Force Set-Alias -Name New-AzureADMSApplicationKey -Value New-EntraApplicationKey -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipalMembership -Value Get-EntraServicePrincipalMembership -Scope Global -Force Set-Alias -Name New-AzureADMSApplicationPassword -Value New-EntraApplicationPassword -Scope Global -Force Set-Alias -Name Get-AzureADDomainVerificationDnsRecord -Value Get-EntraDomainVerificationDnsRecord -Scope Global -Force Set-Alias -Name Remove-AzureADGroupAppRoleAssignment -Value Remove-EntraGroupAppRoleAssignment -Scope Global -Force Set-Alias -Name Get-AzureADApplicationPasswordCredential -Value Get-EntraApplicationPasswordCredential -Scope Global -Force Set-Alias -Name New-AzureADDevice -Value New-EntraDevice -Scope Global -Force Set-Alias -Name Get-AzureADDirectoryRoleTemplate -Value Get-EntraDirectoryRoleTemplate -Scope Global -Force Set-Alias -Name Set-AzureADUserPassword -Value Set-EntraUserPassword -Scope Global -Force Set-Alias -Name Get-AzureADGroupOwner -Value Get-EntraGroupOwner -Scope Global -Force Set-Alias -Name Get-AzureADMSPermissionGrantPolicy -Value Get-EntraPermissionGrantPolicy -Scope Global -Force Set-Alias -Name Get-AzureADDomainServiceConfigurationRecord -Value Get-EntraDomainServiceConfigurationRecord -Scope Global -Force Set-Alias -Name Restore-AzureADMSDeletedDirectoryObject -Value Restore-EntraDeletedDirectoryObject -Scope Global -Force Set-Alias -Name Remove-AzureADMSPermissionGrantPolicy -Value Remove-EntraPermissionGrantPolicy -Scope Global -Force Set-Alias -Name Get-AzureADMSConditionalAccessPolicy -Value Get-EntraConditionalAccessPolicy -Scope Global -Force Set-Alias -Name Get-AzureADUserRegisteredDevice -Value Get-EntraUserRegisteredDevice -Scope Global -Force Set-Alias -Name Get-AzureADContract -Value Get-EntraContract -Scope Global -Force Set-Alias -Name New-AzureADMSRoleDefinition -Value New-EntraDirectoryRoleDefinition -Scope Global -Force Set-Alias -Name New-AzureADTrustedCertificateAuthority -Value New-EntraTrustedCertificateAuthority -Scope Global -Force Set-Alias -Name Set-AzureADUser -Value Set-EntraUser -Scope Global -Force Set-Alias -Name Get-AzureADUserDirectReport -Value Get-EntraUserDirectReport -Scope Global -Force Set-Alias -Name Remove-AzureADDirectoryRoleMember -Value Remove-EntraDirectoryRoleMember -Scope Global -Force Set-Alias -Name Remove-AzureADApplicationOwner -Value Remove-EntraApplicationOwner -Scope Global -Force Set-Alias -Name Set-AzureADDomain -Value Set-EntraDomain -Scope Global -Force Set-Alias -Name Remove-AzureADMSNamedLocationPolicy -Value Remove-EntraNamedLocationPolicy -Scope Global -Force Set-Alias -Name Set-AzureADMSApplication -Value Set-EntraApplication -Scope Global -Force Set-Alias -Name Get-AzureADDevice -Value Get-EntraDevice -Scope Global -Force Set-Alias -Name Get-AzureADUser -Value Get-EntraUser -Scope Global -Force Set-Alias -Name New-AzureADServicePrincipalPasswordCredential -Value New-EntraServicePrincipalPasswordCredential -Scope Global -Force Set-Alias -Name Get-AzureADMSGroupLifecyclePolicy -Value Get-EntraGroupLifecyclePolicy -Scope Global -Force Set-Alias -Name Get-AzureADDeviceRegisteredOwner -Value Get-EntraDeviceRegisteredOwner -Scope Global -Force Set-Alias -Name Get-AzureADMSNamedLocationPolicy -Value Get-EntraNamedLocationPolicy -Scope Global -Force Set-Alias -Name Remove-AzureADDeletedApplication -Value Remove-EntraDeletedApplication -Scope Global -Force Set-Alias -Name Select-AzureADGroupIdsContactIsMemberOf -Value Select-EntraGroupIdsContactIsMemberOf -Scope Global -Force Set-Alias -Name Remove-AzureADServicePrincipalPasswordCredential -Value Remove-EntraServicePrincipalPasswordCredential -Scope Global -Force Set-Alias -Name Get-AzureADObjectByObjectId -Value Get-EntraObjectByObjectId -Scope Global -Force Set-Alias -Name Remove-AzureADContact -Value Remove-EntraContact -Scope Global -Force Set-Alias -Name Get-AzureADServiceAppRoleAssignedTo -Value Get-EntraServicePrincipalAppRoleAssignedTo -Scope Global -Force Set-Alias -Name Remove-AzureADDeviceRegisteredOwner -Value Remove-EntraDeviceRegisteredOwner -Scope Global -Force Set-Alias -Name New-AzureADMSPermissionGrantPolicy -Value New-EntraPermissionGrantPolicy -Scope Global -Force Set-Alias -Name Set-AzureADServicePrincipal -Value Set-EntraServicePrincipal -Scope Global -Force Set-Alias -Name Remove-AzureADMSPermissionGrantConditionSet -Value Remove-EntraPermissionGrantConditionSet -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipalPasswordCredential -Value Get-EntraServicePrincipalPasswordCredential -Scope Global -Force Set-Alias -Name Get-AzureADDirectoryRoleMember -Value Get-EntraDirectoryRoleMember -Scope Global -Force Set-Alias -Name New-AzureADMSGroupLifecyclePolicy -Value New-EntraGroupLifecyclePolicy -Scope Global -Force Set-Alias -Name New-AzureADMSConditionalAccessPolicy -Value New-EntraConditionalAccessPolicy -Scope Global -Force Set-Alias -Name Remove-AzureADUserManager -Value Remove-EntraUserManager -Scope Global -Force Set-Alias -Name New-AzureADServicePrincipal -Value New-EntraServicePrincipal -Scope Global -Force Set-Alias -Name Get-AzureADDirectoryRole -Value Get-EntraDirectoryRole -Scope Global -Force Set-Alias -Name Get-AzureADServicePrincipal -Value Get-EntraServicePrincipal -Scope Global -Force Set-Alias -Name Set-AzureADUserManager -Value Set-EntraUserManager -Scope Global -Force Set-Alias -Name Set-AzureADTenantDetail -Value Set-EntraTenantDetail -Scope Global -Force Set-Alias -Name New-AzureADApplicationExtensionProperty -Value New-EntraApplicationExtensionProperty -Scope Global -Force Set-Alias -Name New-AzureADUserAppRoleAssignment -Value New-EntraUserAppRoleAssignment -Scope Global -Force Set-Alias -Name Get-AzureADMSDeletedDirectoryObject -Value Get-EntraDeletedDirectoryObject -Scope Global -Force Set-Alias -Name Get-AzureADApplicationLogo -Value Get-EntraApplicationLogo -Scope Global -Force Set-Alias -Name Set-AzureADDevice -Value Set-EntraDevice -Scope Global -Force Set-Alias -Name Set-AzureADMSPermissionGrantPolicy -Value Set-EntraPermissionGrantPolicy -Scope Global -Force Set-Alias -Name New-AzureADMSApplication -Value New-EntraApplication -Scope Global -Force Set-Alias -Name Get-AzureADSubscribedSku -Value Get-EntraSubscribedSku -Scope Global -Force Set-Alias -Name Remove-AzureADMSApplicationPassword -Value Remove-EntraApplicationPassword -Scope Global -Force Set-Alias -Name Get-AzureADUserMembership -Value Get-EntraUserMembership -Scope Global -Force Set-Alias -Name New-AzureADApplicationKeyCredential -Value New-EntraApplicationKeyCredential -Scope Global -Force Set-Alias -Name Enable-AzureADDirectoryRole -Value Enable-EntraDirectoryRole -Scope Global -Force Set-Alias -Name Remove-AzureADServicePrincipal -Value Remove-EntraServicePrincipal -Scope Global -Force Set-Alias -Name Restore-AzureADDeletedApplication -Value Restore-EntraDeletedApplication -Scope Global -Force Set-Alias -Name New-AzureADMSInvitation -Value New-EntraInvitation -Scope Global -Force Set-Alias -Name Get-AzureADTenantDetail -Value Get-EntraTenantDetail -Scope Global -Force Set-Alias -Name New-AzureADApplicationPasswordCredential -Value New-EntraApplicationPasswordCredential -Scope Global -Force Set-Alias -Name Get-CrossCloudVerificationCode -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Set-AzureADApplicationProxyApplicationSingleSignOn -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Set-AzureADApplicationProxyConnector -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADApplicationProxyConnectorGroupMember -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Set-AzureADMSAdministrativeUnit -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name New-AzureADServicePrincipalKeyCredential -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Set-AzureADApplicationProxyApplication -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADApplicationProxyApplication -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADDeviceConfiguration -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADApplicationProxyConnectorMemberOf -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Set-AzureADApplicationProxyApplicationCustomDomainCertificate -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Remove-AzureADApplicationProxyConnectorGroup -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Add-AzureADMSScopedRoleMembership -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADContactThumbnailPhoto -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADCurrentSessionInfo -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name New-AzureADMSAdministrativeUnit -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADApplicationProxyConnectorGroup -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Add-AzureADMSAdministrativeUnitMember -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name New-AzureADApplicationProxyApplication -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADMSScopedRoleMembership -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name New-AzureADApplicationProxyConnectorGroup -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADApplicationProxyConnector -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Set-AzureADApplicationProxyConnectorGroup -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Set-AzureADApplicationProxyApplicationConnectorGroup -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Remove-AzureADApplicationProxyApplication -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Remove-AzureADApplicationProxyApplicationConnectorGroup -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADMSAdministrativeUnitMember -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADApplicationProxyApplicationConnectorGroup -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Remove-AzureADContactManager -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Get-AzureADMSAdministrativeUnit -Value Get-EntraUnsupportedCommand -Scope Global -Force Set-Alias -Name Connect-AzureAD -Value Connect-Entra -Scope Global -Force Set-Alias -Name Disconnect-AzureAD -Value Disconnect-Entra -Scope Global -Force } # ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraServicePrincipal { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $AlternativeNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PublisherName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ReplyUrls, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $AppRoleAssignmentRequired, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.KeyCredential]] $KeyCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $ServicePrincipalNames, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $LogoutUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ErrorUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $SamlMetadataUrl, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AccountEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $ServicePrincipalType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Tags, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.PasswordCredential]] $PasswordCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Homepage, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AppId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $PreferredSingleSignOnMode ) PROCESS { $params = @{} $params["Uri"] = "https://graph.microsoft.com/v1.0/servicePrincipals" $params["Method"] = "PATCH" $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{} if($null -ne $PSBoundParameters["AccountEnabled"]) { $body["accountEnabled"] = $PSBoundParameters["AccountEnabled"] } if($null -ne $PSBoundParameters["AlternativeNames"]) { $body["alternativeNames"] = $PSBoundParameters["AlternativeNames"] } if($null -ne $PSBoundParameters["PreferredSingleSignOnMode"]) { $body["preferredSingleSignOnMode"] = $PSBoundParameters["PreferredSingleSignOnMode"] } if($null -ne $PSBoundParameters["Tags"]) { $body["tags"] = $PSBoundParameters["Tags"] } if($null -ne $PSBoundParameters["DisplayName"]) { $body["displayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["AppId"]) { $body["appId"] = $PSBoundParameters["AppId"] } if($null -ne $PSBoundParameters["ErrorUrl"]) { $body["ErrorUrl"] = $PSBoundParameters["ErrorUrl"] } if($null -ne $PSBoundParameters["KeyCredentials"]) { $a = @() $inpu = $PSBoundParameters["KeyCredentials"] foreach($value in $inpu) { $hash = @{ customKeyIdentifier= $value.CustomKeyIdentifier endDateTime = $value.EndDate key= $value.Value startDateTime= $value.StartDate type= $value.Type usage= $value.Usage } $a += $hash } $body["keyCredentials"] = $a } if($null -ne $PSBoundParameters["ReplyUrls"]) { $body["replyUrls"] = $PSBoundParameters["ReplyUrls"] } if($null -ne $PSBoundParameters["ObjectId"]) { $params["Uri"] += "/$ObjectId" } if($null -ne $PSBoundParameters["LogoutUrl"]) { $body["logoutUrl"] = $PSBoundParameters["LogoutUrl"] } if($null -ne $PSBoundParameters["SamlMetadataUrl"]) { $body["samlMetadataUrl"] = $PSBoundParameters["SamlMetadataUrl"] } if($null -ne $PSBoundParameters["Homepage"]) { $body["homePage"] = $PSBoundParameters["Homepage"] } if($null -ne $PSBoundParameters["AppRoleAssignmentRequired"]) { $body["appRoleAssignmentRequired"] = $PSBoundParameters["AppRoleAssignmentRequired"] } if($null -ne $PSBoundParameters["PasswordCredentials"]) { $a = @() $inpu = $PSBoundParameters["PasswordCredentials"] foreach($value in $inpu) { $hash = @{ customKeyIdentifier= $value.CustomKeyIdentifier endDateTime = $value.EndDate secretText= $value.Value startDateTime= $value.StartDate } $a += $hash } $body["passwordCredentials"] = $a } if($null -ne $PSBoundParameters["ServicePrincipalType"]) { $body["servicePrincipalType"] = $PSBoundParameters["ServicePrincipalType"] } if($null -ne $PSBoundParameters["PublisherName"]) { $body["publisherName"] = $PSBoundParameters["PublisherName"] } if($null -ne $PSBoundParameters["ServicePrincipalNames"]) { $body["servicePrincipalNames"] = $PSBoundParameters["ServicePrincipalNames"] } if($null -ne $PSBoundParameters["PreferredTokenSigningKeyThumbprint"]) { $body["preferredTokenSigningKeyThumbprint"] = $PSBoundParameters["PreferredTokenSigningKeyThumbprint"] } if($null -ne $PSBoundParameters["CustomSecurityAttributes"]) { $body["customSecurityAttributes"] = $PSBoundParameters["CustomSecurityAttributes"] } $params["Body"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("========================================================================= ") $response = Invoke-GraphRequest @params -Headers $customHeaders $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Test-EntraScript { <# .SYNOPSIS Checks, whether the provided script is using AzureAD commands that are not supported by Microsoft.Graph.Entra. .DESCRIPTION Checks, whether the provided script is using AzureAD commands that are not supported by Microsoft.Graph.Entra. .PARAMETER Path Path to the script file(s) to scan. Or name of the content, when also specifying -Content .PARAMETER Content Code content to scan. Used when scanning code that has no file representation (e.g. straight from a repository). .PARAMETER Quiet Only return $true or $false, based on whether the script could run under Microsoft.Graph.Entra ($true) or not ($false) .EXAMPLE PS C:\> Test-EntraScript -Path .\usercreation.ps1 -Quiet Returns whether the script "usercreation.ps1" could run under Microsoft.Graph.Entra .EXAMPLE PS C:\> Get-ChildItem -Path \\contoso.com\it\code -Recurse -Filter *.ps1 | Test-EntraScript Returns a list of all scripts that would not run under the Microsoft.Graph.Entra module, listing each issue with line and code. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Alias('FullName', 'Name')] [string[]] $Path, [Parameter(ValueFromPipelineByPropertyName = $true)] [string] $Content, [switch] $Quiet ) begin { function Test-ScriptCommand { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [Alias('FullName')] [string] $Name, [Parameter(Mandatory = $true)] [string] $Content, [switch] $Quiet, [AllowEmptyCollection()] [string[]] $RequiredCommands, [AllowEmptyCollection()] [string[]] $ForbiddenCommands ) $ast = [System.Management.Automation.Language.Parser]::ParseInput($Content, [ref]$null, [ref]$null) $allCommands = $ast.FindAll({ $args[0] -is [System.Management.Automation.Language.CommandAst] }, $true) $allCommandNames = @($allCommands).ForEach{ $_.CommandElements[0].Value } $findings = @() foreach ($command in $allCommands) { if ($command.CommandElements[0].Value -notin $ForbiddenCommands) { continue } $findings += [PSCustomObject]@{ PSTypeName = 'Microsoft.Graph.Entra.CommandRequirement' Name = $Name Line = $command.Extent.StartLineNumber Type = 'UnsupportedCommand' Command = $command.CommandElements[0].Value Code = $command.Extent.Text } } foreach ($requiredCommand in $RequiredCommands) { if ($requiredCommand -notin $allCommandNames) { continue } $findings += [PSCustomObject]@{ PSTypeName = 'Microsoft.Graph.Entra.CommandRequirement' Name = $Name Line = -1 Type = 'RequiredCommandMissing' Command = $requiredCommand Code = '' } } if (-not $Quiet) { $findings return } $findings -as [bool] } $testParam = @{ Quiet = $Quiet ForbiddenCommands = $script:MISSING_CMDS } } process { if ($Path -and $Content) { Test-ScriptCommand -Name @($Path)[0] -Content $Content return } foreach ($entry in $Path) { try { $resolvedPaths = Resolve-Path -Path $entry -ErrorAction Stop } catch { Write-Error $_ continue } foreach ($resolvedPath in $resolvedPaths) { if (-not (Test-Path -Path $resolvedPath -PathType Leaf)) { Write-Warning "Not a file: $resolvedPath" continue } $scriptContent = (Get-Content -LiteralPath $resolvedPath) -join "`n" Test-ScriptCommand -Name $resolvedPath -Content $scriptContent @testParam } } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraAccountSku { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", ValueFromPipelineByPropertyName = $true)][System.Guid] $TenantId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgSubscribedSku @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType NoteProperty -Name ActiveUnits -Value $_.PrepaidUnits.Enabled Add-Member -InputObject $_ -MemberType NoteProperty -Name LockedOutUnits -Value $_.PrepaidUnits.LockedOut Add-Member -InputObject $_ -MemberType NoteProperty -Name SuspendedUnits -Value $_.PrepaidUnits.Suspended Add-Member -InputObject $_ -MemberType NoteProperty -Name WarningUnits -Value $_.PrepaidUnits.Warning Add-Member -InputObject $_ -MemberType NoteProperty -Name AccountObjectId -Value $_.AccountId Add-Member -InputObject $_ -MemberType NoteProperty -Name TargetClass -Value $_.AppliesTo } } $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Update-EntraUserFromFederated { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][System.String] $UserPrincipalName, [Parameter(Mandatory=$false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName=$true)][string] $NewPassword, [Parameter(Mandatory=$false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName=$true)][guid] $TenantId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["UserPrincipalName"]) { $UserPrincipalName = $PSBoundParameters.UserPrincipalName $UserId = Get-MgUser -Search "UserPrincipalName:$UserPrincipalName" -ConsistencyLevel eventual if ($null -ne $UserId) { $AuthenticationMethodId = Get-MgUserAuthenticationMethod -UserId $UserId.Id $params["AuthenticationMethodId"] = $AuthenticationMethodId.Id $params["UserId"] = $UserId.Id } } if ($PSBoundParameters.ContainsKey("NewPassword")) { $params["NewPassword"] = $PSBoundParameters["NewPassword"] } if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if($null -ne $AuthenticationMethodId) { $response = Reset-MgUserAuthenticationMethodPassword @params -Headers $customHeaders } $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraAttributeSet { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Int32]] $MaxAttributesPerSet ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params["Uri"] = "https://graph.microsoft.com/v1.0/directory/attributeSets" $params["Method"] = "POST" if ($null -ne $PSBoundParameters["Id"]) { $body["id"] = $PSBoundParameters["Id"] } if ($null -ne $PSBoundParameters["Description"]) { $body["description"] = $PSBoundParameters["Description"] } if ($null -ne $PSBoundParameters["MaxAttributesPerSet"]) { $body["maxAttributesPerSet"] = $PSBoundParameters["MaxAttributesPerSet"] } $params["Body"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders | ConvertTo-Json | ConvertFrom-Json if ($response) { $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttributeSet $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0, 1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Add-EntraCustomSecurityAttributeDefinitionAllowedValue { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Boolean]] $IsActive, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $CustomSecurityAttributeDefinitionId ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["Id"]) { $body["Id"] = $PSBoundParameters["Id"] } if ($null -ne $PSBoundParameters["IsActive"]) { $body["IsActive"] = $PSBoundParameters["IsActive"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $Uri = "https://graph.microsoft.com/v1.0/directory/customSecurityAttributeDefinitions/$CustomSecurityAttributeDefinitionId/allowedValues" $Method = "POST" $response = Invoke-GraphRequest -Uri $Uri -Method $Method -Body $body -Headers $customHeaders | ConvertTo-Json | ConvertFrom-Json if($response) { $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAllowedValue $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraFeatureRolloutPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsAppliedToOrganization, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Feature, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.MsDirectoryObject]] $AppliesTo ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $body = @{} $params["Uri"] = "https://graph.microsoft.com/v1.0/policies/featureRolloutPolicies/$Id" $params["Method"] = "PATCH" if ($null -ne $PSBoundParameters["Description"]) { $body["Description"] = $PSBoundParameters["Description"] } if ($null -ne $PSBoundParameters["IsAppliedToOrganization"]) { $body["IsAppliedToOrganization"] = $PSBoundParameters["IsAppliedToOrganization"] } if ($null -ne $PSBoundParameters["DisplayName"]) { $body["DisplayName"] = $PSBoundParameters["DisplayName"] } if ($null -ne $PSBoundParameters["Feature"]) { $body["Feature"] = $PSBoundParameters["Feature"] } if ($null -ne $PSBoundParameters["IsEnabled"]) { $body["IsEnabled"] = $PSBoundParameters["IsEnabled"] } if ($null -ne $PSBoundParameters["AppliesTo"]) { $body["AppliesTo"] = $PSBoundParameters["AppliesTo"] } $params["Body"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders | ConvertTo-Json | ConvertFrom-Json $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraApplicationTemplate { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $topCount = $null $uri = "https://graph.microsoft.com/v1.0/applicationTemplates" $params["Method"] = "GET" $params["Uri"] = $uri+'?$select=*' if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $params["Uri"] = $uri+"?`$select=$($selectProperties)" } if(($null -ne $PSBoundParameters["Top"] -and (-not $PSBoundParameters.ContainsKey("All"))) -or ($null -ne $PSBoundParameters["Top"] -and $null -ne $PSBoundParameters["All"])) { $topCount = $PSBoundParameters["Top"] $params["Uri"] += "&`$top=$topCount" } if($null -ne $PSBoundParameters["Filter"]) { $Filter = $PSBoundParameters["Filter"] $f = '$' + 'Filter' $params["Uri"] += "&$f=$Filter" } if((-not $PSBoundParameters.ContainsKey("Top")) -and (-not $PSBoundParameters.ContainsKey("All"))) { $params["Uri"] += "&`$top=100" } if($null -ne $PSBoundParameters["Id"]) { $params["ApplicationTemplateId"] = $PSBoundParameters["Id"] $params["Uri"] = $uri + "/$Id" } $response = Invoke-GraphRequest -Uri $($params.Uri) -Method GET -Headers $customHeaders if($response.ContainsKey('value')){ $response = $response.value } $data = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json $userList = @() foreach ($res in $data) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphApplicationTemplate $res.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0,1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraCustomSecurityAttributeDefinition { [CmdletBinding(DefaultParameterSetName = 'NewCustomSecurityAttributeDefinition')] param ( [Parameter()] [System.String] $Description, [Parameter(Mandatory = $true)] [System.String] $Name, [Parameter(Mandatory = $true)] [System.String] $AttributeSet, [Parameter(Mandatory = $true)] [System.Nullable`1[System.Boolean]] $UsePreDefinedValuesOnly, [Parameter(Mandatory = $true)] [System.String] $Type, [Parameter(Mandatory = $true)] [System.Nullable`1[System.Boolean]] $IsCollection, [Parameter(Mandatory = $true)] [System.Nullable`1[System.Boolean]] $IsSearchable, [Parameter(Mandatory = $true)] [System.String] $Status ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $Uri = "https://graph.microsoft.com/v1.0/directory/customSecurityAttributeDefinitions" $Method = "POST" if($null -ne $PSBoundParameters["AttributeSet"]) { $body["attributeSet"] = $PSBoundParameters["AttributeSet"] } if($null -ne $PSBoundParameters["Description"]) { $body["description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["IsCollection"]) { $body["isCollection"] = $PSBoundParameters["IsCollection"] } if($null -ne $PSBoundParameters["IsSearchable"]) { $body["isSearchable"] = $PSBoundParameters["IsSearchable"] } if($null -ne $PSBoundParameters["Name"]) { $body["name"] = $PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["Status"]) { $body["status"] = $PSBoundParameters["Status"] } if($null -ne $PSBoundParameters["Type"]) { $body["type"] = $PSBoundParameters["Type"] } if($null -ne $PSBoundParameters["UsePreDefinedValuesOnly"]) { $body["usePreDefinedValuesOnly"] = $PSBoundParameters["UsePreDefinedValuesOnly"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $type= [Microsoft.Graph.PowerShell.Models.MicrosoftGraphCustomSecurityAttributeDefinition] $response = Invoke-GraphRequest -Uri $Uri -Method $Method -Body $body -Headers $customHeaders | ConvertTo-Json -Depth 20 | ConvertFrom-Json $targetList = @() foreach ($item in $response) { $targetObject = [Activator]::CreateInstance($type) foreach ($property in $item.PSObject.Properties) { if ($targetObject.PSObject.Properties[$property.Name]) { $targetObject.PSObject.Properties[$property.Name].Value = $property.Value } } $targetList += $targetObject } $targetList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraDirSyncConfiguration { [CmdletBinding(DefaultParameterSetName = 'SetAccidentalDeletionThreshold')] param ( [Parameter(ParameterSetName = "SetAccidentalDeletionThreshold", ValueFromPipelineByPropertyName = $true, Mandatory = $true)][System.UInt32] $AccidentalDeletionThreshold, [Parameter(ParameterSetName = "SetAccidentalDeletionThreshold", ValueFromPipelineByPropertyName = $true)][System.Guid] $TenantId, [switch] $Force ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($null -ne $PSBoundParameters["AccidentalDeletionThreshold"]) { $AccidentalDeletionThreshold = $PSBoundParameters["AccidentalDeletionThreshold"] } if ($null -ne $PSBoundParameters["TenantId"]) { $TenantId = $PSBoundParameters["TenantId"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if ($Force) { $decision = 0 } else { $title = 'Confirm' $question = 'Do you want to continue?' $Suspend = New-Object System.Management.Automation.Host.ChoiceDescription "&Suspend", "S" $Yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Y" $No = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "S" $choices = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No, $Suspend) $decision = $Host.UI.PromptForChoice($title, $question, $choices, 1) } if ($decision -eq 0) { if ([string]::IsNullOrWhiteSpace($TenantId)) { $OnPremisesDirectorySynchronizationId = (Get-MgDirectoryOnPremiseSynchronization).Id } else { $OnPremisesDirectorySynchronizationId = $TenantId } $params = @{ configuration = @{ accidentalDeletionPrevention = @{ synchronizationPreventionType = "enabledForCount" alertThreshold = $AccidentalDeletionThreshold } } } $response = Update-MgDirectoryOnPremiseSynchronization -Headers $customHeaders -OnPremisesDirectorySynchronizationId $OnPremisesDirectorySynchronizationId -BodyParameter $params $response } else { return } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraPolicy { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUrl = "https://graph.microsoft.com/v1.0/policies/" $endpoints = @("homeRealmDiscoveryPolicies", "claimsMappingPolicies", "tokenIssuancePolicies", "tokenLifetimePolicies", "activityBasedTimeoutPolicies", "featureRolloutPolicies", "defaultAppManagementPolicy", "appManagementPolicies", "authenticationFlowsPolicy", "authenticationMethodsPolicy", "permissionGrantPolicies") $response = @() foreach ($endpoint in $endpoints) { $url = "${baseUrl}${endpoint}" try { $policies = (Invoke-GraphRequest -Headers $customHeaders -Uri $url -Method GET).value } catch { $policies = (Invoke-GraphRequest -Headers $customHeaders -Uri $url -Method GET) } $policies | ForEach-Object { $_.Type = ($endpoint.Substring(0, 1).ToUpper() + $endpoint.Substring(1) -replace "ies", "y") $response += $_ if ($Top -and ($response.Count -ge $Top)) { break } } } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================") if ($PSBoundParameters.ContainsKey("ID")) { $response = $response | Where-Object { $_.id -eq $Id } if($Null -eq $response ) { Write-Error "Get-EntraPolicy : Error occurred while executing Get-Policy Code: Request_BadRequest Message: Invalid object identifier '$Id' ." } } elseif (-not $All -and $Top) { $response = $response | Select-Object -First $Top } $data = $response | ConvertTo-Json -Depth 50 | ConvertFrom-Json $respList = @() foreach ($res in $data) { switch ($res.type) { "ActivityBasedTimeoutPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphActivityBasedTimeoutPolicy } "AppManagementPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAppManagementPolicy } "ClaimsMappingPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphClaimsMappingPolicy } "FeatureRolloutPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphFeatureRolloutPolicy } "HomeRealmDiscoveryPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphHomeRealmDiscoveryPolicy } "TokenIssuancePolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphTokenIssuancePolicy } "TokenLifetimePolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphTokenLifetimePolicy } "PermissionGrantPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphPermissionGrantPolicy } "DefaultAppManagementPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphappManagementPolicy } "AuthenticationFlowsPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphauthenticationFlowsPolicy } "AuthenticationMethodsPolicy" { $respType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphauthenticationMethodsPolicy} default { Write-Error "Unknown type: " + $res.type} } $res.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0,1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $respType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $respList += $respType } $respList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Remove-EntraAdministrativeUnitMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $MemberId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["MemberId"]) { $params["DirectoryObjectId"] = $PSBoundParameters["MemberId"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $uri = "/v1.0/directory/administrativeUnits/$ObjectId/members/$MemberId/`$ref" $params["Uri"] = $uri $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method DELETE $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Add-EntraEnvironment { [CmdletBinding(DefaultParameterSetName = 'AddQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $AzureADEndpoint, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $GraphEndpoint ) PROCESS{ $params=@{} if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Name"]){ $params["Name"]=$PSBoundParameters["Name"] } if($null -ne $PSBoundParameters["AzureADEndpoint"]){ $params["AzureADEndpoint"]=$PSBoundParameters["AzureADEndpoint"] } if($null -ne $PSBoundParameters["GraphEndpoint"]){ $params["GraphEndpoint"]=$PSBoundParameters["GraphEndpoint"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") Add-MgEnvironment @params } } # ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraEnvironment{ [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", Mandatory = $false, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Name) PROCESS{ $params = @{} if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if ($null -ne $PSBoundParameters["Name"]) { $params["Name"] = $PSBoundParameters["Name"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") Get-MgEnvironment @params } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Disconnect-Entra { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param () Disconnect-MgGraph }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraDirSyncConfiguration { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", Mandatory = $false, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][ValidateNotNullOrEmpty()][ValidateScript({ if ($_ -is [System.Guid]) { $true } else { throw "TenantId must be of type [System.Guid]." } })][System.guid] $TenantId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($null -ne $PSBoundParameters["TenantId"]) { $params["OnPremisesDirectorySynchronizationId"] = $PSBoundParameters["TenantId"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = ((Get-MgDirectoryOnPremiseSynchronization @params -Headers $customHeaders).configuration | Select-Object -Property AccidentalDeletionPrevention).AccidentalDeletionPrevention # Create a custom table $customTable = [PSCustomObject]@{ "AccidentalDeletionThreshold" = $response.AlertThreshold "DeletionPreventionType" = $response.SynchronizationPreventionType } $customTable } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraScopedRoleMembership { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ScopedRoleMembershipId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $isList = $false $baseUri = "https://graph.microsoft.com/v1.0/directory/administrativeUnits" if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] $uri = $baseUri + "/$($params.AdministrativeUnitId)/scopedRoleMembers" $params["Uri"] = $uri $isList = $true } if($null -ne $PSBoundParameters["ScopedRoleMembershipId"]) { $isList = $false $params["ScopedRoleMembershipId"] = $PSBoundParameters["ScopedRoleMembershipId"] $uri = $uri + "/$($params.ScopedRoleMembershipId)" $params["Uri"] = $uri } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================") $response = (Invoke-GraphRequest -Uri $uri -Headers $customHeaders -Method GET) | ConvertTo-Json -Depth 5 | ConvertFrom-Json if($isList){ $response = $response.value } $response | ForEach-Object { if ($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name AdministrativeUnitObjectId -Value AdministrativeUnitId Add-Member -InputObject $_ -MemberType AliasProperty -Name RoleObjectId -Value RoleId Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $memberList = @() foreach($data in $response){ $memberType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphScopedRoleMembership if (-not ($data -is [psobject])) { $data = [pscustomobject]@{ Value = $data } } $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $memberList += $memberType } $memberList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraAttributeSet { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Int32]] $MaxAttributesPerSet ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params["Uri"] = "https://graph.microsoft.com/v1.0/directory/attributeSets/" $params["Method"] = "PATCH" if($null -ne $PSBoundParameters["Id"]) { $params["Uri"] += $Id } if($null -ne $PSBoundParameters["Description"]) { $body["description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["MaxAttributesPerSet"]) { $body["maxAttributesPerSet"] = $PSBoundParameters["MaxAttributesPerSet"] } $params["Body"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Add-EntraScopedRoleMembership { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $RoleObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [Microsoft.Open.MSGraph.Model.MsRoleMemberInfo] $RoleMemberInfo ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] $Uri = "/v1.0/directory/administrativeUnits/$($params.AdministrativeUnitId)/scopedRoleMembers" } if($null -ne $PSBoundParameters["RoleObjectId"]) { $params["RoleId"] = $PSBoundParameters["RoleObjectId"] $body.roleId = $PSBoundParameters["RoleObjectId"]; } if($null -ne $PSBoundParameters["RoleMemberInfo"]) { $TmpValue = $PSBoundParameters["RoleMemberInfo"] $Value = @{ id = ($TmpValue).Id } $params["RoleMemberInfo"] = $Value | ConvertTo-Json $body.roleMemberInfo = $Value } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $Uri -Method "POST" -Body $body $response = $response | ConvertTo-Json -Depth 5 | ConvertFrom-Json $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name AdministrativeUnitObjectId -Value AdministrativeUnitId Add-Member -InputObject $_ -MemberType AliasProperty -Name RoleObjectId -Value RoleId Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $memberList = @() foreach($data in $response){ $memberType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphScopedRoleMembership if (-not ($data -is [psobject])) { $data = [pscustomobject]@{ Value = $data } } $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $memberList += $memberType } $memberList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraCustomHeaders { <# .SYNOPSIS Creates a custom header for use in telemetry. .DESCRIPTION The custom header created is a User-Agent with header value "<PowerShell version> EntraPowershell/<EntraPowershell version> <Entra PowerShell command>" .EXAMPLE New-EntraCustomHeaders -Command Get-EntraUser #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $Command ) $psVersion = $global:PSVersionTable.PSVersion $entraVersion = (Get-module Microsoft.Graph.Entra | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue $customHeaders }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraFeatureRolloutPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsAppliedToOrganization, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $Feature, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.Nullable`1[System.Boolean]] $IsEnabled, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.MsDirectoryObject]] $AppliesTo ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $body = @{} $params["Uri"] = 'https://graph.microsoft.com/v1.0/policies/featureRolloutPolicies/' $params["Method"] = "POST" if ($null -ne $PSBoundParameters["Description"]) { $body["Description"] = $PSBoundParameters["Description"] } if ($null -ne $PSBoundParameters["IsAppliedToOrganization"]) { $body["IsAppliedToOrganization"] = $PSBoundParameters["IsAppliedToOrganization"] } if ($null -ne $PSBoundParameters["DisplayName"]) { $body["DisplayName"] = $PSBoundParameters["DisplayName"] } if ($null -ne $PSBoundParameters["Feature"]) { $body["Feature"] = $PSBoundParameters["Feature"] } if ($null -ne $PSBoundParameters["IsEnabled"]) { $body["IsEnabled"] = $PSBoundParameters["IsEnabled"] } if ($null -ne $PSBoundParameters["AppliesTo"]) { $body["AppliesTo"] = $PSBoundParameters["AppliesTo"] } $params["Body"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $data = Invoke-GraphRequest @params -Headers $customHeaders | ConvertTo-Json | ConvertFrom-Json if ($data) { $userList = @() foreach ($response in $data) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphFeatureRolloutPolicy $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraCustomSecurityAttributeDefinition { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $UsePreDefinedValuesOnly, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Status ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $Uri = "https://graph.microsoft.com/v1.0/directory/customSecurityAttributeDefinitions/$Id" $Method = "PATCH" if($null -ne $PSBoundParameters["Id"]) { $params["Id"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["Description"]) { $body["description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["UsePreDefinedValuesOnly"]) { $body["usePreDefinedValuesOnly"] = $PSBoundParameters["UsePreDefinedValuesOnly"] } if($null -ne $PSBoundParameters["Status"]) { $body["status"] = $PSBoundParameters["Status"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Uri $Uri -Method $Method -Body $body -Headers $customHeaders $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraAdministrativeUnit { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] [System.String] $DisplayName ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] $body["Description"] = $PSBoundParameters["Description"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] $body["DisplayName"] = $PSBoundParameters["DisplayName"] } $uri = "/v1.0/directory/administrativeUnits" $body = $body | ConvertTo-Json Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method POST -Body $body $response = $response | ConvertTo-Json | ConvertFrom-Json $auList = @() foreach($data in $response){ $auType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAdministrativeUnit $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $auType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $auList += $auType } $auList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraFederationProperty { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false)][System.String] $DomainName, [Parameter(ParameterSetName = "GetQuery", Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false)][Switch] $SupportMultipleDomain ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($null -ne $PSBoundParameters["DomainName"]) { $params["DomainId"] = $PSBoundParameters["DomainName"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDomainFederationConfiguration @params -Headers $customHeaders $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ActiveClientSignInUrl -Value ActiveSignInUri Add-Member -InputObject $_ -MemberType AliasProperty -Name FederationServiceDisplayName -Value DisplayName Add-Member -InputObject $_ -MemberType AliasProperty -Name FederationServiceIdentifier -Value IssuerUri Add-Member -InputObject $_ -MemberType AliasProperty -Name FederationMetadataUrl -Value MetadataExchangeUri Add-Member -InputObject $_ -MemberType AliasProperty -Name PassiveClientSignInUrl -Value PassiveSignInUri Add-Member -InputObject $_ -MemberType AliasProperty -Name PassiveClientSignOutUrl -Value SignOutUri } } $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraDomainFederationSettings { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param( [Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)][string]$DomainName, [Parameter(Mandatory=$false,Position=1,ValueFromPipelineByPropertyName=$true)][ValidateNotNullOrEmpty()][ValidateScript({ if ($_ -is [System.Guid]) { $true } else { throw "TenantId must be of type [System.Guid]." } })][System.guid] $TenantId ) process { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($PSBoundParameters.ContainsKey("TenantId")) { $params["TenantId"] = $TenantId } if ($PSBoundParameters.ContainsKey("DomainName")) { $params["DomainId"] = $DomainName } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDomainFederationConfiguration -Headers $customHeaders -DomainId $params["DomainId"] | ConvertTo-Json -Depth 10 | ConvertFrom-Json $customTable = [PSCustomObject]@{ "ActiveLogOnUri" = $response.ActiveSignInUri #"DefaultInteractiveAuthenticationMethod" = $response. "FederationBrandName" = $response.DisplayName "IssuerUri" = $response.IssuerUri "LogOffUri" = $response.SignOutUri "MetadataExchangeUri" = $response.MetadataExchangeUri "NextSigningCertificate" = $response.NextSigningCertificate #"OpenIdConnectDiscoveryEndpoint" = $response. "PassiveLogOnUri" = $response.PassiveSignInUri #"PasswordChangeUri" = $response. #"PasswordResetUri" = $response. "PreferredAuthenticationProtocol" = $response.PreferredAuthenticationProtocol "PromptLoginBehavior" = $response.PromptLoginBehavior "SigningCertificate" = $response.SigningCertificate "SigningCertificateUpdateStatus" = $response.SigningCertificateUpdateStatus #"SupportsMfa" = $response. } $customTable } } # ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraDomainFederationSettings { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$DomainName, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$SigningCertificate, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$NextSigningCertificate, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$LogOffUri, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$PassiveLogOnUri, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$ActiveLogOnUri, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$IssuerUri, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$FederationBrandName, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$MetadataExchangeUri, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$PreferredAuthenticationProtocol, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]$SigningCertificateUpdateStatus, [Parameter(Mandatory = $false,ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string]$PromptLoginBehavior ) process { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["DomainName"]) { $params["DomainId"] = $PSBoundParameters["DomainName"] $Id = $PSBoundParameters["DomainName"] if($null -ne $Id) { $params["InternalDomainFederationId"] = (Get-MgDomainFederationConfiguration -DomainId $Id).Id } } if($null -ne $PSBoundParameters["SigningCertificate"]) { $params["SigningCertificate"] = $PSBoundParameters["SigningCertificate"] } if($null -ne $PSBoundParameters["NextSigningCertificate"]) { $params["NextSigningCertificate"] = $PSBoundParameters["NextSigningCertificate"] } if($null -ne $PSBoundParameters["LogOffUri"]) { $params["SignOutUri"] = $PSBoundParameters["LogOffUri"] } if($null -ne $PSBoundParameters["PassiveLogOnUri"]) { $params["PassiveSignInUri"] = $PSBoundParameters["PassiveLogOnUri"] } if($null -ne $PSBoundParameters["ActiveLogOnUri"]) { $params["ActiveSignInUri"] = $PSBoundParameters["ActiveLogOnUri"] } if($null -ne $PSBoundParameters["IssuerUri"]) { $params["IssuerUri"] = $PSBoundParameters["IssuerUri"] } if($null -ne $PSBoundParameters["FederationBrandName"]) { $params["DisplayName"] = $PSBoundParameters["FederationBrandName"] } if($null -ne $PSBoundParameters["MetadataExchangeUri"]) { $params["MetadataExchangeUri"] = $PSBoundParameters["MetadataExchangeUri"] } if($null -ne $PSBoundParameters["PreferredAuthenticationProtocol"]) { $params["PreferredAuthenticationProtocol"] = $PSBoundParameters["PreferredAuthenticationProtocol"] } if($null -ne $PSBoundParameters["SigningCertificateUpdateStatus"]) { $params["SigningCertificateUpdateStatus"] = $PSBoundParameters["SigningCertificateUpdateStatus"] } if($null -ne $PSBoundParameters["PromptLoginBehavior"]) { $params["PromptLoginBehavior"] = $PSBoundParameters["PromptLoginBehavior"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if($null -ne $params.InternalDomainFederationId) { $response = Update-MgDomainFederationConfiguration @params -Headers $customHeaders $response } } } # ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Remove-EntraScopedRoleMembership { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ScopedRoleMembershipId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["ScopedRoleMembershipId"]) { $params["ScopedRoleMembershipId"] = $PSBoundParameters["ScopedRoleMembershipId"] } $uri = "/v1.0/directory/administrativeUnits/$($params.AdministrativeUnitId)/scopedRoleMembers/$($params.ScopedRoleMembershipId)" $params["Uri"] = $uri Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method DELETE $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Find-EntraPermission { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Position = 1)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [switch] $ExactMatch, [Parameter(ParameterSetName = "GetQuery", Mandatory = $false, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $PermissionType, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $Online ) PROCESS { $params = @{} if($null -ne $PSBoundParameters["SearchString"]) { $params["SearchString"]=$PSBoundParameters["SearchString"] } if($null -ne $PSBoundParameters["PermissionType"]) { $params["PermissionType"]=$PSBoundParameters["PermissionType"] } if($null -ne $PSBoundParameters["ExactMatch"]) { $params["ExactMatch"] = $PSBoundParameters["ExactMatch"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($null -ne $PSBoundParameters["All"]) { if($PSBoundParameters["All"]) { $params["All"] = $PSBoundParameters["All"] } } if($null -ne $PSBoundParameters["Online"]) { if($PSBoundParameters["Online"]) { $params["Online"] = $PSBoundParameters["Online"] } } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["Top"]) { $params["Top"] = $PSBoundParameters["Top"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") Find-MgGraphPermission @params } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraPasswordPolicy { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][System.String] $DomainName ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($null -ne $PSBoundParameters["DomainName"]) { $params["DomainId"] = $PSBoundParameters["DomainName"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgDomain @params -Headers $customHeaders # Create a custom table $customTable = [PSCustomObject]@{ "NotificationDays" = $response.PasswordNotificationWindowInDays "ValidityPeriod" = $response.PasswordValidityPeriodInDays } $customTable } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraCustomSecurityAttributeDefinition { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $Method = "GET" $Uri = "https://graph.microsoft.com/v1.0/directory/customSecurityAttributeDefinitions/" $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["Id"]) { $Uri += $Id } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Uri $Uri -Method $Method -Headers $customHeaders) | ConvertTo-Json | ConvertFrom-Json try { $response = $response.value } catch {} if($response){ $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphCustomSecurityAttributeDefinition $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Remove-EntraFeatureRolloutPolicy { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $params["Uri"] = "https://graph.microsoft.com/v1.0/policies/featureRolloutPolicies/$Id" $params["Method"] = "DELETE" Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders | ConvertTo-Json | ConvertFrom-Json $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraApplicationFromApplicationTemplate { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $DisplayName ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["Id"]) { $params["ApplicationTemplateId"] = $PSBoundParameters["Id"] } if ($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $body = @{ displayName = $DisplayName } $uri = "https://graph.microsoft.com/v1.0/applicationTemplates/$Id/instantiate" $response = invoke-graphrequest -uri $uri -Headers $customHeaders -Body $body -Method POST | ConvertTo-Json -Depth 5 | ConvertFrom-Json $memberList = @() foreach($data in $response){ $memberType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphApplicationServicePrincipal if (-not ($data -is [psobject])) { $data = [pscustomobject]@{ Value = $data } } $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $memberList += $memberType } $memberList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraPartnerInformation { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", ValueFromPipelineByPropertyName = $true)][System.Guid] $TenantId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["TenantId"]) { $params["TenantID"] = $PSBoundParameters["TenantId"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if ([string]::IsNullOrWhiteSpace($TenantId)) { $TenantID = ((invoke-mggraphrequest -Method GET -Uri "https://graph.microsoft.com/v1.0/organization").value).id } $response = invoke-mggraphrequest -Headers $customHeaders -Method GET -Uri "https://graph.microsoft.com/v1.0/organization/$TenantID/partnerInformation" # Create a custom table $customTable = [PSCustomObject]@{ "PartnerCompanyName" = $response.companyName "companyType" = $response.companyType "PartnerSupportTelephones" = $response.supportTelephones "PartnerSupportEmails" = $response.supportEmails "PartnerHelpUrl" = $response.helpUrl "PartnerCommerceUrl" = $response.commerceUrl "PartnerSupportUrl" = $response.supportUrl "ObjectID" = $response.partnerTenantId } $customTable } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraDirectoryObjectOnPremisesProvisioningError { [CmdletBinding(DefaultParameterSetName = 'GetById')] param ( [Parameter(ParameterSetName = "GetById")][ValidateNotNullOrEmpty()][ValidateScript({if ($_ -is [System.Guid]) { $true } else {throw "TenantId must be of type [System.Guid]."}})][System.Guid] $TenantId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["TenantId"]) { $params["TenantId"] = $PSBoundParameters["TenantId"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $Object = @("users", "groups", "contacts") $response = @() try { foreach ($obj in $object) { $obj = ($obj | Out-String).trimend() $uri = 'https://graph.microsoft.com/v1.0/' + $obj + '?$select=onPremisesProvisioningErrors' $response += ((Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method GET).value).onPremisesProvisioningErrors } } catch {} if ([string]::IsNullOrWhiteSpace($response)) { write-host "False" } else { $response } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraAdministrativeUnit { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] $body["DisplayName"] = $PSBoundParameters["DisplayName"] } if($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] $body["Description"] = $PSBoundParameters["Description"] } $uri = "/v1.0/directory/administrativeUnits/$($params.AdministrativeUnitId)" $params["Uri"] = $uri $body = $body | ConvertTo-Json Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method PATCH -Body $body } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Remove-EntraAdministrativeUnit { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $uri = "/v1.0/directory/administrativeUnits/$($params.AdministrativeUnitId)" $params["Uri"] = $uri $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method DELETE $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraContext { [CmdletBinding(DefaultParameterSetName = '')] param () PROCESS { $params = @{} if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["Confirm"]) { $params["Confirm"] = $PSBoundParameters["Confirm"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } if($null -ne $PSBoundParameters["WhatIf"]) { $params["WhatIf"] = $PSBoundParameters["WhatIf"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Get-MgContext @params $response } } Set-Alias -Name Get-EntraCurrentSessionInfo -Value Get-EntraContext -Scope Global -Force # ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraCustomSecurityAttributeDefinitionAllowedValue { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $CustomSecurityAttributeDefinitionId ) PROCESS { $params = @{} $params["Uri"] = "https://graph.microsoft.com/v1.0/directory/customSecurityAttributeDefinitions/$CustomSecurityAttributeDefinitionId/allowedValues/" $params["Method"] = "GET" $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["Id"]) { $params["Uri"] += $Id } if ($null -ne $PSBoundParameters["Filter"]) { $params["Uri"] += '?$filter=' + $Filter } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest @params -Headers $customHeaders) | ConvertTo-Json -Depth 5 | ConvertFrom-Json try { $response = $response.value } catch {} if($response) { $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAllowedValue $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0,1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Add-EntraAdministrativeUnitMember { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] $Uri = "/v1.0/directory/administrativeUnits/$($params.AdministrativeUnitId)/members/" + '$ref' } if($null -ne $PSBoundParameters["RefObjectId"]) { $TmpValue = $PSBoundParameters["RefObjectId"] $Value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$TmpValue"} $params["BodyParameter"] = $Value } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================") Invoke-GraphRequest -Headers $customHeaders -Uri $Uri -Method "POST" -Body $Value } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraOauth2PermissionGrant { [CmdletBinding(DefaultParameterSetName = 'CreateExpanded')] param ( [Parameter(ParameterSetName = "CreateExpanded",Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ClientId, [Parameter(ParameterSetName = "CreateExpanded",Mandatory = $true)] [System.String] $ConsentType, [Parameter(ParameterSetName = "CreateExpanded")] [System.String] $PrincipalId, [Parameter(ParameterSetName = "CreateExpanded",Mandatory = $true)] [System.String] $ResourceId, [Parameter(ParameterSetName = "CreateExpanded")] [System.String] $Scope ) PROCESS { $params = @{} $body = @{} $params["Uri"] = "https://graph.microsoft.com/v1.0/oauth2PermissionGrants" $params["Method"] = "POST" $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if($null -ne $PSBoundParameters["ClientId"]) { $body["clientId"] = $PSBoundParameters["ClientId"] } if($null -ne $PSBoundParameters["ConsentType"]) { $body["consentType"] = $PSBoundParameters["ConsentType"] } if($null -ne $PSBoundParameters["PrincipalId"]) { $body["principalId"] = $PSBoundParameters["PrincipalId"] } if($null -ne $PSBoundParameters["ResourceId"]) { $body["resourceId"] = $PSBoundParameters["ResourceId"] } if($null -ne $PSBoundParameters["Scope"]) { $body["scope"] = $PSBoundParameters["Scope"] } $params["Body"] = $body Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders if($response){ $response = $response | ConvertTo-Json | ConvertFrom-Json $response | ForEach-Object { if ($null -ne $_) { $userData = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphOAuth2PermissionGrant]::new() $_.PSObject.Properties | ForEach-Object { $userData | Add-Member -MemberType NoteProperty -Name $_.Name -Value $_.Value -Force } } } $userData } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraAdministrativeUnit { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = "/v1.0/directory/administrativeUnits" $properties = '$select=*' $params["Uri"] = "$baseUri/?$properties" if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] $params["Uri"] = "$baseUri/$($params.AdministrativeUnitId)?$properties" } if($null -ne $PSBoundParameters["All"]) { $uri = $baseUri } if($null -ne $PSBoundParameters["Top"] -and (-not $PSBoundParameters.ContainsKey("All"))) { $topCount = $PSBoundParameters["Top"] if ($topCount -gt 999) { $params["Uri"] += "&`$top=999" } else{ $params["Uri"] += "&`$top=$topCount" } } if($null -ne $PSBoundParameters["Filter"]) { $params["Filter"] = $PSBoundParameters["Filter"] $Filter = $PSBoundParameters["Filter"] $f = '$' + 'Filter' $params["Uri"] += "&$f=$Filter" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $($params.Uri) -Method GET) if($response.ContainsKey('value')){ $response = $response.value } $data = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json try { $data = $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json $all = $All.IsPresent $increment = $topCount - $data.Count while ($response.'@odata.nextLink' -and (($all) -or ($increment -gt 0 -and -not $all))) { $URI = $response.'@odata.nextLink' if (-not $all) { $topValue = [Math]::Min($increment, 999) $URI = $URI.Replace('$top=999', "`$top=$topValue") $increment -= $topValue } $response = Invoke-GraphRequest -Uri $URI -Method $Method $data += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } } catch {} $data | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id Add-Member -InputObject $_ -MemberType AliasProperty -Name DeletionTimeStamp -Value deletedDateTime } } $aulist = @() foreach($item in $data){ $auType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAdministrativeUnit $item.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0,1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $auType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $aulist += $auType } $aulist } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraDirSyncfeature { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][System.Guid] $TenantId, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][System.String]$Feature ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($null -ne $PSBoundParameters["Feature"]) { $Feature = $PSBoundParameters["Feature"] } if ($null -ne $PSBoundParameters["TenantId"]) { $params["OnPremisesDirectorySynchronizationId"] = $PSBoundParameters["TenantId"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $jsonData = Get-MgDirectoryOnPremiseSynchronization @params -Headers $customHeaders | ConvertTo-Json $object = ConvertFrom-Json $jsonData $table =@() foreach ($featureName in $object.Features.PSObject.Properties.Name) { $row = New-Object PSObject -Property @{ 'DirSyncFeature' = $featureName -replace "Enabled", "" 'Enabled' = $object.Features.$featureName } $table += $row } if([string]::IsNullOrWhiteSpace($Feature)) { $table | Format-Table -AutoSize } else { $output = $table | Where-Object {$_.dirsyncFeature -eq $Feature} if($null -eq $output) { Write-Error "Get-EntraDirSyncfeature : Invalid value for parameter. Parameter Name: Feature." } else { $output } } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraAttributeSet { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params["Uri"] = "https://graph.microsoft.com/v1.0/directory/attributeSets/" $params["Method"] = "GET" if ($null -ne $PSBoundParameters["Id"]) { $params["Uri"] += $Id } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders | ConvertTo-Json | ConvertFrom-Json try { $response = $response.value } catch {} if($response) { $userList = @() foreach ($data in $response) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttributeSet $data.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0,1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Remove-EntraPolicy { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $policyTypes = "activityBasedTimeoutPolicies", "defaultAppManagementPolicy", "appManagementPolicies", "authenticationFlowsPolicy", "authenticationMethodsPolicy", "claimsMappingPolicies", "featureRolloutPolicies", "homeRealmDiscoveryPolicies", "permissionGrantPolicies", "tokenIssuancePolicies", "tokenLifetimePolicies" foreach ($policyType in $policyTypes) { $uri = "https://graph.microsoft.com/v1.0/policies/" + $policyType + "/" + $id try { $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method GET break } catch {} } $policy = ($response.'@odata.context') -match 'policies/([^/]+)/\$entity' $policyType = $Matches[1] Write-Debug("============================ Matches ============================") Write-Debug($Matches[1]) if (($null -ne $PSBoundParameters["id"]) -and ($null -ne $policyType )) { $URI = "https://graph.microsoft.com/v1.0/policies/" + $policyType + "/" + $id } $Method = "DELETE" Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method $Method $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Remove-EntraFeatureRolloutPolicyDirectoryObject { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $params["Uri"] = 'https://graph.microsoft.com/v1.0/policies/featureRolloutPolicies/{0}/appliesTo/{1}/$ref' -f $Id,$ObjectId $params["Method"] = "DELETE" Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraAuditSignInLog { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Int32] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter ) PROCESS { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/auditLogs/signIns' $params["Method"] = "GET" $params["Uri"] = "$baseUri" $query = $null if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] if ($topCount -gt 999) { $query += "&`$top=999" } else{ $query += "&`$top=$topCount" } } if($null -ne $PSBoundParameters["Id"]) { $logId = $PSBoundParameters["Id"] $params["Uri"] = "$baseUri/$($logId)" } if($null -ne $PSBoundParameters["Filter"]) { $Filter = $PSBoundParameters["Filter"] $f = '$filter' $query += "&$f=$Filter" } if($null -ne $query) { $query = "?" + $query.TrimStart("&") $params["Uri"] += $query } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders $data = $response | ConvertTo-Json -Depth 100 | ConvertFrom-Json try { $data = $response.value | ConvertTo-Json -Depth 100 | ConvertFrom-Json $all = $All.IsPresent $increment = $topCount - $data.Count while (($response.'@odata.nextLink' -and (($all -and ($increment -lt 0)) -or $increment -gt 0))) { $params["Uri"] = $response.'@odata.nextLink' if ($increment -gt 0) { $topValue = [Math]::Min($increment, 999) $params["Uri"] = $params["Uri"].Replace('$top=999', "`$top=$topValue") $increment -= $topValue } $response = Invoke-GraphRequest @params $data += $response.value | ConvertTo-Json -Depth 100 | ConvertFrom-Json } } catch {} $userList = @() foreach ($response in $data) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphSignIn $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraPolicy { [CmdletBinding(DefaultParameterSetName = 'NewPolicy')] param ( [Parameter(ParameterSetName = "NewPolicy", Mandatory = $true)] [System.Collections.Generic.List`1[System.String]] $Definition, [Parameter(ParameterSetName = "NewPolicy", Mandatory = $true)] [System.String] $DisplayName, [Parameter(ParameterSetName = "NewPolicy", Mandatory = $true)] [System.String] $Type, [Parameter(ParameterSetName = "NewPolicy")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.KeyCredential]] $KeyCredentials, [Parameter(ParameterSetName = "NewPolicy")] [System.Nullable`1[System.Boolean]] $IsOrganizationDefault, [Parameter(ParameterSetName = "NewPolicy")] [System.String] $AlternativeIdentifier ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params["Type"] = $Type $respType = $null if($params.type -eq "activityBasedTimeoutPolicy" ) { $params.type = "activityBasedTimeoutPolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphActivityBasedTimeoutPolicy } elseif ($params.type -eq "ApplicationManagementPolicy") { $params.type = "appManagementPolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphAppManagementPolicy } elseif ($params.type -eq "claimsMappingPolicies") { $params.type = "claimsMappingPolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphClaimsMappingPolicy } elseif ($params.type -eq "featureRolloutPolicy") { $params.type = "featureRolloutPolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphFeatureRolloutPolicy } elseif ($params.type -eq "HomeRealmDiscoveryPolicy") { $params.type = "homeRealmDiscoveryPolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphHomeRealmDiscoveryPolicy } elseif ($params.type -eq "tokenIssuancePolicy") { $params.type = "tokenIssuancePolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphTokenIssuancePolicy } elseif ($params.type -eq "tokenLifetimePolicy") { $params.type = "tokenLifetimePolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphTokenLifetimePolicy } elseif ($params.type -eq "permissionGrantPolicy") { $params.type = "permissionGrantPolicies" $respType = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphPermissionGrantPolicy } $params["Uri"] = "https://graph.microsoft.com/v1.0/policies/" + $params.type $Definition =$PSBoundParameters["Definition"] $DisplayName=$PSBoundParameters["DisplayName"] $AlternativeIdentifier = $PSBoundParameters["AlternativeIdentifier"] $KeyCredentials = $PSBoundParameters["KeyCredentials"] $IsOrganizationDefault =$PSBoundParameters["IsOrganizationDefault"] $params["Method"] = "POST" $body = @{ Definition = $Definition DisplayName = $DisplayName IsOrganizationDefault = $IsOrganizationDefault AlternativeIdentifier =$AlternativeIdentifier KeyCredentials = $KeyCredentials Type = $Type } $body = $body | ConvertTo-Json Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Headers $customHeaders -Uri $params.uri -Method $params.method -Body $body | ConvertTo-Json | ConvertFrom-Json $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $respType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $respType } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraCustomSecurityAttributeDefinitionAllowedValue { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsActive, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $CustomSecurityAttributeDefinitionId ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $Uri = "https://graph.microsoft.com/v1.0/directory/customSecurityAttributeDefinitions/$CustomSecurityAttributeDefinitionId/allowedValues/$Id" $Method = "PATCH" if($null -ne $PSBoundParameters["CustomSecurityAttributeDefinitionId"]) { $params["CustomSecurityAttributeDefinitionId"] = $PSBoundParameters["CustomSecurityAttributeDefinitionId"] } if($null -ne $PSBoundParameters["Id"]) { $params["Id"] = $PSBoundParameters["Id"] } if($null -ne $PSBoundParameters["IsActive"]) { $body["IsActive"] = $PSBoundParameters["IsActive"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest -Uri $Uri -Method $Method -Body $body -Headers $customHeaders $response } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraPolicy { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $AlternativeIdentifier, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Definition, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $DisplayName, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Type, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.KeyCredential]] $KeyCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Nullable`1[System.Boolean]] $IsOrganizationDefault ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $policyTypeMap = @{ "ActivityBasedTimeoutPolicy" = "activityBasedTimeoutPolicies" "ApplicationManagementPolicy" = "appManagementPolicies" "DefaultAppManagementPolicy" = "defaultAppManagementPolicy" "AuthenticationFlowsPolicy" = "authenticationFlowsPolicy" "AuthenticationMethodsPolicy" = "authenticationMethodsPolicy" "ClaimsMappingPolicy" = "claimsMappingPolicies" "FeatureRolloutPolicy" = "featureRolloutPolicies" "HomeRealmDiscoveryPolicy" = "homeRealmDiscoveryPolicies" "PermissionGrantPolicy" = "permissionGrantPolicies" "TokenIssuancePolicy" = "tokenIssuancePolicies" "TokenLifetimePolicy" = "tokenLifetimePolicies" } $policyTypes = $policyTypeMap.Values if ($null -ne $PSBoundParameters["type"]) { $type = if ($policyTypeMap.ContainsKey($type)) { $policyTypeMap[$type] } else { Write-Error "Set-EntraBetADPolicy : Error occurred while executing SetPolicy Code: Request_BadRequest Message: Invalid value specified for property 'type' of resource 'Policy'." return; } } else { $type = $null } if(!$type) { foreach ($pType in $policyTypes) { $uri = "https://graph.microsoft.com/v1.0/policies/" + $pType + "/" + $id try { $response = Invoke-GraphRequest -Uri $uri -Method GET break } catch {} } $policy = ($response.'@odata.context') -match 'policies/([^/]+)/\$entity' $type = $Matches[1] } if($policyTypes -notcontains $type) { Write-Error "Set-AzureADPolicy : Error occurred while executing SetPolicy Code: Request_BadRequest Message: Invalid value specified for property 'type' of resource 'Policy'." } else { if ($null -ne $PSBoundParameters["Definition"]) { $params["Definition"] = $PSBoundParameters["Definition"] } if ($null -ne $PSBoundParameters["DisplayName"]) { $params["DisplayName"] = $PSBoundParameters["DisplayName"] } if ($null -ne $PSBoundParameters["Definition"]) { $params["Definition"] = $PSBoundParameters["Definition"] } if ($null -ne $PSBoundParameters["IsOrganizationDefault"]) { $params["IsOrganizationDefault"] = $PSBoundParameters["IsOrganizationDefault"] } if (($null -ne $PSBoundParameters["id"]) -and ($null -ne $type )) { $URI = "https://graph.microsoft.com/v1.0/policies/" + $type + "/" + $id } $Method = "PATCH" Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $body = $params | ConvertTo-Json Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Body $body -Method $Method } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraObjectSetting { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][System.String] $Id, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $TargetType, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $TargetObjectId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $topCount = $null $baseUri = "https://graph.microsoft.com/v1.0/$TargetType/$TargetObjectId/settings" $params["Method"] = "GET" $params["Uri"] = $baseUri+'?$select=*' if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $params["Uri"] = $baseUri+"?`$select=$($selectProperties)" } if($null -ne $PSBoundParameters["Top"] -and (-not $PSBoundParameters.ContainsKey("All"))) { $topCount = $PSBoundParameters["Top"] if ($topCount -gt 999) { $params["Uri"] += "&`$top=999" } else{ $params["Uri"] += "&`$top=$topCount" } } if($null -ne $PSBoundParameters["Id"]) { $Id = $PSBoundParameters["Id"] $params["Uri"] = "$baseUri/$($Id)" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders $data = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json try { $data = $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json $all = $All.IsPresent $increment = $topCount - $data.Count while ($response.'@odata.nextLink' -and (($all) -or ($increment -gt 0 -and -not $all))) { $params["Uri"] = $response.'@odata.nextLink' if (-not $all) { $topValue = [Math]::Min($increment, 999) $params["Uri"] = $params["Uri"].Replace('$top=999', "`$top=$topValue") $increment -= $topValue } $response = Invoke-GraphRequest @params $data += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } } catch {} $targetTypeList = @() if($TargetType.ToLower() -eq 'groups'){ foreach($res in $data){ $groupType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphGroupSetting $res.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0,1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $groupType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $targetTypeList += $groupType } } if($TargetType.ToLower() -eq 'users'){ foreach($res in $data){ $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphUserSettings $res.PSObject.Properties | ForEach-Object { $propertyName = $_.Name.Substring(0,1).ToUpper() + $_.Name.Substring(1) $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $targetTypeList += $userType } } $targetTypeList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraAdministrativeUnitMember { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Nullable`1[System.Int32]] $Top, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ObjectId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = "/v1.0/directory/administrativeUnits/$ObjectId/members?`$select=*" $params["Uri"] = "$baseUri" if($null -ne $PSBoundParameters["ObjectId"]) { $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] } if($null -ne $PSBoundParameters["All"]) { $uri = $baseUri } if($null -ne $PSBoundParameters["Top"] -and (-not $PSBoundParameters.ContainsKey("All"))) { $topCount = $PSBoundParameters["Top"] if ($topCount -gt 999) { $params["Uri"] += "&`$top=999" } else{ $params["Uri"] += "&`$top=$topCount" } } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = (Invoke-GraphRequest -Headers $customHeaders -Uri $($params.Uri) -Method GET) if($response.ContainsKey('value')){ $response = $response.value } $data = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json try { $data = $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json $all = $All.IsPresent $increment = $topCount - $data.Count while ($response.'@odata.nextLink' -and (($all) -or ($increment -gt 0 -and -not $all))) { $URI = $response.'@odata.nextLink' if (-not $all) { $topValue = [Math]::Min($increment, 999) $URI = $URI.Replace('$top=999', "`$top=$topValue") $increment -= $topValue } $response = Invoke-GraphRequest -Uri $URI -Method $Method $data += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } } catch {} $data | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id } } if($data){ $memberList = @() foreach ($response in $data) { $memberType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject if (-not ($response -is [psobject])) { $response = [pscustomobject]@{ Value = $response } } $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $memberList += $memberType } $memberList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraFeatureRolloutPolicy { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $SearchString, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) PROCESS { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $baseUri = 'https://graph.microsoft.com/v1.0/policies/featureRolloutPolicies' $params["Method"] = "GET" $params["Uri"] = "$baseUri" $query = $null if($null -ne $PSBoundParameters["Id"]) { $Id = $PSBoundParameters["Id"] $params["Uri"] = "https://graph.microsoft.com/v1.0/policies/featureRolloutPolicies/$Id" } if($null -ne $PSBoundParameters["SearchString"]) { $FilterValue = $PSBoundParameters["SearchString"] $filter="displayName eq '$FilterValue' or startswith(displayName,'$FilterValue')" $f = '$' + 'Filter' $query += "&$f=$Filter" } if($null -ne $PSBoundParameters["Filter"]) { $Filter = $PSBoundParameters["Filter"] $f = '$' + 'Filter' $query += "&$f=$Filter" } if($null -ne $PSBoundParameters["Property"]) { $selectProperties = $PSBoundParameters["Property"] $selectProperties = $selectProperties -Join ',' $query += "&`$select=$($selectProperties)" } if($null -ne $query) { $query = "?" + $query.TrimStart("&") $params["Uri"] += $query } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $data = Invoke-GraphRequest @params -Headers $customHeaders | ConvertTo-Json | ConvertFrom-Json try { $data = $data.value | ConvertTo-Json | ConvertFrom-Json } catch {} if($data) { $userList = @() foreach ($response in $data) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphFeatureRolloutPolicy $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraPartnerInformation { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter( ValueFromPipelineByPropertyName = $true)] [System.Guid] $ObjectId, [Parameter(ParameterSetName = 'SetPartnerInformation', ValueFromPipelineByPropertyName = $true)] [string] $CompanyType, [Parameter(ParameterSetName = 'SetPartnerInformation', ValueFromPipelineByPropertyName = $true)] [string] $PartnerCommerceUrl, [Parameter(ParameterSetName = 'SetPartnerInformation', ValueFromPipelineByPropertyName = $true)] [string] $PartnerCompanyName, [Parameter(ParameterSetName = 'SetPartnerInformation', ValueFromPipelineByPropertyName = $true)] [string] $PartnerHelpUrl, [Parameter(ParameterSetName = 'SetPartnerInformation', ValueFromPipelineByPropertyName = $true)] [string[]] $PartnerSupportEmails, [Parameter(ParameterSetName = 'SetPartnerInformation', ValueFromPipelineByPropertyName = $true)] [string[]] $PartnerSupportTelephones, [Parameter(ParameterSetName = 'SetPartnerInformation', ValueFromPipelineByPropertyName = $true)] [string] $PartnerSupportUrl, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Guid] $TenantId ) PROCESS { $params = @{} $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($null -ne $PSBoundParameters["TenantId"]) { $body["partnerTenantId"] = $PSBoundParameters["TenantId"] } if ($null -ne $PSBoundParameters["CompanyType"]) { $body["companyType"] = $PSBoundParameters["CompanyType"] } if ($null -ne $PSBoundParameters["PartnerCommerceUrl"]) { $body["commerceUrl"] = $PSBoundParameters["PartnerCommerceUrl"] } if ($null -ne $PSBoundParameters["PartnerCompanyName"]) { $body["companyName"] = $PSBoundParameters["PartnerCompanyName"] } if ($null -ne $PSBoundParameters["PartnerHelpUrl"]) { $body["helpUrl"] = $PSBoundParameters["PartnerHelpUrl"] } if ($null -ne $PSBoundParameters["PartnerSupportEmails"]) { $body["supportEmails"] = @($PSBoundParameters["PartnerSupportEmails"]) } if ($null -ne $PSBoundParameters["PartnerSupportTelephones"]) { $body["supportTelephones"] = @($PSBoundParameters["PartnerSupportTelephones"] -as [string[]]) } if ($null -ne $PSBoundParameters["PartnerSupportUrl"]) { $body["supportUrl"] = $PSBoundParameters["PartnerSupportUrl"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if ([string]::IsNullOrWhiteSpace($TenantId)) { $TenantID = ((Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/organization").value).id } Invoke-MgGraphRequest -Headers $customHeaders -Method PATCH -Uri "https://graph.microsoft.com/v1.0/organization/$TenantID/partnerInformation" -Body $body } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Get-EntraAuditDirectoryLog { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Id, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Int32] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $Filter ) PROCESS { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params = @{} $topCount = $null $baseUri = 'https://graph.microsoft.com/v1.0/auditLogs/directoryAudits' $params["Method"] = "GET" $params["Uri"] = "$baseUri"+"?" if($null -ne $PSBoundParameters["Top"]) { $topCount = $PSBoundParameters["Top"] if ($topCount -gt 999) { $params["Uri"] += "&`$top=999" } else{ $params["Uri"] += "&`$top=$topCount" } } if($null -ne $PSBoundParameters["Id"]) { $LogId = $PSBoundParameters["Id"] $params["Uri"] = "$baseUri/$($LogId)" } if($null -ne $PSBoundParameters["Filter"]) { $Filter = $PSBoundParameters["Filter"] $f = '$Filter' $params["Uri"] += "&$f=$Filter" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") $response = Invoke-GraphRequest @params -Headers $customHeaders $data = $response | ConvertTo-Json -Depth 10 | ConvertFrom-Json try { $data = $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json $all = $All.IsPresent $increment = $topCount - $data.Count while (($response.'@odata.nextLink' -and (($all -and ($increment -lt 0)) -or $increment -gt 0))) { $params["Uri"] = $response.'@odata.nextLink' if ($increment -gt 0) { $topValue = [Math]::Min($increment, 999) $params["Uri"] = $params["Uri"].Replace('$top=999', "`$top=$topValue") $increment -= $topValue } $response = Invoke-GraphRequest @params $data += $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json } } catch {} $userList = @() foreach ($response in $data) { $userType = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryAudit $response.PSObject.Properties | ForEach-Object { $propertyName = $_.Name $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } $userList += $userType } $userList } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraDirSyncFeature { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetQuery", Mandatory = $true, ValueFromPipelineByPropertyName = $true)][System.String] $Feature, [Parameter(ParameterSetName = "GetQuery", Mandatory = $true, ValueFromPipelineByPropertyName = $true)][System.Boolean] $Enabled, [Parameter(ParameterSetName = "GetQuery", ValueFromPipelineByPropertyName = $true)][ValidateNotNullOrEmpty()][ValidateScript({if ($_ -is [System.Guid]) { $true } else {throw "TenantId must be of type [System.Guid]."}})][System.Guid] $TenantId, [switch] $Force ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if ($null -ne $PSBoundParameters["Feature"]) { $Feature = $PSBoundParameters["Feature"] + "Enabled" } if ($null -ne $PSBoundParameters["Enabled"]) { $Enabled = $PSBoundParameters["Enabled"] } if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") if ([string]::IsNullOrWhiteSpace($TenantId)) { $OnPremisesDirectorySynchronizationId = (Get-MgDirectoryOnPremiseSynchronization).Id } else { $OnPremisesDirectorySynchronizationId = $TenantId } $body = @{ features = @{ $Feature = $Enabled } } $body = $body | ConvertTo-Json if ($Force) { # If -Force is used, skip confirmation and proceed with the action. $decision = 0 } else { $title = 'Confirm' $question = 'Do you want to continue?' $Suspend = new-Object System.Management.Automation.Host.ChoiceDescription "&Suspend", "S" $Yes = new-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Y" $No = new-Object System.Management.Automation.Host.ChoiceDescription "&No", "N" $choices = [System.Management.Automation.Host.ChoiceDescription[]]( $Yes, $No, $Suspend) $decision = $Host.UI.PromptForChoice($title, $question, $choices, 1) } if ($decision -eq 0) { $response = Update-MgDirectoryOnPremiseSynchronization -Headers $customHeaders -OnPremisesDirectorySynchronizationId $OnPremisesDirectorySynchronizationId -BodyParameter $body $response } else { return } } }# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Connect-Entra { [CmdletBinding(DefaultParameterSetName = 'UserParameterSet')] param ( [Parameter(ParameterSetName = "UserParameterSet",Position = 1)] [System.String[]] $Scopes, [Parameter(ParameterSetName = "AppCertificateParameterSet",Position = 1)] [Parameter(ParameterSetName = "UserParameterSet")] [Parameter(ParameterSetName = "IdentityParameterSet")] [Alias("AppId", "ApplicationId")][System.String] $ClientId, [Parameter(ParameterSetName = "AppCertificateParameterSet")] [Parameter(ParameterSetName = "AppSecretCredentialParameterSet")] [Parameter(ParameterSetName = "UserParameterSet",Position = 4)] [Alias("Audience", "Tenant")][System.String] $TenantId, [Parameter(ParameterSetName = "AppCertificateParameterSet")] [Parameter(ParameterSetName = "AppSecretCredentialParameterSet")] [Parameter(ParameterSetName = "UserParameterSet")] [Parameter(ParameterSetName = "IdentityParameterSet")] [Parameter(ParameterSetName = "EnvironmentVariableParameterSet")] $ContextScope, [Parameter(ParameterSetName = "AppCertificateParameterSet")] [Parameter(ParameterSetName = "AppSecretCredentialParameterSet")] [Parameter(ParameterSetName = "AccessTokenParameterSet")] [Parameter(ParameterSetName = "UserParameterSet")] [Parameter(ParameterSetName = "IdentityParameterSet")] [Parameter(ParameterSetName = "EnvironmentVariableParameterSet")] [ValidateNotNullOrEmpty()] [Alias("EnvironmentName", "NationalCloud")][System.String] $Environment, [Parameter(ParameterSetName = "EnvironmentVariableParameterSet")] [Switch] $EnvironmentVariable, [Parameter(ParameterSetName = "UserParameterSet")] [Alias("UseDeviceAuthentication", "DeviceCode", "DeviceAuth", "Device")][System.Management.Automation.SwitchParameter] $UseDeviceCode, [Parameter(ParameterSetName = "AppCertificateParameterSet")] [Parameter(ParameterSetName = "AppSecretCredentialParameterSet")] [Parameter(ParameterSetName = "AccessTokenParameterSet")] [Parameter(ParameterSetName = "UserParameterSet")] [Parameter(ParameterSetName = "IdentityParameterSet")] [Parameter(ParameterSetName = "EnvironmentVariableParameterSet")] [ValidateNotNullOrEmpty()] [Double] $ClientTimeout, [Parameter()] [Switch] $NoWelcome, [Parameter(ParameterSetName = "IdentityParameterSet",Position = 1)] [Alias("ManagedIdentity", "ManagedServiceIdentity", "MSI")][System.Management.Automation.SwitchParameter] $Identity, [Parameter(ParameterSetName = "AppCertificateParameterSet",Position = 2)] [Alias("CertificateSubject", "CertificateName")][System.String] $CertificateSubjectName, [Parameter(ParameterSetName = "AppCertificateParameterSet",Position = 3)] [System.String] $CertificateThumbprint, [Parameter(ParameterSetName = "AppCertificateParameterSet")] [System.Security.Cryptography.X509Certificates.X509Certificate2] $Certificate, [Parameter(ParameterSetName = "AppSecretCredentialParameterSet")] [Alias("SecretCredential", "Credential")][System.Management.Automation.PSCredential] $ClientSecretCredential, [Parameter(ParameterSetName = "AccessTokenParameterSet",Position = 1)] [System.Security.SecureString] $AccessToken ) PROCESS { $params = @{} if ($null -ne $PSBoundParameters["Scopes"]) { $params["Scopes"] = $PSBoundParameters["Scopes"] } if ($null -ne $PSBoundParameters["ClientId"]) { $params["ClientId"] = $PSBoundParameters["ClientId"] } if ($null -ne $PSBoundParameters["TenantId"]) { $params["TenantId"] = $PSBoundParameters["TenantId"] } if ($null -ne $PSBoundParameters["ContextScope"]) { $params["ContextScope"] = $PSBoundParameters["ContextScope"] } if ($null -ne $PSBoundParameters["Environment"]) { $params["Environment"] = $PSBoundParameters["Environment"] } if ($PSBoundParameters.ContainsKey("EnvironmentVariable")) { $params["EnvironmentVariable"] = $PSBoundParameters["EnvironmentVariable"] } if ($null -ne $PSBoundParameters["UseDeviceCode"]) { $params["UseDeviceCode"] = $PSBoundParameters["UseDeviceCode"] } if ($null -ne $PSBoundParameters["ClientTimeout"]) { $params["ClientTimeout"] = $PSBoundParameters["ClientTimeout"] } if ($PSBoundParameters.ContainsKey("NoWelcome")) { $params["NoWelcome"] = $PSBoundParameters["NoWelcome"] } if ($PSBoundParameters.ContainsKey("Identity")) { $params["Identity"] = $PSBoundParameters["Identity"] } if ($null -ne $PSBoundParameters["CertificateSubjectName"]) { $params["CertificateSubjectName"] = $PSBoundParameters["CertificateSubjectName"] } if ($null -ne $PSBoundParameters["CertificateThumbprint"]) { $params["CertificateThumbprint"] = $PSBoundParameters["CertificateThumbprint"] } if ($null -ne $PSBoundParameters["Certificate"]) { $params["Certificate"] = $PSBoundParameters["Certificate"] } if ($null -ne $PSBoundParameters["ClientSecretCredential"]) { $params["ClientSecretCredential"] = $PSBoundParameters["ClientSecretCredential"] } if ($null -ne $PSBoundParameters["AccessToken"]) { $params["AccessToken"] = $PSBoundParameters["AccessToken"] } if($PSBoundParameters.ContainsKey("Verbose")) { $params["Verbose"] = $PSBoundParameters["Verbose"] } if($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } if($null -ne $PSBoundParameters["WarningVariable"]) { $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] } if($null -ne $PSBoundParameters["InformationVariable"]) { $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] } if($null -ne $PSBoundParameters["InformationAction"]) { $params["InformationAction"] = $PSBoundParameters["InformationAction"] } if($null -ne $PSBoundParameters["OutVariable"]) { $params["OutVariable"] = $PSBoundParameters["OutVariable"] } if($null -ne $PSBoundParameters["OutBuffer"]) { $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] } if($null -ne $PSBoundParameters["ErrorVariable"]) { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } if($null -ne $PSBoundParameters["PipelineVariable"]) { $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] } if($null -ne $PSBoundParameters["ErrorAction"]) { $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] } if($null -ne $PSBoundParameters["WarningAction"]) { $params["WarningAction"] = $PSBoundParameters["WarningAction"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") Connect-MgGraph @params } } Export-ModuleMember -Function @( 'Get-EntraIdentityProvider','Get-EntraServicePrincipalOAuth2PermissionGrant','Get-EntraApplicationExtensionProperty','Get-EntraApplicationServiceEndpoint','Get-EntraGroupPermissionGrant','Set-EntraIdentityProvider','Add-EntraGroupOwner','Revoke-EntraUserAllRefreshToken','Get-EntraGroup','Remove-EntraApplicationExtensionProperty','New-EntraUser','Remove-EntraGroupLifecyclePolicy','Get-EntraDomain','New-EntraDomain','Reset-EntraLifeCycleGroup','Get-EntraGroupMember','Remove-EntraTrustedCertificateAuthority','Get-EntraServicePrincipalAppRoleAssignment','New-EntraGroup','New-EntraDirectoryRoleAssignment','Select-EntraGroupIdsUserIsMemberOf','Get-EntraTrustedCertificateAuthority','Remove-EntraApplicationKeyCredential','Get-EntraUserLicenseDetail','Add-EntraServicePrincipalOwner','Remove-EntraApplicationKey','Get-EntraServicePrincipalDelegatedPermissionClassification','Remove-EntraServicePrincipalKeyCredential','Remove-EntraUser','Update-EntraSignedInUserPassword','Add-EntraDeviceRegisteredOwner','Set-EntraUserThumbnailPhoto','Get-EntraApplication','Set-EntraApplicationVerifiedPublisher','Get-EntraDeviceRegisteredUser','Add-EntraDirectoryRoleMember','Remove-EntraServicePrincipalDelegatedPermissionClassification','Get-EntraAuthorizationPolicy','Select-EntraGroupIdsServicePrincipalIsMemberOf','Set-EntraApplicationLogo','Get-EntraContactDirectReport','Add-EntraGroupMember','Remove-EntraConditionalAccessPolicy','Add-EntraServicePrincipalDelegatedPermissionClassification','Remove-EntraServicePrincipalAppRoleAssignment','Get-EntraDomainNameReference','Set-EntraConditionalAccessPolicy','Remove-EntraAdministrativeUnitMember','Get-EntraUserOAuth2PermissionGrant','Get-EntraOAuth2PermissionGrant','New-EntraIdentityProvider','Remove-EntraDeletedDirectoryObject','Revoke-EntraSignedInUserAllRefreshToken','Get-EntraContactMembership','New-EntraNamedLocationPolicy','Confirm-EntraDomain','Remove-EntraServicePrincipalOwner','Remove-EntraUserAppRoleAssignment','Remove-EntraDirectoryRoleAssignment','Remove-EntraIdentityProvider','Get-EntraDeletedApplication','Get-EntraExtensionProperty','Select-EntraGroupIdsGroupIsMemberOf','Remove-EntraDeviceRegisteredUser','Set-EntraGroup','Add-EntraLifecyclePolicyGroup','Get-EntraUserAppRoleAssignment','Remove-EntraAdministrativeUnit','Get-EntraDeletedGroup','Set-EntraAuthorizationPolicy','Remove-EntraGroupOwner','Remove-EntraDirectoryRoleDefinition','Remove-EntraApplicationPasswordCredential','Get-EntraServicePrincipalOwnedObject','Get-EntraDirectoryRoleAssignment','Get-EntraUserOwnedObject','Remove-EntraLifecyclePolicyGroup','Remove-EntraDomain','Get-EntraContact','Set-EntraGroupLifecyclePolicy','Get-EntraGroupAppRoleAssignment','Get-EntraDirectoryRoleDefinition','Get-EntraPermissionGrantConditionSet','Remove-EntraGroupMember','Get-EntraServicePrincipalCreatedObject','Get-EntraApplicationKeyCredential','Get-EntraServicePrincipalOwner','Get-EntraUserThumbnailPhoto','Get-EntraServicePrincipalKeyCredential','Remove-EntraDevice','Get-EntraUserExtension','Get-EntraUserCreatedObject','Set-EntraNamedLocationPolicy','Set-EntraDirectoryRoleDefinition','Get-EntraContactManager','Set-EntraPermissionGrantConditionSet','Get-EntraApplicationOwner','Remove-EntraScopedRoleMembership','Set-EntraUserExtension','Get-EntraLifecyclePolicyGroup','Get-EntraUserManager','New-EntraServicePrincipalAppRoleAssignment','Add-EntraApplicationOwner','Remove-EntraApplication','New-EntraGroupAppRoleAssignment','Add-EntraDeviceRegisteredUser','Set-EntraTrustedCertificateAuthority','Remove-EntraOAuth2PermissionGrant','Get-EntraUserOwnedDevice','Remove-EntraGroup','Set-EntraUserLicense','Remove-EntraApplicationVerifiedPublisher','New-EntraPermissionGrantConditionSet','Remove-EntraUserExtension','New-EntraApplicationKey','Get-EntraServicePrincipalMembership','New-EntraApplicationPassword','Get-EntraDomainVerificationDnsRecord','Remove-EntraGroupAppRoleAssignment','Get-EntraApplicationPasswordCredential','New-EntraDevice','Get-EntraDirectoryRoleTemplate','Set-EntraUserPassword','Get-EntraGroupOwner','Get-EntraPermissionGrantPolicy','Get-EntraDomainServiceConfigurationRecord','Restore-EntraDeletedDirectoryObject','Remove-EntraPermissionGrantPolicy','Get-EntraConditionalAccessPolicy','Get-EntraUserRegisteredDevice','Get-EntraContract','New-EntraDirectoryRoleDefinition','New-EntraTrustedCertificateAuthority','Set-EntraUser','Get-EntraUserDirectReport','Remove-EntraDirectoryRoleMember','Remove-EntraApplicationOwner','Set-EntraDomain','Remove-EntraNamedLocationPolicy','Set-EntraApplication','Get-EntraDevice','Get-EntraUser','New-EntraServicePrincipalPasswordCredential','Get-EntraGroupLifecyclePolicy','Get-EntraDeviceRegisteredOwner','Get-EntraNamedLocationPolicy','Remove-EntraDeletedApplication','Select-EntraGroupIdsContactIsMemberOf','Remove-EntraServicePrincipalPasswordCredential','Get-EntraObjectByObjectId','Remove-EntraContact','Get-EntraServicePrincipalAppRoleAssignedTo','Remove-EntraDeviceRegisteredOwner','New-EntraPermissionGrantPolicy','Set-EntraServicePrincipal','Remove-EntraPermissionGrantConditionSet','Get-EntraServicePrincipalPasswordCredential','Get-EntraDirectoryRoleMember','New-EntraGroupLifecyclePolicy','New-EntraConditionalAccessPolicy','Remove-EntraUserManager','New-EntraServicePrincipal','Get-EntraDirectoryRole','Get-EntraServicePrincipal','Set-EntraUserManager','Set-EntraTenantDetail','New-EntraApplicationExtensionProperty','New-EntraUserAppRoleAssignment','Get-EntraDeletedDirectoryObject','Get-EntraApplicationLogo','Set-EntraDevice','Set-EntraPermissionGrantPolicy','New-EntraApplication','Get-EntraSubscribedSku','Remove-EntraApplicationPassword','Get-EntraUserMembership','New-EntraApplicationKeyCredential','Enable-EntraDirectoryRole','Remove-EntraServicePrincipal','Restore-EntraDeletedApplication','New-EntraInvitation','Get-EntraTenantDetail','New-EntraApplicationPasswordCredential','Set-EntraServicePrincipal','Test-EntraScript','Get-EntraAccountSku','Update-EntraUserFromFederated','New-EntraAttributeSet','Add-EntraCustomSecurityAttributeDefinitionAllowedValue','Set-EntraFeatureRolloutPolicy','Get-EntraApplicationTemplate','New-EntraCustomSecurityAttributeDefinition','Set-EntraDirSyncConfiguration','Get-EntraPolicy','Remove-EntraAdministrativeUnitMember','Add-EntraEnvironment','Get-EntraEnvironment','Disconnect-Entra','Get-EntraDirSyncConfiguration','Get-EntraScopedRoleMembership','Set-EntraAttributeSet','Add-EntraScopedRoleMembership','New-EntraCustomHeaders','New-EntraFeatureRolloutPolicy','Set-EntraCustomSecurityAttributeDefinition','New-EntraAdministrativeUnit','Get-EntraFederationProperty','Get-EntraDomainFederationSettings','Set-EntraDomainFederationSettings','Remove-EntraScopedRoleMembership','Find-EntraPermission','Get-EntraPasswordPolicy','Get-EntraCustomSecurityAttributeDefinition','Remove-EntraFeatureRolloutPolicy','New-EntraApplicationFromApplicationTemplate','Get-EntraPartnerInformation','Get-EntraDirectoryObjectOnPremisesProvisioningError','Set-EntraAdministrativeUnit','Remove-EntraAdministrativeUnit','Get-EntraContext','Get-EntraCustomSecurityAttributeDefinitionAllowedValue','Add-EntraAdministrativeUnitMember','New-EntraOauth2PermissionGrant','Get-EntraAdministrativeUnit','Get-EntraDirSyncFeature','Get-EntraAttributeSet','Remove-EntraPolicy','Remove-EntraFeatureRolloutPolicyDirectoryObject','Get-EntraAuditSignInLog','New-EntraPolicy','Set-EntraCustomSecurityAttributeDefinitionAllowedValue','Set-EntraPolicy','Get-EntraObjectSetting','Get-EntraAdministrativeUnitMember','Get-EntraFeatureRolloutPolicy','Set-EntraPartnerInformation','Get-EntraAuditDirectoryLog','Set-EntraDirSyncFeature','Connect-Entra','Get-EntraUnsupportedCommand','Enable-EntraAzureADAlias' ) Set-Variable -name MISSING_CMDS -value @('Set-AzureADApplicationProxyApplicationSingleSignOn','Set-AzureADApplicationProxyConnector','Get-AzureADApplicationProxyConnectorGroupMember','Set-AzureADMSAdministrativeUnit','New-AzureADServicePrincipalKeyCredential','Set-AzureADApplicationProxyApplication','Get-AzureADApplicationProxyApplication','Get-AzureADDeviceConfiguration','Get-AzureADApplicationProxyConnectorMemberOf','Set-AzureADApplicationProxyApplicationCustomDomainCertificate','Remove-AzureADApplicationProxyConnectorGroup','Add-AzureADMSScopedRoleMembership','Get-AzureADContactThumbnailPhoto','Get-AzureADCurrentSessionInfo','New-AzureADMSAdministrativeUnit','Get-AzureADApplicationProxyConnectorGroup','Add-AzureADMSAdministrativeUnitMember','New-AzureADApplicationProxyApplication','Get-AzureADMSScopedRoleMembership','New-AzureADApplicationProxyConnectorGroup','Get-AzureADApplicationProxyConnector','Set-AzureADApplicationProxyConnectorGroup','Set-AzureADApplicationProxyApplicationConnectorGroup','Remove-AzureADApplicationProxyApplication','Remove-AzureADApplicationProxyApplicationConnectorGroup','Get-AzureADMSAdministrativeUnitMember','Get-AzureADApplicationProxyApplicationConnectorGroup','Remove-AzureADContactManager','Get-AzureADMSAdministrativeUnit') -Scope Script -Option ReadOnly -Force # ------------------------------------------------------------------------------ # Type definitios required for commands inputs # ------------------------------------------------------------------------------ $def = @" namespace Microsoft.Open.AzureAD.Graph.PowerShell.Custom { using System.Linq; public enum KeyType{ Symmetric = 0, AsymmetricX509Cert = 1, } public enum KeyUsage{ Sign = 0, Verify = 1, Decrypt = 2, Encrypt = 3, } } namespace Microsoft.Open.AzureAD.Model { using System.Linq; public class AlternativeSecurityId { public System.String IdentityProvider; public System.Byte[] Key; public System.Nullable<System.Int32> Type; } public class AppRole { public System.Collections.Generic.List<System.String> AllowedMemberTypes; public System.String Description; public System.String DisplayName; public System.String Id; public System.Nullable<System.Boolean> IsEnabled; public System.String Origin; public System.String Value; } public class AssignedLicense { public System.Collections.Generic.List<System.String> DisabledPlans; public System.String SkuId; } public class AssignedLicenses { public System.Collections.Generic.List<Microsoft.Open.AzureAD.Model.AssignedLicense> AddLicenses; public System.Collections.Generic.List<System.String> RemoveLicenses; } public class CertificateAuthorityInformation { public enum AuthorityTypeEnum{ RootAuthority = 0, IntermediateAuthority = 1, } public System.Nullable<AuthorityTypeEnum> AuthorityType; public System.String CrlDistributionPoint; public System.String DeltaCrlDistributionPoint; public System.Byte[] TrustedCertificate; public System.String TrustedIssuer; public System.String TrustedIssuerSki; } public class CrossCloudVerificationCodeBody { public System.String CrossCloudVerificationCode; public CrossCloudVerificationCodeBody() { } public CrossCloudVerificationCodeBody(System.String value) { CrossCloudVerificationCode = value; } } public class GroupIdsForMembershipCheck { public System.Collections.Generic.List<System.String> GroupIds; public GroupIdsForMembershipCheck() { } public GroupIdsForMembershipCheck(System.Collections.Generic.List<System.String> value) { GroupIds = value; } } public class KeyCredential { public System.Byte[] CustomKeyIdentifier; public System.Nullable<System.DateTime> EndDate; public System.String KeyId; public System.Nullable<System.DateTime> StartDate; public System.String Type; public System.String Usage; public System.Byte[] Value; } public class PasswordCredential { public System.Byte[] CustomKeyIdentifier; public System.Nullable<System.DateTime> EndDate; public System.String KeyId; public System.Nullable<System.DateTime> StartDate; public System.String Value; } public class PasswordProfile { public System.String Password; public System.Nullable<System.Boolean> ForceChangePasswordNextLogin; public System.Nullable<System.Boolean> EnforceChangePasswordPolicy; } public class PrivacyProfile { public System.String ContactEmail; public System.String StatementUrl; } public class SignInName { public System.String Type; public System.String Value; } } namespace Microsoft.Open.MSGraph.Model { using System.Linq; public class AddIn { public System.String Id; public System.String Type; public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.KeyValue> Properties; } public class ApiApplication { public System.Nullable<System.Boolean> AcceptMappedClaims; public System.Collections.Generic.List<System.String> KnownClientApplications; public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.PreAuthorizedApplication> PreAuthorizedApplications; public System.Nullable<System.Int32> RequestedAccessTokenVersion; public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.PermissionScope> Oauth2PermissionScopes; } public class AppRole { public System.Collections.Generic.List<System.String> AllowedMemberTypes; public System.String Description; public System.String DisplayName; public System.String Id; public System.Nullable<System.Boolean> IsEnabled; public System.String Origin; public System.String Value; } public class ConditionalAccessApplicationCondition { public System.Collections.Generic.List<System.String> IncludeApplications; public System.Collections.Generic.List<System.String> ExcludeApplications; public System.Collections.Generic.List<System.String> IncludeUserActions; public System.Collections.Generic.List<System.String> IncludeProtectionLevels; } public class ConditionalAccessApplicationEnforcedRestrictions { public System.Nullable<System.Boolean> IsEnabled; public ConditionalAccessApplicationEnforcedRestrictions() { } public ConditionalAccessApplicationEnforcedRestrictions(System.Nullable<System.Boolean> value) { IsEnabled = value; } } public class ConditionalAccessCloudAppSecurity { public enum CloudAppSecurityTypeEnum{ McasConfigured = 0, MonitorOnly = 1, BlockDownloads = 2, } public System.Nullable<CloudAppSecurityTypeEnum> CloudAppSecurityType; public System.Nullable<System.Boolean> IsEnabled; } public class ConditionalAccessConditionSet { public Microsoft.Open.MSGraph.Model.ConditionalAccessApplicationCondition Applications; public Microsoft.Open.MSGraph.Model.ConditionalAccessUserCondition Users; public Microsoft.Open.MSGraph.Model.ConditionalAccessPlatformCondition Platforms; public Microsoft.Open.MSGraph.Model.ConditionalAccessLocationCondition Locations; public enum ConditionalAccessRiskLevel{ Low = 0, Medium = 1, High = 2, Hidden = 3, None = 4, UnknownFutureValue = 5, } public System.Collections.Generic.List<ConditionalAccessRiskLevel> SignInRiskLevels; public enum ConditionalAccessClientApp{ All = 0, Browser = 1, MobileAppsAndDesktopClients = 2, ExchangeActiveSync = 3, EasSupported = 4, Other = 5, } public System.Collections.Generic.List<ConditionalAccessClientApp> ClientAppTypes; } public class ConditionalAccessGrantControls { public System.String _Operator; public enum ConditionalAccessGrantControl{ Block = 0, Mfa = 1, CompliantDevice = 2, DomainJoinedDevice = 3, ApprovedApplication = 4, CompliantApplication = 5, PasswordChange = 6, } public System.Collections.Generic.List<ConditionalAccessGrantControl> BuiltInControls; public System.Collections.Generic.List<System.String> CustomAuthenticationFactors; public System.Collections.Generic.List<System.String> TermsOfUse; } public class ConditionalAccessLocationCondition { public System.Collections.Generic.List<System.String> IncludeLocations; public System.Collections.Generic.List<System.String> ExcludeLocations; } public class ConditionalAccessPersistentBrowser { public enum ModeEnum{ Always = 0, Never = 1, } public System.Nullable<ModeEnum> Mode; public System.Nullable<System.Boolean> IsEnabled; } public class ConditionalAccessPlatformCondition { public enum ConditionalAccessDevicePlatforms{ Android = 0, IOS = 1, Windows = 2, WindowsPhone = 3, MacOS = 4, All = 5, } public System.Collections.Generic.List<ConditionalAccessDevicePlatforms> IncludePlatforms; public System.Collections.Generic.List<ConditionalAccessDevicePlatforms> ExcludePlatforms; } public class ConditionalAccessSessionControls { public Microsoft.Open.MSGraph.Model.ConditionalAccessApplicationEnforcedRestrictions ApplicationEnforcedRestrictions; public Microsoft.Open.MSGraph.Model.ConditionalAccessCloudAppSecurity CloudAppSecurity; public Microsoft.Open.MSGraph.Model.ConditionalAccessSignInFrequency SignInFrequency; public Microsoft.Open.MSGraph.Model.ConditionalAccessPersistentBrowser PersistentBrowser; } public class ConditionalAccessSignInFrequency { public enum TypeEnum{ Days = 0, Hours = 1, } public System.Nullable<TypeEnum> Type; public System.Nullable<System.Int32> Value; public System.Nullable<System.Boolean> IsEnabled; } public class ConditionalAccessUserCondition { public System.Collections.Generic.List<System.String> IncludeUsers; public System.Collections.Generic.List<System.String> ExcludeUsers; public System.Collections.Generic.List<System.String> IncludeGroups; public System.Collections.Generic.List<System.String> ExcludeGroups; public System.Collections.Generic.List<System.String> IncludeRoles; public System.Collections.Generic.List<System.String> ExcludeRoles; } public enum CountriesAndRegion{ AD = 0, AE = 1, AF = 2, AG = 3, AI = 4, AL = 5, AM = 6, AN = 7, AO = 8, AQ = 9, AR = 10, AS = 11, AT = 12, AU = 13, AW = 14, AX = 15, AZ = 16, BA = 17, BB = 18, BD = 19, BE = 20, BF = 21, BG = 22, BH = 23, BI = 24, BJ = 25, BL = 26, BM = 27, BN = 28, BO = 29, BQ = 30, BR = 31, BS = 32, BT = 33, BV = 34, BW = 35, BY = 36, BZ = 37, CA = 38, CC = 39, CD = 40, CF = 41, CG = 42, CH = 43, CI = 44, CK = 45, CL = 46, CM = 47, CN = 48, CO = 49, CR = 50, CU = 51, CV = 52, CW = 53, CX = 54, CY = 55, CZ = 56, DE = 57, DJ = 58, DK = 59, DM = 60, DO = 61, DZ = 62, EC = 63, EE = 64, EG = 65, EH = 66, ER = 67, ES = 68, ET = 69, FI = 70, FJ = 71, FK = 72, FM = 73, FO = 74, FR = 75, GA = 76, GB = 77, GD = 78, GE = 79, GF = 80, GG = 81, GH = 82, GI = 83, GL = 84, GM = 85, GN = 86, GP = 87, GQ = 88, GR = 89, GS = 90, GT = 91, GU = 92, GW = 93, GY = 94, HK = 95, HM = 96, HN = 97, HR = 98, HT = 99, HU = 100, ID = 101, IE = 102, IL = 103, IM = 104, IN = 105, IO = 106, IQ = 107, IR = 108, IS = 109, IT = 110, JE = 111, JM = 112, JO = 113, JP = 114, KE = 115, KG = 116, KH = 117, KI = 118, KM = 119, KN = 120, KP = 121, KR = 122, KW = 123, KY = 124, KZ = 125, LA = 126, LB = 127, LC = 128, LI = 129, LK = 130, LR = 131, LS = 132, LT = 133, LU = 134, LV = 135, LY = 136, MA = 137, MC = 138, MD = 139, ME = 140, MF = 141, MG = 142, MH = 143, MK = 144, ML = 145, MM = 146, MN = 147, MO = 148, MP = 149, MQ = 150, MR = 151, MS = 152, MT = 153, MU = 154, MV = 155, MW = 156, MX = 157, MY = 158, MZ = 159, NA = 160, NC = 161, NE = 162, NF = 163, NG = 164, NI = 165, NL = 166, NO = 167, NP = 168, NR = 169, NU = 170, NZ = 171, OM = 172, PA = 173, PE = 174, PF = 175, PG = 176, PH = 177, PK = 178, PL = 179, PM = 180, PN = 181, PR = 182, PS = 183, PT = 184, PW = 185, PY = 186, QA = 187, RE = 188, RO = 189, RS = 190, RU = 191, RW = 192, SA = 193, SB = 194, SC = 195, SD = 196, SE = 197, SG = 198, SH = 199, SI = 200, SJ = 201, SK = 202, SL = 203, SM = 204, SN = 205, SO = 206, SR = 207, SS = 208, ST = 209, SV = 210, SX = 211, SY = 212, SZ = 213, TC = 214, TD = 215, TF = 216, TG = 217, TH = 218, TJ = 219, TK = 220, TL = 221, TM = 222, TN = 223, TO = 224, TR = 225, TT = 226, TV = 227, TW = 228, TZ = 229, UA = 230, UG = 231, UM = 232, US = 233, UY = 234, UZ = 235, VA = 236, VC = 237, VE = 238, VG = 239, VI = 240, VN = 241, VU = 242, WF = 243, WS = 244, YE = 245, YT = 246, ZA = 247, ZM = 248, ZW = 249, } public class DefaultUserRolePermissions { public System.Nullable<System.Boolean> AllowedToCreateApps; public System.Nullable<System.Boolean> AllowedToCreateSecurityGroups; public System.Nullable<System.Boolean> AllowedToReadOtherUsers; public System.Collections.Generic.List<System.String> PermissionGrantPoliciesAssigned; } public class DelegatedPermissionClassification { public enum ClassificationEnum{ Low = 0, Medium = 1, High = 2, } public System.Nullable<ClassificationEnum> Classification; public System.String Id; public System.String PermissionId; public System.String PermissionName; } public class EmailAddress { public System.String Name; public System.String Address; } public class ImplicitGrantSettings { public System.Nullable<System.Boolean> EnableIdTokenIssuance; public System.Nullable<System.Boolean> EnableAccessTokenIssuance; } public class InformationalUrl { public System.String TermsOfServiceUrl; public System.String MarketingUrl; public System.String PrivacyStatementUrl; public System.String SupportUrl; public System.String LogoUrl; } public class InvitedUserMessageInfo { public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.Recipient> CcRecipients; public System.String CustomizedMessageBody; public System.String MessageLanguage; } public class IpRange { public System.String CidrAddress; public IpRange() { } public IpRange(System.String value) { CidrAddress = value; } } public class KeyCredential { public System.Byte[] CustomKeyIdentifier; public System.String DisplayName; public System.Nullable<System.DateTime> EndDateTime; public System.String KeyId; public System.Nullable<System.DateTime> StartDateTime; public System.String Type; public System.String Usage; public System.Byte[] Key; } public class KeyValue { public System.String Key; public System.String Value; } public class MsDirectoryObject { public System.String Id; public System.String OdataType; } public class MsRoleMemberInfo { public System.String Id; } public class OptionalClaim { public System.String Name; public System.String Source; public System.Nullable<System.Boolean> Essential; public System.Collections.Generic.List<System.String> AdditionalProperties; } public class OptionalClaims { public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.OptionalClaim> IdToken; public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.OptionalClaim> AccessToken; public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.OptionalClaim> Saml2Token; } public class ParentalControlSettings { public enum LegalAgeGroupRuleEnum{ Allow = 0, RequireConsentForPrivacyServices = 1, RequireConsentForMinors = 2, RequireConsentForKids = 3, BlockMinors = 4, } public System.Nullable<LegalAgeGroupRuleEnum> LegalAgeGroupRule; public System.Collections.Generic.List<System.String> CountriesBlockedForMinors; } public class PasswordCredential { public System.Byte[] CustomKeyIdentifier; public System.Nullable<System.DateTime> EndDateTime; public System.String DisplayName; public System.String KeyId; public System.Nullable<System.DateTime> StartDateTime; public System.String SecretText; public System.String Hint; } public class PermissionScope { public System.String AdminConsentDescription; public System.String AdminConsentDisplayName; public System.String Id; public System.Nullable<System.Boolean> IsEnabled; public System.String Type; public System.String UserConsentDescription; public System.String UserConsentDisplayName; public System.String Value; } public class PreAuthorizedApplication { public System.String AppId; public System.Collections.Generic.List<System.String> DelegatedPermissionIds; } public class PublicClientApplication { public System.Collections.Generic.List<System.String> RedirectUris; public PublicClientApplication() { } public PublicClientApplication(System.Collections.Generic.List<System.String> value) { RedirectUris = value; } } public class Recipient { public Microsoft.Open.MSGraph.Model.EmailAddress EmailAddress; public Recipient() { } public Recipient(Microsoft.Open.MSGraph.Model.EmailAddress value) { EmailAddress = value; } } public class RequiredResourceAccess { public System.String ResourceAppId; public System.Collections.Generic.List<Microsoft.Open.MSGraph.Model.ResourceAccess> ResourceAccess; } public class ResourceAccess { public System.String Id; public System.String Type; } public class RolePermission { public System.Collections.Generic.List<System.String> AllowedResourceActions; public System.String Condition; } public class SetVerifiedPublisherRequest { public System.String VerifiedPublisherId; public SetVerifiedPublisherRequest() { } public SetVerifiedPublisherRequest(System.String value) { VerifiedPublisherId = value; } } public class User { public System.String Id; public System.String OdataType; } public class WebApplication { public System.String HomePageUrl; public System.String LogoutUrl; public System.Collections.Generic.List<System.String> RedirectUris; public Microsoft.Open.MSGraph.Model.ImplicitGrantSettings ImplicitGrantSettings; } } "@ try{ Add-Type -TypeDefinition $def } catch{} # ------------------------------------------------------------------------------ # End of Type definitios required for commands inputs # ------------------------------------------------------------------------------ # SIG # Begin signature block # MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAZaq1uhMftso7f # wYuuMTobni/Pz+YJvBTC8i04e5kCJqCCDXYwggX0MIID3KADAgECAhMzAAADrzBA # DkyjTQVBAAAAAAOvMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD # VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy # b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p # bmcgUENBIDIwMTEwHhcNMjMxMTE2MTkwOTAwWhcNMjQxMTE0MTkwOTAwWjB0MQsw # CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u # ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy # b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB # AQDOS8s1ra6f0YGtg0OhEaQa/t3Q+q1MEHhWJhqQVuO5amYXQpy8MDPNoJYk+FWA # hePP5LxwcSge5aen+f5Q6WNPd6EDxGzotvVpNi5ve0H97S3F7C/axDfKxyNh21MG # 0W8Sb0vxi/vorcLHOL9i+t2D6yvvDzLlEefUCbQV/zGCBjXGlYJcUj6RAzXyeNAN # xSpKXAGd7Fh+ocGHPPphcD9LQTOJgG7Y7aYztHqBLJiQQ4eAgZNU4ac6+8LnEGAL # go1ydC5BJEuJQjYKbNTy959HrKSu7LO3Ws0w8jw6pYdC1IMpdTkk2puTgY2PDNzB # tLM4evG7FYer3WX+8t1UMYNTAgMBAAGjggFzMIIBbzAfBgNVHSUEGDAWBgorBgEE # AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQURxxxNPIEPGSO8kqz+bgCAQWGXsEw # RQYDVR0RBD4wPKQ6MDgxHjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEW # MBQGA1UEBRMNMjMwMDEyKzUwMTgyNjAfBgNVHSMEGDAWgBRIbmTlUAXTgqoXNzci # tW2oynUClTBUBgNVHR8ETTBLMEmgR6BFhkNodHRwOi8vd3d3Lm1pY3Jvc29mdC5j # b20vcGtpb3BzL2NybC9NaWNDb2RTaWdQQ0EyMDExXzIwMTEtMDctMDguY3JsMGEG # CCsGAQUFBwEBBFUwUzBRBggrBgEFBQcwAoZFaHR0cDovL3d3dy5taWNyb3NvZnQu # Y29tL3BraW9wcy9jZXJ0cy9NaWNDb2RTaWdQQ0EyMDExXzIwMTEtMDctMDguY3J0 # MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQELBQADggIBAISxFt/zR2frTFPB45Yd # mhZpB2nNJoOoi+qlgcTlnO4QwlYN1w/vYwbDy/oFJolD5r6FMJd0RGcgEM8q9TgQ # 2OC7gQEmhweVJ7yuKJlQBH7P7Pg5RiqgV3cSonJ+OM4kFHbP3gPLiyzssSQdRuPY # 1mIWoGg9i7Y4ZC8ST7WhpSyc0pns2XsUe1XsIjaUcGu7zd7gg97eCUiLRdVklPmp # XobH9CEAWakRUGNICYN2AgjhRTC4j3KJfqMkU04R6Toyh4/Toswm1uoDcGr5laYn # TfcX3u5WnJqJLhuPe8Uj9kGAOcyo0O1mNwDa+LhFEzB6CB32+wfJMumfr6degvLT # e8x55urQLeTjimBQgS49BSUkhFN7ois3cZyNpnrMca5AZaC7pLI72vuqSsSlLalG # OcZmPHZGYJqZ0BacN274OZ80Q8B11iNokns9Od348bMb5Z4fihxaBWebl8kWEi2O # PvQImOAeq3nt7UWJBzJYLAGEpfasaA3ZQgIcEXdD+uwo6ymMzDY6UamFOfYqYWXk # ntxDGu7ngD2ugKUuccYKJJRiiz+LAUcj90BVcSHRLQop9N8zoALr/1sJuwPrVAtx # HNEgSW+AKBqIxYWM4Ev32l6agSUAezLMbq5f3d8x9qzT031jMDT+sUAoCw0M5wVt # CUQcqINPuYjbS1WgJyZIiEkBMIIHejCCBWKgAwIBAgIKYQ6Q0gAAAAAAAzANBgkq # hkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x # EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv # bjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 # IDIwMTEwHhcNMTEwNzA4MjA1OTA5WhcNMjYwNzA4MjEwOTA5WjB+MQswCQYDVQQG # EwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwG # A1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSgwJgYDVQQDEx9NaWNyb3NvZnQg # Q29kZSBTaWduaW5nIFBDQSAyMDExMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC # CgKCAgEAq/D6chAcLq3YbqqCEE00uvK2WCGfQhsqa+laUKq4BjgaBEm6f8MMHt03 # a8YS2AvwOMKZBrDIOdUBFDFC04kNeWSHfpRgJGyvnkmc6Whe0t+bU7IKLMOv2akr # rnoJr9eWWcpgGgXpZnboMlImEi/nqwhQz7NEt13YxC4Ddato88tt8zpcoRb0Rrrg # OGSsbmQ1eKagYw8t00CT+OPeBw3VXHmlSSnnDb6gE3e+lD3v++MrWhAfTVYoonpy # 4BI6t0le2O3tQ5GD2Xuye4Yb2T6xjF3oiU+EGvKhL1nkkDstrjNYxbc+/jLTswM9 # sbKvkjh+0p2ALPVOVpEhNSXDOW5kf1O6nA+tGSOEy/S6A4aN91/w0FK/jJSHvMAh # dCVfGCi2zCcoOCWYOUo2z3yxkq4cI6epZuxhH2rhKEmdX4jiJV3TIUs+UsS1Vz8k # A/DRelsv1SPjcF0PUUZ3s/gA4bysAoJf28AVs70b1FVL5zmhD+kjSbwYuER8ReTB # w3J64HLnJN+/RpnF78IcV9uDjexNSTCnq47f7Fufr/zdsGbiwZeBe+3W7UvnSSmn # Eyimp31ngOaKYnhfsi+E11ecXL93KCjx7W3DKI8sj0A3T8HhhUSJxAlMxdSlQy90 # lfdu+HggWCwTXWCVmj5PM4TasIgX3p5O9JawvEagbJjS4NaIjAsCAwEAAaOCAe0w # ggHpMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBRIbmTlUAXTgqoXNzcitW2o # ynUClTAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYD # VR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBRyLToCMZBDuRQFTuHqp8cx0SOJNDBa # BgNVHR8EUzBRME+gTaBLhklodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2Ny # bC9wcm9kdWN0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3JsMF4GCCsG # AQUFBwEBBFIwUDBOBggrBgEFBQcwAoZCaHR0cDovL3d3dy5taWNyb3NvZnQuY29t # L3BraS9jZXJ0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3J0MIGfBgNV # HSAEgZcwgZQwgZEGCSsGAQQBgjcuAzCBgzA/BggrBgEFBQcCARYzaHR0cDovL3d3 # dy5taWNyb3NvZnQuY29tL3BraW9wcy9kb2NzL3ByaW1hcnljcHMuaHRtMEAGCCsG # AQUFBwICMDQeMiAdAEwAZQBnAGEAbABfAHAAbwBsAGkAYwB5AF8AcwB0AGEAdABl # AG0AZQBuAHQALiAdMA0GCSqGSIb3DQEBCwUAA4ICAQBn8oalmOBUeRou09h0ZyKb # C5YR4WOSmUKWfdJ5DJDBZV8uLD74w3LRbYP+vj/oCso7v0epo/Np22O/IjWll11l # hJB9i0ZQVdgMknzSGksc8zxCi1LQsP1r4z4HLimb5j0bpdS1HXeUOeLpZMlEPXh6 # I/MTfaaQdION9MsmAkYqwooQu6SpBQyb7Wj6aC6VoCo/KmtYSWMfCWluWpiW5IP0 # wI/zRive/DvQvTXvbiWu5a8n7dDd8w6vmSiXmE0OPQvyCInWH8MyGOLwxS3OW560 # STkKxgrCxq2u5bLZ2xWIUUVYODJxJxp/sfQn+N4sOiBpmLJZiWhub6e3dMNABQam # ASooPoI/E01mC8CzTfXhj38cbxV9Rad25UAqZaPDXVJihsMdYzaXht/a8/jyFqGa # J+HNpZfQ7l1jQeNbB5yHPgZ3BtEGsXUfFL5hYbXw3MYbBL7fQccOKO7eZS/sl/ah # XJbYANahRr1Z85elCUtIEJmAH9AAKcWxm6U/RXceNcbSoqKfenoi+kiVH6v7RyOA # 9Z74v2u3S5fi63V4GuzqN5l5GEv/1rMjaHXmr/r8i+sLgOppO6/8MO0ETI7f33Vt # Y5E90Z1WTk+/gFcioXgRMiF670EKsT/7qMykXcGhiJtXcVZOSEXAQsmbdlsKgEhr # /Xmfwb1tbWrJUnMTDXpQzTGCGgowghoGAgEBMIGVMH4xCzAJBgNVBAYTAlVTMRMw # EQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN # aWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNp # Z25pbmcgUENBIDIwMTECEzMAAAOvMEAOTKNNBUEAAAAAA68wDQYJYIZIAWUDBAIB # BQCgga4wGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEO # MAwGCisGAQQBgjcCARUwLwYJKoZIhvcNAQkEMSIEIARnk5v9ZplGEfAg4/9hSFlL # LmMKxO2EatusPc0nUBdVMEIGCisGAQQBgjcCAQwxNDAyoBSAEgBNAGkAYwByAG8A # cwBvAGYAdKEagBhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20wDQYJKoZIhvcNAQEB # BQAEggEAEJrDhYuyk9kFyyApOokkcO7z5pgh/6wPbh3XBOg90IhEq1LANMNXWXy1 # ovZSgeotyGdmFhZ4NGGcR4sMMgvYoioe5+gwzmAj2IAlTO1CP33Uts2OFEdYXk7b # kgNO2zt01mwl/FKdkMZN+ICljDJiHnpZNnYfQfIR39SZJgUhIMw8EXuzWdmG0jFm # AF8PhxS1eAQm6hOrh67WbcwmhyzGH6uw+haJiH+BNJvEGRj1ACePKuXJvgWt7/Lg # 2gdzpEkrIuME/GofIfD10It1CoVD/CyDzq81S3eGkOYvHvSzYHAT00ctTxdHs0vc # BqnV3YyEErxgIDdF7NJOLcZW5cIpOqGCF5QwgheQBgorBgEEAYI3AwMBMYIXgDCC # F3wGCSqGSIb3DQEHAqCCF20wghdpAgEDMQ8wDQYJYIZIAWUDBAIBBQAwggFSBgsq # hkiG9w0BCRABBKCCAUEEggE9MIIBOQIBAQYKKwYBBAGEWQoDATAxMA0GCWCGSAFl # AwQCAQUABCAmFK28cyDlQDI9ys05RtcqU213KSHsF+avhVDCFh42kwIGZr3zCPBc # GBMyMDI0MDkwNTE2MjQzNy43NDZaMASAAgH0oIHRpIHOMIHLMQswCQYDVQQGEwJV # UzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UE # ChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSUwIwYDVQQLExxNaWNyb3NvZnQgQW1l # cmljYSBPcGVyYXRpb25zMScwJQYDVQQLEx5uU2hpZWxkIFRTUyBFU046OTIwMC0w # NUUwLUQ5NDcxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2Wg # ghHqMIIHIDCCBQigAwIBAgITMwAAAecujy+TC08b6QABAAAB5zANBgkqhkiG9w0B # AQsFADB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UE # BxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYD # VQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDAeFw0yMzEyMDYxODQ1 # MTlaFw0yNTAzMDUxODQ1MTlaMIHLMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2Fz # aGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENv # cnBvcmF0aW9uMSUwIwYDVQQLExxNaWNyb3NvZnQgQW1lcmljYSBPcGVyYXRpb25z # MScwJQYDVQQLEx5uU2hpZWxkIFRTUyBFU046OTIwMC0wNUUwLUQ5NDcxJTAjBgNV # BAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2UwggIiMA0GCSqGSIb3DQEB # AQUAA4ICDwAwggIKAoICAQDCV58v4IuQ659XPM1DtaWMv9/HRUC5kdiEF89YBP6/ # Rn7kjqMkZ5ESemf5Eli4CLtQVSefRpF1j7S5LLKisMWOGRaLcaVbGTfcmI1vMRJ1 # tzMwCNIoCq/vy8WH8QdV1B/Ab5sK+Q9yIvzGw47TfXPE8RlrauwK/e+nWnwMt060 # akEZiJJz1Vh1LhSYKaiP9Z23EZmGETCWigkKbcuAnhvh3yrMa89uBfaeHQZEHGQq # dskM48EBcWSWdpiSSBiAxyhHUkbknl9PPztB/SUxzRZjUzWHg9bf1mqZ0cIiAWC0 # EjK7ONhlQfKSRHVLKLNPpl3/+UL4Xjc0Yvdqc88gOLUr/84T9/xK5r82ulvRp2A8 # /ar9cG4W7650uKaAxRAmgL4hKgIX5/0aIAsbyqJOa6OIGSF9a+DfXl1LpQPNKR79 # 2scF7tjD5WqwIuifS9YUiHMvRLjjKk0SSCV/mpXC0BoPkk5asfxrrJbCsJePHSOE # blpJzRmzaP6OMXwRcrb7TXFQOsTkKuqkWvvYIPvVzC68UM+MskLPld1eqdOOMK7S # bbf2tGSZf3+iOwWQMcWXB9gw5gK3AIYK08WkJJuyzPqfitgubdRCmYr9CVsNOuW+ # wHDYGhciJDF2LkrjkFUjUcXSIJd9f2ssYitZ9CurGV74BQcfrxjvk1L8jvtN7mul # IwIDAQABo4IBSTCCAUUwHQYDVR0OBBYEFM/+4JiAnzY4dpEf/Zlrh1K73o9YMB8G # A1UdIwQYMBaAFJ+nFV0AXmJdg/Tl0mWnG1M1GelyMF8GA1UdHwRYMFYwVKBSoFCG # Tmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY3Jvc29mdCUy # MFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEwKDEpLmNybDBsBggrBgEFBQcBAQRgMF4w # XAYIKwYBBQUHMAKGUGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvY2Vy # dHMvTWljcm9zb2Z0JTIwVGltZS1TdGFtcCUyMFBDQSUyMDIwMTAoMSkuY3J0MAwG # A1UdEwEB/wQCMAAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwgwDgYDVR0PAQH/BAQD # AgeAMA0GCSqGSIb3DQEBCwUAA4ICAQB0ofDbk+llWi1cC6nsfie5Jtp09o6b6ARC # pvtDPq2KFP+hi+UNNP7LGciKuckqXCmBTFIhfBeGSxvk6ycokdQr3815pEOaYWTn # HvQ0+8hKy86r1F4rfBu4oHB5cTy08T4ohrG/OYG/B/gNnz0Ol6v7u/qEjz48zXZ6 # ZlxKGyZwKmKZWaBd2DYEwzKpdLkBxs6A6enWZR0jY+q5FdbV45ghGTKgSr5ECAOn # LD4njJwfjIq0mRZWwDZQoXtJSaVHSu2lHQL3YHEFikunbUTJfNfBDLL7Gv+sTmRi # DZky5OAxoLG2gaTfuiFbfpmSfPcgl5COUzfMQnzpKfX6+FkI0QQNvuPpWsDU8sR+ # uni2VmDo7rmqJrom4ihgVNdLaMfNUqvBL5ZiSK1zmaELBJ9a+YOjE5pmSarW5sGb # n7iVkF2W9JQIOH6tGWLFJS5Hs36zahkoHh8iD963LeGjZqkFusKaUW72yMj/yxTe # GEDOoIr35kwXxr1Uu+zkur2y+FuNY0oZjppzp95AW1lehP0xaO+oBV1XfvaCur/B # 5PVAp2xzrosMEUcAwpJpio+VYfIufGj7meXcGQYWA8Umr8K6Auo+Jlj8IeFS6lSv # KhqQpmdBzAMGqPOQKt1Ow3ZXxehK7vAiim3ZiALlM0K546k0sZrxdZPgpmz7O8w9 # gHLuyZAQezCCB3EwggVZoAMCAQICEzMAAAAVxedrngKbSZkAAAAAABUwDQYJKoZI # hvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAw # DgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x # MjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAy # MDEwMB4XDTIxMDkzMDE4MjIyNVoXDTMwMDkzMDE4MzIyNVowfDELMAkGA1UEBhMC # VVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNV # BAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRp # bWUtU3RhbXAgUENBIDIwMTAwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC # AQDk4aZM57RyIQt5osvXJHm9DtWC0/3unAcH0qlsTnXIyjVX9gF/bErg4r25Phdg # M/9cT8dm95VTcVrifkpa/rg2Z4VGIwy1jRPPdzLAEBjoYH1qUoNEt6aORmsHFPPF # dvWGUNzBRMhxXFExN6AKOG6N7dcP2CZTfDlhAnrEqv1yaa8dq6z2Nr41JmTamDu6 # GnszrYBbfowQHJ1S/rboYiXcag/PXfT+jlPP1uyFVk3v3byNpOORj7I5LFGc6XBp # Dco2LXCOMcg1KL3jtIckw+DJj361VI/c+gVVmG1oO5pGve2krnopN6zL64NF50Zu # yjLVwIYwXE8s4mKyzbnijYjklqwBSru+cakXW2dg3viSkR4dPf0gz3N9QZpGdc3E # XzTdEonW/aUgfX782Z5F37ZyL9t9X4C626p+Nuw2TPYrbqgSUei/BQOj0XOmTTd0 # lBw0gg/wEPK3Rxjtp+iZfD9M269ewvPV2HM9Q07BMzlMjgK8QmguEOqEUUbi0b1q # GFphAXPKZ6Je1yh2AuIzGHLXpyDwwvoSCtdjbwzJNmSLW6CmgyFdXzB0kZSU2LlQ # +QuJYfM2BjUYhEfb3BvR/bLUHMVr9lxSUV0S2yW6r1AFemzFER1y7435UsSFF5PA # PBXbGjfHCBUYP3irRbb1Hode2o+eFnJpxq57t7c+auIurQIDAQABo4IB3TCCAdkw # EgYJKwYBBAGCNxUBBAUCAwEAATAjBgkrBgEEAYI3FQIEFgQUKqdS/mTEmr6CkTxG # NSnPEP8vBO4wHQYDVR0OBBYEFJ+nFV0AXmJdg/Tl0mWnG1M1GelyMFwGA1UdIARV # MFMwUQYMKwYBBAGCN0yDfQEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly93d3cubWlj # cm9zb2Z0LmNvbS9wa2lvcHMvRG9jcy9SZXBvc2l0b3J5Lmh0bTATBgNVHSUEDDAK # BggrBgEFBQcDCDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMC # AYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvX # zpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20v # cGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYI # KwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j # b20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDANBgkqhkiG # 9w0BAQsFAAOCAgEAnVV9/Cqt4SwfZwExJFvhnnJL/Klv6lwUtj5OR2R4sQaTlz0x # M7U518JxNj/aZGx80HU5bbsPMeTCj/ts0aGUGCLu6WZnOlNN3Zi6th542DYunKmC # VgADsAW+iehp4LoJ7nvfam++Kctu2D9IdQHZGN5tggz1bSNU5HhTdSRXud2f8449 # xvNo32X2pFaq95W2KFUn0CS9QKC/GbYSEhFdPSfgQJY4rPf5KYnDvBewVIVCs/wM # nosZiefwC2qBwoEZQhlSdYo2wh3DYXMuLGt7bj8sCXgU6ZGyqVvfSaN0DLzskYDS # PeZKPmY7T7uG+jIa2Zb0j/aRAfbOxnT99kxybxCrdTDFNLB62FD+CljdQDzHVG2d # Y3RILLFORy3BFARxv2T5JL5zbcqOCb2zAVdJVGTZc9d/HltEAY5aGZFrDZ+kKNxn # GSgkujhLmm77IVRrakURR6nxt67I6IleT53S0Ex2tVdUCbFpAUR+fKFhbHP+Crvs # QWY9af3LwUFJfn6Tvsv4O+S3Fb+0zj6lMVGEvL8CwYKiexcdFYmNcP7ntdAoGokL # jzbaukz5m/8K6TT4JDVnK+ANuOaMmdbhIurwJ0I9JZTmdHRbatGePu1+oDEzfbzL # 6Xu/OHBE0ZDxyKs6ijoIYn/ZcGNTTY3ugm2lBRDBcQZqELQdVTNYs6FwZvKhggNN # MIICNQIBATCB+aGB0aSBzjCByzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hp # bmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jw # b3JhdGlvbjElMCMGA1UECxMcTWljcm9zb2Z0IEFtZXJpY2EgT3BlcmF0aW9uczEn # MCUGA1UECxMeblNoaWVsZCBUU1MgRVNOOjkyMDAtMDVFMC1EOTQ3MSUwIwYDVQQD # ExxNaWNyb3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNloiMKAQEwBwYFKw4DAhoDFQCz # cgTnGasSwe/dru+cPe1NF/vwQ6CBgzCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYD # VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy # b3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1w # IFBDQSAyMDEwMA0GCSqGSIb3DQEBCwUAAgUA6oQfFzAiGA8yMDI0MDkwNTEyMTQx # NVoYDzIwMjQwOTA2MTIxNDE1WjB0MDoGCisGAQQBhFkKBAExLDAqMAoCBQDqhB8X # AgEAMAcCAQACAkU4MAcCAQACAhM9MAoCBQDqhXCXAgEAMDYGCisGAQQBhFkKBAIx # KDAmMAwGCisGAQQBhFkKAwKgCjAIAgEAAgMHoSChCjAIAgEAAgMBhqAwDQYJKoZI # hvcNAQELBQADggEBAC6xhfMZVn1RXzHn/9u1sBVMs+cRSKZieIQmWL3+r9K/RIUi # nfgnaSW4FWKq0Is8E5FEG+67x3oM8TREwGmv5XxO2UkC5X9bLsipxlRfRCLcJ9Ui # r1gu5Qf3OPiRB2h+RFq85kOBiaWYDE2oxgGfIuQo0Ms8rHDWOjoi54z6TWy42jUu # 5iWJjEOZTc6t83aGUYNfQsES/LGyaT15XNlL4bDUndMikV8nqCDHpR9rtYuqP8jA # A8KbNrzlV4nM1mKevm9hhMIUm4B7Ri7PHVQwEP53RNoorqtle1qA9AVIWfuGVEJ2 # pXCSmsK2OnMeMpGflhhy5Rk+2Fy1MrgBLYstxEAxggQNMIIECQIBATCBkzB8MQsw # CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u # ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNy # b3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAAecujy+TC08b6QABAAAB5zAN # BglghkgBZQMEAgEFAKCCAUowGgYJKoZIhvcNAQkDMQ0GCyqGSIb3DQEJEAEEMC8G # CSqGSIb3DQEJBDEiBCAd5zl5CwxL0uHdmGGPA7OP7E3wIwKb8sC4GP5PMBo1vDCB # +gYLKoZIhvcNAQkQAi8xgeowgecwgeQwgb0EIOU2XQ12aob9DeDFXM9UFHeEX74F # v0ABvQMG7qC51nOtMIGYMIGApH4wfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldh # c2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBD # b3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIw # MTACEzMAAAHnLo8vkwtPG+kAAQAAAecwIgQg3GUSLjH1QwQ7zoQySb0Y+a5fY1Yt # C0Yn6fdxFUHOxOgwDQYJKoZIhvcNAQELBQAEggIAHkSqRVJyTZTS0Eb6A9bXhDK3 # kT3eF+4h90XfTpT8BN4mDi/J4ap4bKII6ptqEKF9cTm5N0sIDEOM1VNWCsMlxOik # rv/y1mRsTiuZIjPGdwfJihSDqpjt16ziYnwD4ejAvlR7H9kT8aRXX63BklcFO2q+ # i7D97kyD1+HT5JzFDB+NVqYvkF57ascA8+3cT04mceho7BNQXac0nHSDhHE7v18Y # WkwcIUYYnk/n+R5efJVJp5M2vLiIKqOrYuBj0Z82/pDnx08D63TleVvGeReQzeRi # 7eOhCdXqygoVEv8AlfLxD/RH73NS5CrHIxo8WelKugM25WUMyvtxIcvURKtibQf4 # CXA6WJtGSLMKo/0+SYT2gMLMQx78F7dFN9Mv1ZUy8EfHEOCwQAzmFPYC6+Y16jM6 # osbO5uryDz+a7SDsgXReIpPPB404FO844w09xX3o2Sw2fnsD1VM3OSDgc/PmxSbx # yOn0+6x+8RmFEhV89yIzkTAKiEXI1ysfB5qgUe6lWyqU8u2p43lLlu5iFumkwJm+ # 8yj5WdThImZo84YVcedAcakLZ+NwAgq+V7wFnM6CHyX+rvNXGjKqGQnVrznRqz2d # r14PiSAW6Nkiivdvp1skuD+Gp7umb1uXp68I8PLWnzHEul1iqDouhOzcACi8K+eh # +nTcLtKsm3VpE0qA+/U= # SIG # End signature block |