diff --git a/entra-powershell b/entra-powershell new file mode 160000 index 000000000..9d4e2e265 --- /dev/null +++ b/entra-powershell @@ -0,0 +1 @@ +Subproject commit 9d4e2e2656cbe75b6558e2034153f95bda85ec11 diff --git a/module/Entra/AdditionalFunctions/Add-EntraAdministrativeUnitMember.ps1 b/module/Entra/AdditionalFunctions/Add-EntraAdministrativeUnitMember.ps1 index 60ff8523c..f4522dfbf 100644 --- a/module/Entra/AdditionalFunctions/Add-EntraAdministrativeUnitMember.ps1 +++ b/module/Entra/AdditionalFunctions/Add-EntraAdministrativeUnitMember.ps1 @@ -6,16 +6,17 @@ function Add-EntraAdministrativeUnitMember { param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $RefObjectId, + [Alias('ObjectId')] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId + [System.String] $AdministrativeUnitId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] $Uri = "/v1.0/directory/administrativeUnits/$($params.AdministrativeUnitId)/members/" + '$ref' } if($null -ne $PSBoundParameters["RefObjectId"]) diff --git a/module/Entra/AdditionalFunctions/Add-EntraScopedRoleMembership.ps1 b/module/Entra/AdditionalFunctions/Add-EntraScopedRoleMembership.ps1 index c98b25f99..1b0b769be 100644 --- a/module/Entra/AdditionalFunctions/Add-EntraScopedRoleMembership.ps1 +++ b/module/Entra/AdditionalFunctions/Add-EntraScopedRoleMembership.ps1 @@ -3,9 +3,10 @@ # ------------------------------------------------------------------------------ function Add-EntraScopedRoleMembership { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] - param ( + param ( + [Alias("ObjectId")] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [System.String] $AdministrativeUnitId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $RoleObjectId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] @@ -17,9 +18,9 @@ function Add-EntraScopedRoleMembership { $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] $Uri = "/v1.0/directory/administrativeUnits/$($params.AdministrativeUnitId)/scopedRoleMembers" } if($null -ne $PSBoundParameters["RoleObjectId"]) diff --git a/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnit.ps1 b/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnit.ps1 index ad9673a5a..849b52436 100644 --- a/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnit.ps1 +++ b/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnit.ps1 @@ -4,41 +4,42 @@ 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.Int32] $Top, - [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [switch] $All, - [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $Filter + [Alias("ObjectId")] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $AdministrativeUnitId, + [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 = @{} - $topCount = $null - $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" + $params = @{} + $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand + $baseUri = "/v1.0/directory/administrativeUnits" + $properties = '$select=*' + $params["Uri"] = "$baseUri/?$properties" + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) + { + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] + $params["Uri"] = "$baseUri/$($params.AdministrativeUnitId)?$properties" + } + if ($PSBoundParameters.ContainsKey("Top")) { + $topCount = $PSBoundParameters["Top"] + if ($topCount -gt 999) { + $params["Uri"] += "&`$top=999" } - if ($PSBoundParameters.ContainsKey("Top")) { - $topCount = $PSBoundParameters["Top"] - if ($topCount -gt 999) { - $params["Uri"] += "&`$top=999" - } - else { - $params["Uri"] += "&`$top=$topCount" - } - } - if ($null -ne $PSBoundParameters["Filter"]) { - $Filter = $PSBoundParameters["Filter"] - $f = '$' + 'Filter' - $params["Uri"] += "&$f=$Filter" + else { + $params["Uri"] += "&`$top=$topCount" } + } + if ($null -ne $PSBoundParameters["Filter"]) { + $Filter = $PSBoundParameters["Filter"] + $f = '$' + 'Filter' + $params["Uri"] += "&$f=$Filter" + } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug diff --git a/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnitMember.ps1 b/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnitMember.ps1 index 0007a082d..7bb91f323 100644 --- a/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnitMember.ps1 +++ b/module/Entra/AdditionalFunctions/Get-EntraAdministrativeUnitMember.ps1 @@ -3,23 +3,25 @@ # ------------------------------------------------------------------------------ function Get-EntraAdministrativeUnitMember { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] - param ( - [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.Int32] $Top, - [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, - [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [switch] $All + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $AdministrativeUnitId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All ) PROCESS { $params = @{} $topCount = $null $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - $baseUri = "/v1.0/directory/administrativeUnits/$ObjectId/members?`$select=*" + $baseUri = "/v1.0/directory/administrativeUnits/$AdministrativeUnitId/members?`$select=*" $params["Uri"] = "$baseUri" - if ($null -ne $PSBoundParameters["ObjectId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) + { + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } if ($PSBoundParameters.ContainsKey("Top")) { $topCount = $PSBoundParameters["Top"] diff --git a/module/Entra/AdditionalFunctions/Get-EntraAttributeSet.ps1 b/module/Entra/AdditionalFunctions/Get-EntraAttributeSet.ps1 index 15ab2fe0a..cdccf1849 100644 --- a/module/Entra/AdditionalFunctions/Get-EntraAttributeSet.ps1 +++ b/module/Entra/AdditionalFunctions/Get-EntraAttributeSet.ps1 @@ -6,7 +6,8 @@ function Get-EntraAttributeSet { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $Id + [Alias("Id")] + [System.String] $AttributeSetId ) PROCESS { @@ -14,8 +15,8 @@ function Get-EntraAttributeSet { $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 + if ($null -ne $PSBoundParameters["AttributeSetId"]) { + $params["Uri"] += $AttributeSetId } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug diff --git a/module/Entra/AdditionalFunctions/Get-EntraAuditSignInLog.ps1 b/module/Entra/AdditionalFunctions/Get-EntraAuditSignInLog.ps1 index 95ff8dfe8..5686e768d 100644 --- a/module/Entra/AdditionalFunctions/Get-EntraAuditSignInLog.ps1 +++ b/module/Entra/AdditionalFunctions/Get-EntraAuditSignInLog.ps1 @@ -6,7 +6,8 @@ function Get-EntraAuditSignInLog { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(ParameterSetName = "GetById", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $Id, + [Alias("Id")] + [System.String] $SignInId, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Int32] $Top, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] @@ -35,9 +36,9 @@ function Get-EntraAuditSignInLog { } } - if($null -ne $PSBoundParameters["Id"]) + if($null -ne $PSBoundParameters["SignInId"]) { - $logId = $PSBoundParameters["Id"] + $logId = $PSBoundParameters["SignInId"] $params["Uri"] = "$baseUri/$($logId)" } if($null -ne $PSBoundParameters["Filter"]) diff --git a/module/Entra/AdditionalFunctions/Get-EntraDirectoryObjectOnPremisesProvisioningError.ps1 b/module/Entra/AdditionalFunctions/Get-EntraDirectoryObjectOnPremisesProvisioningError.ps1 index dea107f48..5d1d03af9 100644 --- a/module/Entra/AdditionalFunctions/Get-EntraDirectoryObjectOnPremisesProvisioningError.ps1 +++ b/module/Entra/AdditionalFunctions/Get-EntraDirectoryObjectOnPremisesProvisioningError.ps1 @@ -36,3 +36,5 @@ function Get-EntraDirectoryObjectOnPremisesProvisioningError { } } +Set-Alias -Name Get-EntraHasObjectsWithDirSyncProvisioningError -Value Get-EntraDirectoryObjectOnPremisesProvisioningError -Scope Global -Force + diff --git a/module/Entra/AdditionalFunctions/Get-EntraScopedRoleMembership.ps1 b/module/Entra/AdditionalFunctions/Get-EntraScopedRoleMembership.ps1 index bb1be8800..3324e6a0b 100644 --- a/module/Entra/AdditionalFunctions/Get-EntraScopedRoleMembership.ps1 +++ b/module/Entra/AdditionalFunctions/Get-EntraScopedRoleMembership.ps1 @@ -4,8 +4,9 @@ function Get-EntraScopedRoleMembership { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( + [Alias("ObjectId")] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [System.String] $AdministrativeUnitId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ScopedRoleMembershipId ) @@ -15,9 +16,9 @@ function Get-EntraScopedRoleMembership { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $isList = $false $baseUri = "https://graph.microsoft.com/v1.0/directory/administrativeUnits" - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] $uri = $baseUri + "/$($params.AdministrativeUnitId)/scopedRoleMembers" $params["Uri"] = $uri $isList = $true diff --git a/module/Entra/AdditionalFunctions/New-EntraAttributeSet.ps1 b/module/Entra/AdditionalFunctions/New-EntraAttributeSet.ps1 index 6e18e5af6..97e1a671c 100644 --- a/module/Entra/AdditionalFunctions/New-EntraAttributeSet.ps1 +++ b/module/Entra/AdditionalFunctions/New-EntraAttributeSet.ps1 @@ -6,7 +6,8 @@ function New-EntraAttributeSet { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] - [System.String] $Id, + [Alias("Id")] + [System.String] $AttributeSetId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] @@ -20,8 +21,8 @@ function New-EntraAttributeSet { $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["AttributeSetId"]) { + $body["id"] = $PSBoundParameters["AttributeSetId"] } if ($null -ne $PSBoundParameters["Description"]) { $body["description"] = $PSBoundParameters["Description"] diff --git a/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnit.ps1 b/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnit.ps1 index 6ac11fe9f..2812f2fe1 100644 --- a/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnit.ps1 +++ b/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnit.ps1 @@ -4,16 +4,17 @@ function Remove-EntraAdministrativeUnit { [CmdletBinding(DefaultParameterSetName = '')] param ( + [Alias("ObjectId")] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId + [System.String] $AdministrativeUnitId ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } Write-Debug("============================ TRANSFORMATIONS ============================") diff --git a/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnitMember.ps1 b/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnitMember.ps1 index fdfcd21d0..f8daf219e 100644 --- a/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnitMember.ps1 +++ b/module/Entra/AdditionalFunctions/Remove-EntraAdministrativeUnitMember.ps1 @@ -4,8 +4,9 @@ function Remove-EntraAdministrativeUnitMember { [CmdletBinding(DefaultParameterSetName = '')] param ( + [Alias("ObjectId")] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [System.String] $AdministrativeUnitId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $MemberId ) @@ -13,9 +14,9 @@ function Remove-EntraAdministrativeUnitMember { PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } if($null -ne $PSBoundParameters["MemberId"]) { @@ -26,7 +27,7 @@ function Remove-EntraAdministrativeUnitMember { $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") - $uri = "/v1.0/directory/administrativeUnits/$ObjectId/members/$MemberId/`$ref" + $uri = "/v1.0/directory/administrativeUnits/$AdministrativeUnitId/members/$MemberId/`$ref" $params["Uri"] = $uri $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method DELETE diff --git a/module/Entra/AdditionalFunctions/Remove-EntraScopedRoleMembership.ps1 b/module/Entra/AdditionalFunctions/Remove-EntraScopedRoleMembership.ps1 index 30640e1a7..9aca2cd2b 100644 --- a/module/Entra/AdditionalFunctions/Remove-EntraScopedRoleMembership.ps1 +++ b/module/Entra/AdditionalFunctions/Remove-EntraScopedRoleMembership.ps1 @@ -4,8 +4,9 @@ function Remove-EntraScopedRoleMembership { [CmdletBinding(DefaultParameterSetName = '')] param ( + [Alias("ObjectId")] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [System.String] $AdministrativeUnitId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ScopedRoleMembershipId ) @@ -13,9 +14,9 @@ function Remove-EntraScopedRoleMembership { PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } if($null -ne $PSBoundParameters["ScopedRoleMembershipId"]) { diff --git a/module/Entra/AdditionalFunctions/Set-EntraAdministrativeUnit.ps1 b/module/Entra/AdditionalFunctions/Set-EntraAdministrativeUnit.ps1 index 1eb234695..dc9b7c703 100644 --- a/module/Entra/AdditionalFunctions/Set-EntraAdministrativeUnit.ps1 +++ b/module/Entra/AdditionalFunctions/Set-EntraAdministrativeUnit.ps1 @@ -4,8 +4,9 @@ function Set-EntraAdministrativeUnit { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( + [Alias("ObjectId")] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [System.String] $AdministrativeUnitId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] @@ -17,9 +18,9 @@ function Set-EntraAdministrativeUnit { $body = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } if($null -ne $PSBoundParameters["DisplayName"]) { diff --git a/module/Entra/AdditionalFunctions/Set-EntraAttributeSet.ps1 b/module/Entra/AdditionalFunctions/Set-EntraAttributeSet.ps1 index a1a763d8f..ffa208ddf 100644 --- a/module/Entra/AdditionalFunctions/Set-EntraAttributeSet.ps1 +++ b/module/Entra/AdditionalFunctions/Set-EntraAttributeSet.ps1 @@ -6,7 +6,8 @@ function Set-EntraAttributeSet { [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( [Parameter(ParameterSetName = "InvokeByDynamicParameters")] - [System.String] $Id, + [Alias("Id")] + [System.String] $AttributeSetId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.String] $Description, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] @@ -19,9 +20,9 @@ function Set-EntraAttributeSet { $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $params["Uri"] = "https://graph.microsoft.com/v1.0/directory/attributeSets/" $params["Method"] = "PATCH" - if($null -ne $PSBoundParameters["Id"]) + if($null -ne $PSBoundParameters["AttributeSetId"]) { - $params["Uri"] += $Id + $params["Uri"] += $AttributeSetId } if($null -ne $PSBoundParameters["Description"]) { diff --git a/module/Entra/AdditionalFunctions/Set-EntraServicePrincipal.ps1 b/module/Entra/AdditionalFunctions/Set-EntraServicePrincipal.ps1 index 0f12fe77b..b7a13abd7 100644 --- a/module/Entra/AdditionalFunctions/Set-EntraServicePrincipal.ps1 +++ b/module/Entra/AdditionalFunctions/Set-EntraServicePrincipal.ps1 @@ -31,8 +31,9 @@ function Set-EntraServicePrincipal { [System.String] $ServicePrincipalType, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Tags, + [Alias("ObjectId")] [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [System.String] $ServicePrincipalId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.PasswordCredential]] $PasswordCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] @@ -99,9 +100,9 @@ function Set-EntraServicePrincipal { { $body["replyUrls"] = $PSBoundParameters["ReplyUrls"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ServicePrincipalId"]) { - $params["Uri"] += "/$ObjectId" + $params["Uri"] += "/$ServicePrincipalId" } if($null -ne $PSBoundParameters["LogoutUrl"]) { diff --git a/module/Entra/AdditionalFunctions/Update-EntraUserFromFederated.ps1 b/module/Entra/AdditionalFunctions/Update-EntraUserFromFederated.ps1 index 349d874e1..2fc79e92a 100644 --- a/module/Entra/AdditionalFunctions/Update-EntraUserFromFederated.ps1 +++ b/module/Entra/AdditionalFunctions/Update-EntraUserFromFederated.ps1 @@ -79,3 +79,5 @@ function Update-EntraUserFromFederated { $response } } +Set-Alias -Name Convert-EntraFederatedUser -Value Update-EntraUserFromFederated -Scope Global -Force + diff --git a/module/Entra/customizations/Add-EntraApplicationOwner.ps1 b/module/Entra/customizations/Add-EntraApplicationOwner.ps1 index 03cee0b3a..942021a52 100644 --- a/module/Entra/customizations/Add-EntraApplicationOwner.ps1 +++ b/module/Entra/customizations/Add-EntraApplicationOwner.ps1 @@ -7,11 +7,20 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $RefObjectId + ) + PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } $newOwner = @{} @@ -71,5 +80,6 @@ Write-Debug("=========================================================================`n") New-MgApplicationOwnerByRef @params -Headers $customHeaders +} '@ } \ No newline at end of file diff --git a/module/Entra/customizations/Get-EntraApplication.ps1 b/module/Entra/customizations/Get-EntraApplication.ps1 index 6cca113a7..45666941c 100644 --- a/module/Entra/customizations/Get-EntraApplication.ps1 +++ b/module/Entra/customizations/Get-EntraApplication.ps1 @@ -7,19 +7,36 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [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 { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - $keysChanged = @{SearchString = "Filter"; ObjectId = "Id"} + $keysChanged = @{SearchString = "Filter"; ApplicationId = "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"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } if($null -ne $PSBoundParameters["Property"]) { diff --git a/module/Entra/customizations/Get-EntraApplicationLogo.ps1 b/module/Entra/customizations/Get-EntraApplicationLogo.ps1 index f0a2dd7f5..bb6e3140c 100644 --- a/module/Entra/customizations/Get-EntraApplicationLogo.ps1 +++ b/module/Entra/customizations/Get-EntraApplicationLogo.ps1 @@ -7,14 +7,26 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Boolean] $View, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $FileName, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $FilePath + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/v1.0/applications' $Method = "GET" - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] $URI = "$baseUri/$($params.ApplicationId)" } diff --git a/module/Entra/customizations/Get-EntraApplicationOwner.ps1 b/module/Entra/customizations/Get-EntraApplicationOwner.ps1 index 3cb00e337..3a2baf1e3 100644 --- a/module/Entra/customizations/Get-EntraApplicationOwner.ps1 +++ b/module/Entra/customizations/Get-EntraApplicationOwner.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -20,9 +32,9 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] $URI = "$baseUri/$($params.ApplicationId)/owners?$properties" } if($null -ne $PSBoundParameters["All"]) diff --git a/module/Entra/customizations/Get-EntraApplicationPasswordCredential.ps1 b/module/Entra/customizations/Get-EntraApplicationPasswordCredential.ps1 index ce8ba762c..0a59c1ece 100644 --- a/module/Entra/customizations/Get-EntraApplicationPasswordCredential.ps1 +++ b/module/Entra/customizations/Get-EntraApplicationPasswordCredential.ps1 @@ -7,6 +7,14 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -17,7 +25,7 @@ # TODO : Invoke API and apply the correct Select query - $response = (Get-MgApplication -Headers $customHeaders -ApplicationId $PSBoundParameters["ObjectId"]).PasswordCredentials + $response = (Get-MgApplication -Headers $customHeaders -ApplicationId $PSBoundParameters["ApplicationId"]).PasswordCredentials if($null -ne $PSBoundParameters["Property"]) { diff --git a/module/Entra/customizations/Get-EntraContact.ps1 b/module/Entra/customizations/Get-EntraContact.ps1 index 8e2b00106..85e240103 100644 --- a/module/Entra/customizations/Get-EntraContact.ps1 +++ b/module/Entra/customizations/Get-EntraContact.ps1 @@ -6,14 +6,28 @@ TargetName = $null Parameters = $null outputs = $null - CustomScript = @' + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $OrgContactId, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [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"]) + $keysChanged = @{OrgContactId = "Id"} + if($null -ne $PSBoundParameters["OrgContactId"]) { - $params["OrgContactId"] = $PSBoundParameters["ObjectId"] + $params["OrgContactId"] = $PSBoundParameters["OrgContactId"] } if($null -ne $PSBoundParameters["Filter"]) { diff --git a/module/Entra/customizations/Get-EntraDeletedGroup.ps1 b/module/Entra/customizations/Get-EntraDeletedGroup.ps1 index d35f0fc8b..de79e5f03 100644 --- a/module/Entra/customizations/Get-EntraDeletedGroup.ps1 +++ b/module/Entra/customizations/Get-EntraDeletedGroup.ps1 @@ -3,16 +3,130 @@ # ------------------------------------------------------------------------------ @{ SourceName = "Get-AzureADMSDeletedGroup" - TargetName = "Get-MgDirectoryDeletedItemAsGroup" - Parameters = @( - @{ - SourceName = "SearchString" - TargetName = "Filter" - ConversionType = "ScriptBlock" - SpecialMapping = @' - $Value = "mailNickName eq '$TmpValue' or (mail eq '$TmpValue' or (displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')))" -'@ - } - ) + TargetName = $null + Parameters = $null Outputs = $null + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + + [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SearchString, + [Alias('Id')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $GroupId, + + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [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["PipelineVariable"]) + { + $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] + } + if ($null -ne $PSBoundParameters["ProgressAction"]) + { + $params["ProgressAction"] = $PSBoundParameters["ProgressAction"] + } + if($PSBoundParameters.ContainsKey("Debug")) + { + $params["Debug"] = $PSBoundParameters["Debug"] + } + if ($null -ne $PSBoundParameters["WarningAction"]) + { + $params["WarningAction"] = $PSBoundParameters["WarningAction"] + } + 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($PSBoundParameters.ContainsKey("Verbose")) + { + $params["Verbose"] = $PSBoundParameters["Verbose"] + } + if ($null -ne $PSBoundParameters["ErrorAction"]) + { + $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] + } + if ($null -ne $PSBoundParameters["InformationAction"]) + { + $params["InformationAction"] = $PSBoundParameters["InformationAction"] + } + if($null -ne $PSBoundParameters["All"]) + { + if($PSBoundParameters["All"]) + { + $params["All"] = $PSBoundParameters["All"] + } + } + if ($null -ne $PSBoundParameters["WarningVariable"]) + { + $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] + } + if ($null -ne $PSBoundParameters["InformationVariable"]) + { + $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] + } + 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["GroupId"]) + { + $params["DirectoryObjectId"] = $PSBoundParameters["GroupId"] + } + if ($null -ne $PSBoundParameters["OutBuffer"]) + { + $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] + } + if ($null -ne $PSBoundParameters["OutVariable"]) + { + $params["OutVariable"] = $PSBoundParameters["OutVariable"] + } + if ($PSBoundParameters.ContainsKey("Top")) + { + $params["Top"] = $PSBoundParameters["Top"] + } + 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 + } +'@ } \ No newline at end of file diff --git a/module/Entra/customizations/Get-EntraDeviceRegisteredOwner.ps1 b/module/Entra/customizations/Get-EntraDeviceRegisteredOwner.ps1 index be25e5c7c..220782474 100644 --- a/module/Entra/customizations/Get-EntraDeviceRegisteredOwner.ps1 +++ b/module/Entra/customizations/Get-EntraDeviceRegisteredOwner.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DeviceId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -20,9 +32,9 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["DeviceId"]) { - $params["DeviceId"] = $PSBoundParameters["ObjectId"] + $params["DeviceId"] = $PSBoundParameters["DeviceId"] $URI = "$baseUri/$($params.DeviceId)/registeredOwners?$properties" } if($null -ne $PSBoundParameters["All"]) diff --git a/module/Entra/customizations/Get-EntraDeviceRegisteredUser.ps1 b/module/Entra/customizations/Get-EntraDeviceRegisteredUser.ps1 index bb25e96f5..345116cf8 100644 --- a/module/Entra/customizations/Get-EntraDeviceRegisteredUser.ps1 +++ b/module/Entra/customizations/Get-EntraDeviceRegisteredUser.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DeviceId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -20,9 +32,9 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["DeviceId"]) { - $params["DeviceId"] = $PSBoundParameters["ObjectId"] + $params["DeviceId"] = $PSBoundParameters["DeviceId"] $URI = "$baseUri/$($params.DeviceId)/registeredUsers?$properties" } if($null -ne $PSBoundParameters["All"]) diff --git a/module/Entra/customizations/Get-EntraDirectoryRoleDefinition.ps1 b/module/Entra/customizations/Get-EntraDirectoryRoleDefinition.ps1 index 99aba85fe..781a5e7e2 100644 --- a/module/Entra/customizations/Get-EntraDirectoryRoleDefinition.ps1 +++ b/module/Entra/customizations/Get-EntraDirectoryRoleDefinition.ps1 @@ -7,13 +7,29 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SearchString, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('Id')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UnifiedRoleDefinitionId, + [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"]) + if($null -ne $PSBoundParameters["UnifiedRoleDefinitionId"]) { - $params["UnifiedRoleDefinitionId"] = $PSBoundParameters["Id"] + $params["UnifiedRoleDefinitionId"] = $PSBoundParameters["UnifiedRoleDefinitionId"] } if($null -ne $PSBoundParameters["Filter"]) { @@ -110,4 +126,4 @@ $response } '@ -} \ No newline at end of file +} diff --git a/module/Entra/customizations/Get-EntraDirectoryRoleMember.ps1 b/module/Entra/customizations/Get-EntraDirectoryRoleMember.ps1 index 5414fcc71..5bdc239e6 100644 --- a/module/Entra/customizations/Get-EntraDirectoryRoleMember.ps1 +++ b/module/Entra/customizations/Get-EntraDirectoryRoleMember.ps1 @@ -7,6 +7,14 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DirectoryRoleId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -19,10 +27,10 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["DirectoryRoleId"]) { - $params["ObjectId"] = $PSBoundParameters["ObjectId"] - $URI = "$baseUri/$($params.ObjectId)/members?$properties" + $params["DirectoryRoleId"] = $PSBoundParameters["DirectoryRoleId"] + $URI = "$baseUri/$($params.DirectoryRoleId)/members?$properties" } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug diff --git a/module/Entra/customizations/Get-EntraGroupMember.ps1 b/module/Entra/customizations/Get-EntraGroupMember.ps1 index 8edb5a21b..bedc6e100 100644 --- a/module/Entra/customizations/Get-EntraGroupMember.ps1 +++ b/module/Entra/customizations/Get-EntraGroupMember.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $GroupId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -21,9 +33,9 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["GroupId"]) { - $params["GroupId"] = $PSBoundParameters["ObjectId"] + $params["GroupId"] = $PSBoundParameters["GroupId"] $URI = "$baseUri/$($params.GroupId)/members?$properties" } if($null -ne $PSBoundParameters["All"]) diff --git a/module/Entra/customizations/Get-EntraGroupOwner.ps1 b/module/Entra/customizations/Get-EntraGroupOwner.ps1 index a29ad599e..c2e988b3e 100644 --- a/module/Entra/customizations/Get-EntraGroupOwner.ps1 +++ b/module/Entra/customizations/Get-EntraGroupOwner.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $GroupId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -20,9 +32,9 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["GroupId"]) { - $params["GroupId"] = $PSBoundParameters["ObjectId"] + $params["GroupId"] = $PSBoundParameters["GroupId"] $URI = "$baseUri/$($params.GroupId)/owners?$properties" } if($null -ne $PSBoundParameters["All"]) diff --git a/module/Entra/customizations/Get-EntraServicePrincipalKeyCredential.ps1 b/module/Entra/customizations/Get-EntraServicePrincipalKeyCredential.ps1 index 2058892c0..a08f25ed6 100644 --- a/module/Entra/customizations/Get-EntraServicePrincipalKeyCredential.ps1 +++ b/module/Entra/customizations/Get-EntraServicePrincipalKeyCredential.ps1 @@ -7,8 +7,15 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ServicePrincipalId + ) + $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - $response = (Get-MgServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"]).KeyCredentials + $response = (Get-MgServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"]).KeyCredentials $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime diff --git a/module/Entra/customizations/Get-EntraServicePrincipalOwner.ps1 b/module/Entra/customizations/Get-EntraServicePrincipalOwner.ps1 index fd2067793..0e5c5b3b4 100644 --- a/module/Entra/customizations/Get-EntraServicePrincipalOwner.ps1 +++ b/module/Entra/customizations/Get-EntraServicePrincipalOwner.ps1 @@ -7,6 +7,19 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Alias("ObjectId")] + [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 @@ -14,9 +27,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ServicePrincipalId"]) { - $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] + $params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/Entra/customizations/Get-EntraServicePrincipalPasswordCredential.ps1 b/module/Entra/customizations/Get-EntraServicePrincipalPasswordCredential.ps1 index b441ec9c1..f78df77a9 100644 --- a/module/Entra/customizations/Get-EntraServicePrincipalPasswordCredential.ps1 +++ b/module/Entra/customizations/Get-EntraServicePrincipalPasswordCredential.ps1 @@ -7,8 +7,15 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ServicePrincipalId + ) + $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - $response = (Get-MgServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"]).PasswordCredentials + $response = (Get-MgServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"]).PasswordCredentials $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime diff --git a/module/Entra/customizations/Get-EntraSubscribedSku.ps1 b/module/Entra/customizations/Get-EntraSubscribedSku.ps1 index 9c45e18f2..cd046d7f6 100644 --- a/module/Entra/customizations/Get-EntraSubscribedSku.ps1 +++ b/module/Entra/customizations/Get-EntraSubscribedSku.ps1 @@ -7,6 +7,14 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SubscribedSkuId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -14,9 +22,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["SubscribedSkuId"]) { - $params["SubscribedSkuId"] = $PSBoundParameters["ObjectId"] + $params["SubscribedSkuId"] = $PSBoundParameters["SubscribedSkuId"] } if($PSBoundParameters.ContainsKey("Debug")) { diff --git a/module/Entra/customizations/Get-EntraUser.ps1 b/module/Entra/customizations/Get-EntraUser.ps1 index 1d24ef2d7..488b21a15 100644 --- a/module/Entra/customizations/Get-EntraUser.ps1 +++ b/module/Entra/customizations/Get-EntraUser.ps1 @@ -7,6 +7,23 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias("ObjectId")] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [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 = @{} @@ -40,9 +57,9 @@ $params["Uri"] += "&$SearchString" $customHeaders['ConsistencyLevel'] = 'eventual' } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $UserId = $PSBoundParameters["ObjectId"] + $UserId = $PSBoundParameters["UserId"] if ($UserId -match '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'){ $f = '$' + 'Filter' $Filter = "UserPrincipalName eq '$UserId'" @@ -67,7 +84,7 @@ $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. + Write-Error "Resource '$UserId' does not exist or one of its queried reference-property objects are not present. Status: 404 (NotFound) ErrorCode: Request_ResourceNotFound" } diff --git a/module/Entra/customizations/Get-EntraUserCreatedObject.ps1 b/module/Entra/customizations/Get-EntraUserCreatedObject.ps1 index 626fcc24c..700a4be94 100644 --- a/module/Entra/customizations/Get-EntraUserCreatedObject.ps1 +++ b/module/Entra/customizations/Get-EntraUserCreatedObject.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -14,9 +26,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/Entra/customizations/Get-EntraUserDirectReport.ps1 b/module/Entra/customizations/Get-EntraUserDirectReport.ps1 index 6fbfcc7e7..64464f2ec 100644 --- a/module/Entra/customizations/Get-EntraUserDirectReport.ps1 +++ b/module/Entra/customizations/Get-EntraUserDirectReport.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -20,9 +32,9 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] $URI = "$baseUri/$($params.UserId)/directReports?$properties" } if($null -ne $PSBoundParameters["All"]) diff --git a/module/Entra/customizations/Get-EntraUserExtension.ps1 b/module/Entra/customizations/Get-EntraUserExtension.ps1 index 7944b3864..e486037de 100644 --- a/module/Entra/customizations/Get-EntraUserExtension.ps1 +++ b/module/Entra/customizations/Get-EntraUserExtension.ps1 @@ -3,14 +3,45 @@ # ------------------------------------------------------------------------------ @{ SourceName = "Get-AzureADUserExtension" - TargetName = "Get-MgUserExtension" - Parameters = @( - @{ - SourceName = "ObjectId" - TargetName = "UserId" - ConversionType = "Name" - SpecialMapping = $null - } - ) + TargetName = $null + Parameters = $null Outputs = $null + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias("ObjectId")] + [System.String] $UserId, + [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/users/$UserId" + $properties = '$select=Identities,OnPremisesDistinguishedName,EmployeeId,CreatedDateTime' + $params["Uri"] = "$baseUri/?$properties" + + if($null -ne $PSBoundParameters["Property"]) + { + $params["Property"] = $PSBoundParameters["Property"] + $selectProperties = $PSBoundParameters["Property"] + $selectProperties = $selectProperties -Join ',' + $properties = "`$select=$($selectProperties)" + $params["Uri"] = "$baseUri/?$properties" + } + + Write-Debug("============================ TRANSFORMATIONS ============================") + $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug + Write-Debug("=========================================================================`n") + + $data = Invoke-GraphRequest -Uri $($params.Uri) -Method GET -Headers $customHeaders | Convertto-json | convertfrom-json + $data | ForEach-Object { + if($null -ne $_) { + Add-Member -InputObject $_ -MemberType AliasProperty -Name userIdentities -Value identities + } + } + $data + } +'@ } diff --git a/module/Entra/customizations/Get-EntraUserManager.ps1 b/module/Entra/customizations/Get-EntraUserManager.ps1 index 5a4a6c805..07081c2ff 100644 --- a/module/Entra/customizations/Get-EntraUserManager.ps1 +++ b/module/Entra/customizations/Get-EntraUserManager.ps1 @@ -7,14 +7,22 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [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"]) + $keysChanged = @{UserId = "Id"} + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } $URI = "https://graph.microsoft.com/v1.0/users/$($params.UserId)/manager?`$select=*" diff --git a/module/Entra/customizations/Get-EntraUserOwnedDevice.ps1 b/module/Entra/customizations/Get-EntraUserOwnedDevice.ps1 index 902436e87..32cc548da 100644 --- a/module/Entra/customizations/Get-EntraUserOwnedDevice.ps1 +++ b/module/Entra/customizations/Get-EntraUserOwnedDevice.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -14,9 +26,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/Entra/customizations/Get-EntraUserOwnedObject.ps1 b/module/Entra/customizations/Get-EntraUserOwnedObject.ps1 index 03d3f9f7c..ce6d5fa78 100644 --- a/module/Entra/customizations/Get-EntraUserOwnedObject.ps1 +++ b/module/Entra/customizations/Get-EntraUserOwnedObject.ps1 @@ -7,11 +7,23 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [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"] + if ($null -ne $PSBoundParameters["UserId"]) { + $params["UserId"] = $PSBoundParameters["UserId"] } $URI = "/v1.0/users/$($params.UserId)/ownedObjects" diff --git a/module/Entra/customizations/Get-EntraUserRegisteredDevice.ps1 b/module/Entra/customizations/Get-EntraUserRegisteredDevice.ps1 index 9a3bf1b9f..f62ad012d 100644 --- a/module/Entra/customizations/Get-EntraUserRegisteredDevice.ps1 +++ b/module/Entra/customizations/Get-EntraUserRegisteredDevice.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -14,9 +26,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/Entra/customizations/New-EntraApplicationPasswordCredential.ps1 b/module/Entra/customizations/New-EntraApplicationPasswordCredential.ps1 index 8a3fe5e23..e33894429 100644 --- a/module/Entra/customizations/New-EntraApplicationPasswordCredential.ps1 +++ b/module/Entra/customizations/New-EntraApplicationPasswordCredential.ps1 @@ -7,6 +7,20 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Value, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $CustomKeyIdentifier, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $StartDate, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $EndDate + ) PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -24,9 +38,9 @@ { $body["displayName"] = $PSBoundParameters["CustomKeyIdentifier"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } if($PSBoundParameters.ContainsKey("Verbose")) { diff --git a/module/Entra/customizations/New-EntraServicePrincipalPasswordCredential.ps1 b/module/Entra/customizations/New-EntraServicePrincipalPasswordCredential.ps1 index c3b5e1b54..8c4afe22a 100644 --- a/module/Entra/customizations/New-EntraServicePrincipalPasswordCredential.ps1 +++ b/module/Entra/customizations/New-EntraServicePrincipalPasswordCredential.ps1 @@ -7,6 +7,21 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ServicePrincipalId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Value, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $StartDate, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $CustomKeyIdentifier, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $EndDate + ) + $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{ passwordCredential = @{ @@ -14,7 +29,7 @@ endDateTime = $PSBoundParameters["EndDate"]; } } - $response = Add-MgServicePrincipalPassword -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"] -BodyParameter $body + $response = Add-MgServicePrincipalPassword -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"] -BodyParameter $body $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime diff --git a/module/Entra/customizations/Remove-EntraDeletedDirectoryObject.ps1 b/module/Entra/customizations/Remove-EntraDeletedDirectoryObject.ps1 index 7bd155e14..605e7ab77 100644 --- a/module/Entra/customizations/Remove-EntraDeletedDirectoryObject.ps1 +++ b/module/Entra/customizations/Remove-EntraDeletedDirectoryObject.ps1 @@ -7,17 +7,24 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("Id")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DirectoryObjectId + ) + PROCESS { $params = @{} $Method = "DELETE" $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - if ($null -ne $PSBoundParameters["Id"]) { - $params["Id"] = $PSBoundParameters["Id"] + if ($null -ne $PSBoundParameters["DirectoryObjectId"]) { + $params["DirectoryObjectId"] = $PSBoundParameters["DirectoryObjectId"] } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") - $URI = "https://graph.microsoft.com/v1.0/directory/deletedItems/$Id" + $URI = "https://graph.microsoft.com/v1.0/directory/deletedItems/$DirectoryObjectId" $response = Invoke-GraphRequest -Headers $customHeaders -Uri $uri -Method $Method $response } diff --git a/module/Entra/customizations/Remove-EntraServicePrincipalOwner.ps1 b/module/Entra/customizations/Remove-EntraServicePrincipalOwner.ps1 index d2af043bf..9104f4547 100644 --- a/module/Entra/customizations/Remove-EntraServicePrincipalOwner.ps1 +++ b/module/Entra/customizations/Remove-EntraServicePrincipalOwner.ps1 @@ -1,19 +1,91 @@ @{ SourceName = "Remove-AzureADServicePrincipalOwner" - TargetName = "Remove-MgServicePrincipalOwnerByRef" - Parameters = @( - @{ - SourceName = "ObjectId" - TargetName = "ServicePrincipalId" - ConversionType = "Name" - SpecialMapping = $null - }, - @{ - SourceName = "OwnerId" - TargetName = "DirectoryObjectId" - ConversionType = "Name" - SpecialMapping = $null - } - ) + TargetName = $null + Parameters = $null Outputs = $null + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ServicePrincipalId, + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $OwnerId + ) + + PROCESS { + $params = @{} + $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand + + if($null -ne $PSBoundParameters["ErrorVariable"]) + { + $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] + } + if($null -ne $PSBoundParameters["OutVariable"]) + { + $params["OutVariable"] = $PSBoundParameters["OutVariable"] + } + if($null -ne $PSBoundParameters["WarningVariable"]) + { + $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] + } + if($null -ne $PSBoundParameters["PipelineVariable"]) + { + $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] + } + if($null -ne $PSBoundParameters["WarningAction"]) + { + $params["WarningAction"] = $PSBoundParameters["WarningAction"] + } + if($null -ne $PSBoundParameters["ServicePrincipalId"]) + { + $params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"] + } + if($null -ne $PSBoundParameters["InformationAction"]) + { + $params["InformationAction"] = $PSBoundParameters["InformationAction"] + } + if($null -ne $PSBoundParameters["ErrorAction"]) + { + $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] + } + if($PSBoundParameters.ContainsKey("Verbose")) + { + $params["Verbose"] = $PSBoundParameters["Verbose"] + } + if($null -ne $PSBoundParameters["InformationVariable"]) + { + $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] + } + if($null -ne $PSBoundParameters["OwnerId"]) + { + $params["DirectoryObjectId"] = $PSBoundParameters["OwnerId"] + } + if($PSBoundParameters.ContainsKey("Debug")) + { + $params["Debug"] = $PSBoundParameters["Debug"] + } + if($null -ne $PSBoundParameters["ProgressAction"]) + { + $params["ProgressAction"] = $PSBoundParameters["ProgressAction"] + } + if($null -ne $PSBoundParameters["OutBuffer"]) + { + $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] + } + + 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 + } +'@ } \ No newline at end of file diff --git a/module/Entra/customizations/Remove-EntraServicePrincipalPasswordCredential.ps1 b/module/Entra/customizations/Remove-EntraServicePrincipalPasswordCredential.ps1 index 7f68d0c17..9cf798ee2 100644 --- a/module/Entra/customizations/Remove-EntraServicePrincipalPasswordCredential.ps1 +++ b/module/Entra/customizations/Remove-EntraServicePrincipalPasswordCredential.ps1 @@ -7,9 +7,18 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $KeyId, + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ServicePrincipalId + ) + PROCESS{ $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand - Remove-MgServicePrincipalPassword -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"] -KeyId $PSBoundParameters["KeyId"] + Remove-MgServicePrincipalPassword -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"] -KeyId $PSBoundParameters["KeyId"] } '@ } \ No newline at end of file diff --git a/module/Entra/customizations/Set-EntraApplication.ps1 b/module/Entra/customizations/Set-EntraApplication.ps1 index 4ffc385dd..a6f5db81e 100644 --- a/module/Entra/customizations/Set-EntraApplication.ps1 +++ b/module/Entra/customizations/Set-EntraApplication.ps1 @@ -7,6 +7,51 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $TokenEncryptionKeyId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.ApiApplication] $Api, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AddIn]] $AddIns, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.ParentalControlSettings] $ParentalControlSettings, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DisplayName, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AppRole]] $AppRoles, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.PublicClientApplication] $PublicClient, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.RequiredResourceAccess]] $RequiredResourceAccess, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsDeviceOnlyAuthSupported, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsFallbackPublicClient, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $IdentifierUris, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.OptionalClaims] $OptionalClaims, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.PasswordCredential]] $PasswordCredentials, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $GroupMembershipClaims, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.WebApplication] $Web, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.InformationalUrl] $InformationalUrl, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $Tags, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.KeyCredential]] $KeyCredentials, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $SignInAudience + ) + PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand @@ -123,9 +168,9 @@ { $params["GroupMembershipClaims"] = $PSBoundParameters["GroupMembershipClaims"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } if($null -ne $PSBoundParameters["AddIns"]) { diff --git a/module/Entra/customizations/Set-EntraApplicationLogo.ps1 b/module/Entra/customizations/Set-EntraApplicationLogo.ps1 index eb8d4e667..1b5f661ad 100644 --- a/module/Entra/customizations/Set-EntraApplicationLogo.ps1 +++ b/module/Entra/customizations/Set-EntraApplicationLogo.ps1 @@ -7,15 +7,30 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'File')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = "Stream")] + [Parameter(ParameterSetName = "File")] + [Parameter(ParameterSetName = "ByteArray")] + [System.String] $ApplicationId, + [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(ParameterSetName = "Stream", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.IO.Stream] $FileStream + ) PROCESS { try{ $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/v1.0/applications' $Method = "PUT" - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] $URI = "$baseUri/$($params.ApplicationId)/logo" } if($null -ne $PSBoundParameters["FilePath"]){ diff --git a/module/Entra/customizations/Set-EntraDevice.ps1 b/module/Entra/customizations/Set-EntraDevice.ps1 index ba06573b3..d6b90eb58 100644 --- a/module/Entra/customizations/Set-EntraDevice.ps1 +++ b/module/Entra/customizations/Set-EntraDevice.ps1 @@ -3,67 +3,187 @@ # ------------------------------------------------------------------------------ @{ SourceName = "Set-AzureADDevice" - TargetName = "Update-MgDevice" - Parameters = @( - @{ - SourceName = "ApproximateLastLogonTimeStamp" - TargetName = "ApproximateLastSignInDateTime" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceId" - TargetName = "DeviceId1" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceObjectVersion" - TargetName = "DeviceVersion" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceOSType" - TargetName = "OperatingSystem" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceOSVersion" - TargetName = "OperatingSystemVersion" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DevicePhysicalIds" - TargetName = "PhysicalIds" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceTrustType" - TargetName = "TrustType" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "AlternativeSecurityIds" - TargetName = "BodyParameter" - ConversionType = "ScriptBlock" - SpecialMapping = @' - $key = [System.Text.Encoding]::UTF8.GetString($TmpValue.key) - $Temp = @{ - alternativeSecurityIds = @( - @{ - type = $TmpValue.type - key = [System.Text.Encoding]::ASCII.GetBytes($key) - } - ) + TargetName = $null + Parameters = $null + Outputs = $null + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Int32]] $DeviceObjectVersion, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceOSVersion, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.AlternativeSecurityId]] $AlternativeSecurityIds, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.DateTime]] $ApproximateLastLogonTimeStamp, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $DevicePhysicalIds, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsCompliant, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceTrustType, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsManaged, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $ProfileType, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceOSType, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DisplayName, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $AccountEnabled, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceMetadata, + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DeviceObjectId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $SystemLabels + ) + + PROCESS { + $params = @{} + $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand + + if($null -ne $PSBoundParameters["DeviceObjectVersion"]) + { + $params["DeviceVersion"] = $PSBoundParameters["DeviceObjectVersion"] + } + if($null -ne $PSBoundParameters["DeviceOSVersion"]) + { + $params["OperatingSystemVersion"] = $PSBoundParameters["DeviceOSVersion"] + } + 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["OutBuffer"]) + { + $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] + } + if($null -ne $PSBoundParameters["WarningAction"]) + { + $params["WarningAction"] = $PSBoundParameters["WarningAction"] + } + if($null -ne $PSBoundParameters["DeviceId"]) + { + $params["DeviceId1"] = $PSBoundParameters["DeviceId"] + } + if($null -ne $PSBoundParameters["PipelineVariable"]) + { + $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] + } + if($null -ne $PSBoundParameters["ApproximateLastLogonTimeStamp"]) + { + $params["ApproximateLastSignInDateTime"] = $PSBoundParameters["ApproximateLastLogonTimeStamp"] + } + if($null -ne $PSBoundParameters["InformationVariable"]) + { + $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] + } + if($null -ne $PSBoundParameters["DevicePhysicalIds"]) + { + $params["PhysicalIds"] = $PSBoundParameters["DevicePhysicalIds"] + } + if($null -ne $PSBoundParameters["OutVariable"]) + { + $params["OutVariable"] = $PSBoundParameters["OutVariable"] + } + if($null -ne $PSBoundParameters["IsCompliant"]) + { + $params["IsCompliant"] = $PSBoundParameters["IsCompliant"] + } + if($null -ne $PSBoundParameters["DeviceTrustType"]) + { + $params["TrustType"] = $PSBoundParameters["DeviceTrustType"] + } + if($null -ne $PSBoundParameters["IsManaged"]) + { + $params["IsManaged"] = $PSBoundParameters["IsManaged"] + } + if($null -ne $PSBoundParameters["ErrorAction"]) + { + $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] + } + if($PSBoundParameters.ContainsKey("Verbose")) + { + $params["Verbose"] = $PSBoundParameters["Verbose"] + } + if($PSBoundParameters.ContainsKey("Debug")) + { + $params["Debug"] = $PSBoundParameters["Debug"] + } + if($null -ne $PSBoundParameters["ProfileType"]) + { + $params["ProfileType"] = $PSBoundParameters["ProfileType"] + } + if($null -ne $PSBoundParameters["DeviceOSType"]) + { + $params["OperatingSystem"] = $PSBoundParameters["DeviceOSType"] + } + if($null -ne $PSBoundParameters["WarningVariable"]) + { + $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] + } + if($null -ne $PSBoundParameters["DisplayName"]) + { + $params["DisplayName"] = $PSBoundParameters["DisplayName"] + } + if($null -ne $PSBoundParameters["AccountEnabled"]) + { + $params["AccountEnabled"] = $PSBoundParameters["AccountEnabled"] + } + if($null -ne $PSBoundParameters["DeviceMetadata"]) + { + $params["DeviceMetadata"] = $PSBoundParameters["DeviceMetadata"] + } + if($null -ne $PSBoundParameters["InformationAction"]) + { + $params["InformationAction"] = $PSBoundParameters["InformationAction"] + } + if($null -ne $PSBoundParameters["DeviceObjectId"]) + { + $params["DeviceId"] = $PSBoundParameters["DeviceObjectId"] + } + if($null -ne $PSBoundParameters["SystemLabels"]) + { + $params["SystemLabels"] = $PSBoundParameters["SystemLabels"] + } + if($null -ne $PSBoundParameters["ProgressAction"]) + { + $params["ProgressAction"] = $PSBoundParameters["ProgressAction"] + } + if($null -ne $PSBoundParameters["ErrorVariable"]) + { + $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] + } + + 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 + } - $Value = $Temp -'@ } - ) - Outputs = $null + $response + } +'@ } \ No newline at end of file diff --git a/module/Entra/customizations/Set-EntraIdentityProvider.ps1 b/module/Entra/customizations/Set-EntraIdentityProvider.ps1 index 8c1cd05b8..c048bf81c 100644 --- a/module/Entra/customizations/Set-EntraIdentityProvider.ps1 +++ b/module/Entra/customizations/Set-EntraIdentityProvider.ps1 @@ -7,13 +7,27 @@ Parameters = $null outputs = $null CustomScript = @' - PROCESS { + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $Name, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $ClientId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $Type, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $ClientSecret, + [Alias('Id')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $IdentityProviderBaseId + ) + PROCESS { $params = @{} $customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand $body = @{} - if($null -ne $PSBoundParameters["Id"]) + if($null -ne $PSBoundParameters["IdentityProviderBaseId"]) { - $params["IdentityProviderBaseId"] = $PSBoundParameters["Id"] + $params["IdentityProviderBaseId"] = $PSBoundParameters["IdentityProviderBaseId"] } if($null -ne $PSBoundParameters["Type"]) { diff --git a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationPasswordCredential.ps1 b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationPasswordCredential.ps1 index 4558eecfb..e475c8dca 100644 --- a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationPasswordCredential.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationPasswordCredential.ps1 @@ -6,7 +6,8 @@ function Get-EntraBetaApplicationPasswordCredential { [CmdletBinding(DefaultParameterSetName = '')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [Alias("ObjectId")] + [System.String] $ApplicationId, [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] [System.String[]] $Property ) @@ -14,7 +15,7 @@ function Get-EntraBetaApplicationPasswordCredential { PROCESS { $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $params = @{} - $baseUri = "https://graph.microsoft.com/beta/applications/$ObjectId/passwordCredentials" + $baseUri = "https://graph.microsoft.com/beta/applications/$ApplicationId/passwordCredentials" $params["Method"] = "GET" $params["Uri"] = "$baseUri" diff --git a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnector.ps1 b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnector.ps1 index e5155357d..b4d305bd6 100644 --- a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnector.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnector.ps1 @@ -10,7 +10,8 @@ function Get-EntraBetaApplicationProxyConnector { [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Int32] $Top, [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $Id, + [Alias("Id")] + [System.String] $OnPremisesPublishingProfileId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [switch] $All, [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] @@ -27,9 +28,9 @@ function Get-EntraBetaApplicationProxyConnector { $f = '$' + 'Filter' $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectors?$f=machineName eq '$SearchString' OR startswith(machineName,'$SearchString')" } - if($null -ne $PSBoundParameters["Id"]) + if($null -ne $PSBoundParameters["OnPremisesPublishingProfileId"]) { - $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectors/$Id" + $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectors/$OnPremisesPublishingProfileId" } if($null -ne $PSBoundParameters["Filter"]) { diff --git a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorGroupMembers.ps1 b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorGroupMembers.ps1 index 64d490d34..452f587bf 100644 --- a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorGroupMembers.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorGroupMembers.ps1 @@ -6,7 +6,8 @@ function Get-EntraBetaApplicationProxyConnectorGroupMembers { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $Id, + [Alias("Id")] + [System.String] $OnPremisesPublishingProfileId, [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.Int32] $Top, [Parameter( ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] @@ -19,9 +20,9 @@ function Get-EntraBetaApplicationProxyConnectorGroupMembers { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $params["Method"] = "GET" - $Id = $PSBoundParameters["Id"] + $Id = $PSBoundParameters["OnPremisesPublishingProfileId"] $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectorGroups/$Id/members" - if($PSBoundParameters.ContainsKey("Id")) + if($PSBoundParameters.ContainsKey("OnPremisesPublishingProfileId")) { $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectorGroups/$Id/members" } diff --git a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorMemberOf.ps1 b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorMemberOf.ps1 index f5ab77d91..1b146426f 100644 --- a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorMemberOf.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaApplicationProxyConnectorMemberOf.ps1 @@ -6,16 +6,17 @@ function Get-EntraBetaApplicationProxyConnectorMemberOf { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $Id + [Alias("Id")] + [System.String] $OnPremisesPublishingProfileId ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $params["Method"] = "GET" - $Id = $PSBoundParameters["Id"] + $Id = $PSBoundParameters["OnPremisesPublishingProfileId"] $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectors/$Id/memberOf" - if($PSBoundParameters.ContainsKey("Id")) + if($PSBoundParameters.ContainsKey("OnPremisesPublishingProfileId")) { $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectors/$Id/memberOf" } diff --git a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.ps1 b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.ps1 index 2e1a698ae..9866fe1d0 100644 --- a/module/EntraBeta/AdditionalFunctions/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.ps1 @@ -35,4 +35,6 @@ function Get-EntraBetaDirectoryObjectOnPremisesProvisioningError { $response } } -} \ No newline at end of file +} +Set-Alias -Name Get-EntraBetaHasObjectsWithDirSyncProvisioningError -Value Get-EntraBetaDirectoryObjectOnPremisesProvisioningError -Scope Global -Force + diff --git a/module/EntraBeta/AdditionalFunctions/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 b/module/EntraBeta/AdditionalFunctions/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 index d01a13fab..b6d27897a 100644 --- a/module/EntraBeta/AdditionalFunctions/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 @@ -6,16 +6,17 @@ function Remove-EntraBetaApplicationProxyApplicationConnectorGroup { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId + [Alias("ObjectId")] + [System.String] $OnPremisesPublishingProfileId ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $params["Method"] = "DELETE" - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["OnPremisesPublishingProfileId"]) { - $params["Uri"] = "https://graph.microsoft.com/beta/applications/$ObjectId/connectorGroup/"+'$ref' + $params["Uri"] = "https://graph.microsoft.com/beta/applications/$OnPremisesPublishingProfileId/connectorGroup/"+'$ref' } Write-Debug("============================ TRANSFORMATIONS ============================") diff --git a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplication.ps1 b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplication.ps1 index 4b0a0b4ca..1bd685242 100644 --- a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplication.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplication.ps1 @@ -6,7 +6,8 @@ function Set-EntraBetaApplicationProxyApplication { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [Alias("ObjectId")] + [System.String] $ApplicationId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ExternalUrl, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] @@ -34,9 +35,9 @@ function Set-EntraBetaApplicationProxyApplication { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $onPremisesPublishing = @{} - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $ObjectId = $PSBoundParameters["ObjectId"] + $ApplicationId = $PSBoundParameters["ApplicationId"] } if($null -ne $PSBoundParameters["ExternalUrl"]) { diff --git a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 index 5c403562e..380427dd0 100644 --- a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyApplicationConnectorGroup.ps1 @@ -6,7 +6,8 @@ function Set-EntraBetaApplicationProxyApplicationConnectorGroup { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [Alias("ObjectId")] + [System.String] $OnPremisesPublishingProfileId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ConnectorGroupId ) @@ -16,9 +17,9 @@ function Set-EntraBetaApplicationProxyApplicationConnectorGroup { $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $params["Method"] = "PUT" $body = @{} - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["OnPremisesPublishingProfileId"]) { - $params["Uri"] = "https://graph.microsoft.com/beta/applications/$ObjectId/connectorGroup/" + '$ref' + $params["Uri"] = "https://graph.microsoft.com/beta/applications/$OnPremisesPublishingProfileId/connectorGroup/" + '$ref' } if($null -ne $PSBoundParameters["ConnectorGroupId"]) { diff --git a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyConnector.ps1 b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyConnector.ps1 index 17d4858a4..68b629e4a 100644 --- a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyConnector.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaApplicationProxyConnector.ps1 @@ -6,7 +6,8 @@ function Set-EntraBetaApplicationProxyConnector { [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $Id, + [Alias("Id")] + [System.String] $OnPremisesPublishingProfileId, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [System.String] $ConnectorGroupId ) @@ -16,9 +17,9 @@ function Set-EntraBetaApplicationProxyConnector { $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $params["Method"] = "POST" $body = @{} - if($null -ne $PSBoundParameters["Id"]) + if($null -ne $PSBoundParameters["OnPremisesPublishingProfileId"]) { - $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectors/$Id/memberOf/" + '$ref' + $params["Uri"] = "https://graph.microsoft.com/beta/onPremisesPublishingProfiles/applicationProxy/connectors/$OnPremisesPublishingProfileId/memberOf/" + '$ref' } if($null -ne $PSBoundParameters["ConnectorGroupId"]) { diff --git a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaServicePrincipal.ps1 b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaServicePrincipal.ps1 index 3d350f6de..ab75cc3ab 100644 --- a/module/EntraBeta/AdditionalFunctions/Set-EntraBetaServicePrincipal.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Set-EntraBetaServicePrincipal.ps1 @@ -32,7 +32,8 @@ function Set-EntraBetaServicePrincipal { [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[System.String]] $Tags, [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] $ObjectId, + [Alias("ObjectId")] + [System.String] $ServicePrincipalId, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] [System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.PasswordCredential]] $PasswordCredentials, [Parameter(ParameterSetName = "InvokeByDynamicParameters")] @@ -65,10 +66,6 @@ function Set-EntraBetaServicePrincipal { { $body["tags"] = $PSBoundParameters["Tags"] } - if($PSBoundParameters.ContainsKey("Verbose")) - { - $params["Verbose"] = $Null - } if($null -ne $PSBoundParameters["DisplayName"]) { $body["displayName"] = $PSBoundParameters["DisplayName"] @@ -77,10 +74,6 @@ function Set-EntraBetaServicePrincipal { { $body["appId"] = $PSBoundParameters["AppId"] } - if($PSBoundParameters.ContainsKey("Debug")) - { - $params["Debug"] = $Null - } if($null -ne $PSBoundParameters["ErrorUrl"]) { $body["ErrorUrl"] = $PSBoundParameters["ErrorUrl"] @@ -107,9 +100,9 @@ function Set-EntraBetaServicePrincipal { { $body["replyUrls"] = $PSBoundParameters["ReplyUrls"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ServicePrincipalId"]) { - $params["Uri"] += "/$ObjectId" + $params["Uri"] += "/$ServicePrincipalId" } if($null -ne $PSBoundParameters["LogoutUrl"]) { diff --git a/module/EntraBeta/AdditionalFunctions/Update-EntraBetaUserFromFederated.ps1 b/module/EntraBeta/AdditionalFunctions/Update-EntraBetaUserFromFederated.ps1 index 67803c6eb..09b03f7d9 100644 --- a/module/EntraBeta/AdditionalFunctions/Update-EntraBetaUserFromFederated.ps1 +++ b/module/EntraBeta/AdditionalFunctions/Update-EntraBetaUserFromFederated.ps1 @@ -79,4 +79,6 @@ function Update-EntraBetaUserFromFederated { } $response } -} \ No newline at end of file +} +Set-Alias -Name Convert-EntraBetaFederatedUser -Value Update-EntraBetaUserFromFederated -Scope Global -Force + diff --git a/module/EntraBeta/customizations/Add-EntraBetaAdministrativeUnitMember.ps1 b/module/EntraBeta/customizations/Add-EntraBetaAdministrativeUnitMember.ps1 index 6c8682061..61032285a 100644 --- a/module/EntraBeta/customizations/Add-EntraBetaAdministrativeUnitMember.ps1 +++ b/module/EntraBeta/customizations/Add-EntraBetaAdministrativeUnitMember.ps1 @@ -7,6 +7,14 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $RefObjectId, + [Alias('Id')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $AdministrativeUnitId + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +23,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } if($null -ne $PSBoundParameters["RefObjectId"]) { diff --git a/module/EntraBeta/customizations/Add-EntraBetaScopedRoleMembership.ps1 b/module/EntraBeta/customizations/Add-EntraBetaScopedRoleMembership.ps1 index bf5305540..dfce8f5dd 100644 --- a/module/EntraBeta/customizations/Add-EntraBetaScopedRoleMembership.ps1 +++ b/module/EntraBeta/customizations/Add-EntraBetaScopedRoleMembership.ps1 @@ -7,6 +7,18 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $RoleObjectId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $AdministrativeUnitObjectId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.AzureAD.Model.RoleMemberInfo] $RoleMemberInfo, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $AdministrativeUnitId + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -47,9 +59,9 @@ { $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } if($null -ne $PSBoundParameters["OutBuffer"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaApplication.ps1 b/module/EntraBeta/customizations/Get-EntraBetaApplication.ps1 index 8b4b7e01b..546ecb97c 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaApplication.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaApplication.ps1 @@ -7,6 +7,23 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias("ObjectId")] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SearchString, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -17,9 +34,9 @@ $Value = "displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')" $params["Filter"] = $Value } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } if($null -ne $PSBoundParameters["Filter"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaApplicationLogo.ps1 b/module/EntraBeta/customizations/Get-EntraBetaApplicationLogo.ps1 index 9baa551a4..6c9c1229e 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaApplicationLogo.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaApplicationLogo.ps1 @@ -7,14 +7,26 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $FilePath, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $FileName, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Boolean] $View, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/beta/applications' $Method = "GET" - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] $URI = "$baseUri/$($params.ApplicationId)" } if($null -ne $PSBoundParameters["FilePath"]){ diff --git a/module/EntraBeta/customizations/Get-EntraBetaApplicationOwner.ps1 b/module/EntraBeta/customizations/Get-EntraBetaApplicationOwner.ps1 index 1f9648ebf..d16e64913 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaApplicationOwner.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaApplicationOwner.ps1 @@ -7,6 +7,18 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +27,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaApplicationProxyApplication.ps1 b/module/EntraBeta/customizations/Get-EntraBetaApplicationProxyApplication.ps1 index 3178938c6..e3391de83 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaApplicationProxyApplication.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaApplicationProxyApplication.ps1 @@ -7,14 +7,23 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand if ($PSBoundParameters.ContainsKey("Debug")) { $params["Debug"] = $PSBoundParameters["Debug"] } - if ($null -ne $PSBoundParameters["ObjectId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + if ($null -ne $PSBoundParameters["ApplicationId"]) { + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] $params["Select"] = "onPremisesPublishing" } if ($PSBoundParameters.ContainsKey("Verbose")) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaContact.ps1 b/module/EntraBeta/customizations/Get-EntraBetaContact.ps1 index 46811af95..000b5c8d1 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaContact.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaContact.ps1 @@ -7,13 +7,27 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + [Alias('ObjectId')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $OrgContactId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - $keysChanged = @{ObjectId = "Id"} - if($null -ne $PSBoundParameters["ObjectId"]) + $keysChanged = @{OrgContactId = "Id"} + if($null -ne $PSBoundParameters["OrgContactId"]) { - $params["OrgContactId"] = $PSBoundParameters["ObjectId"] + $params["OrgContactId"] = $PSBoundParameters["OrgContactId"] } if($null -ne $PSBoundParameters["Filter"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaDeletedGroup.ps1 b/module/EntraBeta/customizations/Get-EntraBetaDeletedGroup.ps1 index afa6bb58a..7bfe3309a 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaDeletedGroup.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaDeletedGroup.ps1 @@ -3,16 +3,130 @@ # ------------------------------------------------------------------------------ @{ SourceName = "Get-AzureADMSDeletedGroup" - TargetName = "Get-MgBetaDirectoryDeletedItemAsGroup" - Parameters = @( - @{ - SourceName = "SearchString" - TargetName = "Filter" - ConversionType = "ScriptBlock" - SpecialMapping = @' - $Value = "mailNickName eq '$TmpValue' or (mail eq '$TmpValue' or (displayName eq '$TmpValue' or startswith(displayName,'$TmpValue')))" -'@ - } - ) + TargetName = $null + Parameters = $null Outputs = $null + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('Id')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $GroupId, + + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + + [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SearchString, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + + PROCESS { + $params = @{} + $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand + $keysChanged = @{SearchString = "Filter"} + if ($null -ne $PSBoundParameters["WarningAction"]) + { + $params["WarningAction"] = $PSBoundParameters["WarningAction"] + } + if ($PSBoundParameters.ContainsKey("Top")) + { + $params["Top"] = $PSBoundParameters["Top"] + } + if ($null -ne $PSBoundParameters["ProgressAction"]) + { + $params["ProgressAction"] = $PSBoundParameters["ProgressAction"] + } + if ($null -ne $PSBoundParameters["ErrorVariable"]) + { + $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] + } + if ($null -ne $PSBoundParameters["InformationAction"]) + { + $params["InformationAction"] = $PSBoundParameters["InformationAction"] + } + if ($null -ne $PSBoundParameters["GroupId"]) + { + $params["DirectoryObjectId"] = $PSBoundParameters["GroupId"] + } + if ($null -ne $PSBoundParameters["OutBuffer"]) + { + $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] + } + if ($null -ne $PSBoundParameters["OutVariable"]) + { + $params["OutVariable"] = $PSBoundParameters["OutVariable"] + } + if($PSBoundParameters.ContainsKey("Verbose")) + { + $params["Verbose"] = $PSBoundParameters["Verbose"] + } + if ($null -ne $PSBoundParameters["InformationVariable"]) + { + $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] + } + if ($null -ne $PSBoundParameters["PipelineVariable"]) + { + $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] + } + if($null -ne $PSBoundParameters["All"]) + { + if($PSBoundParameters["All"]) + { + $params["All"] = $PSBoundParameters["All"] + } + } + if ($null -ne $PSBoundParameters["ErrorAction"]) + { + $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] + } + if ($null -ne $PSBoundParameters["WarningVariable"]) + { + $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] + } + 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("Debug")) + { + $params["Debug"] = $PSBoundParameters["Debug"] + } + 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["Property"]) + { + $params["Property"] = $PSBoundParameters["Property"] + } + + Write-Debug("============================ TRANSFORMATIONS ============================") + $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug + Write-Debug("=========================================================================`n") + + $response = Get-MgBetaDirectoryDeletedItemAsGroup @params -Headers $customHeaders + $response | ForEach-Object { + if($null -ne $_) { + Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id + + } + } + $response + } +'@ } \ No newline at end of file diff --git a/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredOwner.ps1 b/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredOwner.ps1 index 27d6af012..9c0efda07 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredOwner.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredOwner.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DeviceId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +27,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["DeviceId"]) { - $params["DeviceId"] = $PSBoundParameters["ObjectId"] + $params["DeviceId"] = $PSBoundParameters["DeviceId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredUser.ps1 b/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredUser.ps1 index 71cc56403..e2fabda03 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredUser.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaDeviceRegisteredUser.ps1 @@ -7,6 +7,19 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DeviceId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +28,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["DeviceId"]) { - $params["DeviceId"] = $PSBoundParameters["ObjectId"] + $params["DeviceId"] = $PSBoundParameters["DeviceId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleDefinition.ps1 b/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleDefinition.ps1 index 5fdc1cbcc..2a93abdc9 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleDefinition.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleDefinition.ps1 @@ -7,13 +7,29 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SearchString, + [Alias('Id')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UnifiedRoleDefinitionId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $keysChanged = @{SearchString = "Filter"} - if($null -ne $PSBoundParameters["Id"]) + if($null -ne $PSBoundParameters["UnifiedRoleDefinitionId"]) { - $params["UnifiedRoleDefinitionId"] = $PSBoundParameters["Id"] + $params["UnifiedRoleDefinitionId"] = $PSBoundParameters["UnifiedRoleDefinitionId"] } if($null -ne $PSBoundParameters["Filter"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleMember.ps1 b/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleMember.ps1 index 468508732..4b553ece4 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleMember.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaDirectoryRoleMember.ps1 @@ -7,6 +7,14 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DirectoryRoleId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +23,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["DirectoryRoleId"]) { - $params["DirectoryRoleId"] = $PSBoundParameters["ObjectId"] + $params["DirectoryRoleId"] = $PSBoundParameters["DirectoryRoleId"] } if($PSBoundParameters.ContainsKey("Debug")) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaGroupMember.ps1 b/module/EntraBeta/customizations/Get-EntraBetaGroupMember.ps1 index 348c08ac3..e5ae20240 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaGroupMember.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaGroupMember.ps1 @@ -7,13 +7,25 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $GroupId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["GroupId"]) { - $params["GroupId"] = $PSBoundParameters["ObjectId"] + $params["GroupId"] = $PSBoundParameters["GroupId"] } if($null -ne $PSBoundParameters["All"]) { @@ -86,8 +98,10 @@ Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id $propsToConvert = @('assignedLicenses','assignedPlans','provisionedPlans','identities') foreach ($prop in $propsToConvert) { - $value = $_.$prop | ConvertTo-Json | ConvertFrom-Json - $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force + if ($null -ne $_.PSObject.Properties[$prop]) { + $value = $_.$prop | ConvertTo-Json | ConvertFrom-Json + $_ | Add-Member -MemberType NoteProperty -Name $prop -Value ($value) -Force + } } } } diff --git a/module/EntraBeta/customizations/Get-EntraBetaGroupOwner.ps1 b/module/EntraBeta/customizations/Get-EntraBetaGroupOwner.ps1 index 33f20023c..51839b03d 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaGroupOwner.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaGroupOwner.ps1 @@ -6,7 +6,19 @@ TargetName = $null Parameters = $null outputs = $null - CustomScript = @' + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $GroupId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -21,9 +33,9 @@ $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["GroupId"]) { - $params["GroupId"] = $PSBoundParameters["ObjectId"] + $params["GroupId"] = $PSBoundParameters["GroupId"] $URI = "$baseUri/$($params.GroupId)/owners?$properties" } diff --git a/module/EntraBeta/customizations/Get-EntraBetaScopedRoleMembership.ps1 b/module/EntraBeta/customizations/Get-EntraBetaScopedRoleMembership.ps1 index ba6178f63..1b8d917a2 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaScopedRoleMembership.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaScopedRoleMembership.ps1 @@ -7,6 +7,16 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ScopedRoleMembershipId, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $AdministrativeUnitId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +25,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["AdministrativeUnitId"]) { - $params["AdministrativeUnitId"] = $PSBoundParameters["ObjectId"] + $params["AdministrativeUnitId"] = $PSBoundParameters["AdministrativeUnitId"] } if($PSBoundParameters.ContainsKey("Debug")) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalKeyCredential.ps1 b/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalKeyCredential.ps1 index 46efc9e37..6d5a64453 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalKeyCredential.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalKeyCredential.ps1 @@ -7,14 +7,23 @@ Parameters = $null Outputs = $null CustomScript = @' + function Get-EntraBetaServicePrincipalKeyCredential { + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias("ObjectId")] + [System.String] $ServicePrincipalId + ) + $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - $response = (Get-MgBetaServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"]).KeyCredentials + $response = (Get-MgBetaServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"]).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 + $response +} '@ } \ No newline at end of file diff --git a/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalOwner.ps1 b/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalOwner.ps1 index 42ab0e7b9..fb0567b4e 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalOwner.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalOwner.ps1 @@ -7,17 +7,27 @@ Parameters = $null Outputs = $null CustomScript = @' + function Get-EntraBetaServicePrincipalOwner { + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias("ObjectId")] + [System.String] $ServicePrincipalId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - - if($PSBoundParameters.ContainsKey("Verbose")) - { - $params["Verbose"] = $PSBoundParameters["Verbose"] - } - if($null -ne $PSBoundParameters["ObjectId"]) + + if($null -ne $PSBoundParameters["ServicePrincipalId"]) { - $params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"] + $params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"] } if($null -ne $PSBoundParameters["All"]) { @@ -33,42 +43,6 @@ if($PSBoundParameters.ContainsKey("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"]) { @@ -94,6 +68,7 @@ } } $response - } + } +} '@ } \ No newline at end of file diff --git a/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalPasswordCredential.ps1 b/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalPasswordCredential.ps1 index 5649b5913..69bdfc950 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalPasswordCredential.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaServicePrincipalPasswordCredential.ps1 @@ -8,7 +8,7 @@ Outputs = $null CustomScript = @' $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - $response = (Get-MgBetaServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ObjectId"]).PasswordCredentials + $response = (Get-MgBetaServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"]).PasswordCredentials $response | ForEach-Object { if($null -ne $_) { Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime diff --git a/module/EntraBeta/customizations/Get-EntraBetaSubscribedSku.ps1 b/module/EntraBeta/customizations/Get-EntraBetaSubscribedSku.ps1 index 25f08a7e1..af22bce16 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaSubscribedSku.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaSubscribedSku.ps1 @@ -7,6 +7,15 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Alias('ObjectId')] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SubscribedSkuId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +24,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["SubscribedSkuId"]) { - $params["SubscribedSkuId"] = $PSBoundParameters["ObjectId"] + $params["SubscribedSkuId"] = $PSBoundParameters["SubscribedSkuId"] } if($PSBoundParameters.ContainsKey("Debug")) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaUser.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUser.ps1 index 405598031..19a90b1bb 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUser.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUser.ps1 @@ -7,6 +7,23 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias("ObjectId")] + [Parameter(ParameterSetName = "GetById", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Filter, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(ParameterSetName = "GetVague", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $SearchString, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + PROCESS { $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $params = @{} @@ -44,9 +61,9 @@ $query += "&$SearchString" $customHeaders['ConsistencyLevel'] = 'eventual' } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $UserId = $PSBoundParameters["ObjectId"] + $UserId = $PSBoundParameters["UserId"] if ($UserId -match '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'){ $f = '$' + 'Filter' $Filter = "UserPrincipalName eq '$UserId'" @@ -76,7 +93,7 @@ $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. + Write-Error "Resource '$UserId' does not exist or one of its queried reference-property objects are not present. Status: 404 (NotFound) ErrorCode: Request_ResourceNotFound" diff --git a/module/EntraBeta/customizations/Get-EntraBetaUserCreatedObject.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUserCreatedObject.ps1 index ad46a4fcf..fbc72647d 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUserCreatedObject.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUserCreatedObject.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -14,9 +26,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaUserDirectReport.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUserDirectReport.ps1 index feb2cced4..ac21c406e 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUserDirectReport.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUserDirectReport.ps1 @@ -6,7 +6,19 @@ TargetName = $null Parameters = $null outputs = $null - CustomScript = @' + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -21,9 +33,9 @@ $selectProperties = $selectProperties -Join ',' $properties = "`$select=$($selectProperties)" } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] $URI = "$baseUri/$($params.UserId)/directReports?$properties" } diff --git a/module/EntraBeta/customizations/Get-EntraBetaUserExtension.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUserExtension.ps1 index 13b421f7e..ec3d33e3c 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUserExtension.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUserExtension.ps1 @@ -3,14 +3,45 @@ # ------------------------------------------------------------------------------ @{ SourceName = "Get-AzureADUserExtension" - TargetName = "Get-MgBetaUserExtension" - Parameters = @( - @{ - SourceName = "ObjectId" - TargetName = "UserId" - ConversionType = "Name" - SpecialMapping = $null - } - ) + TargetName = $null + Parameters = $null Outputs = $null -} \ No newline at end of file + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias("ObjectId")] + [System.String] $UserId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) + PROCESS { + $params = @{} + $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand + $baseUri = "https://graph.microsoft.com/beta/users/$UserId" + $properties = '$select=Identities,OnPremisesDistinguishedName,EmployeeId,CreatedDateTime' + $params["Uri"] = "$baseUri/?$properties" + + if($null -ne $PSBoundParameters["Property"]) + { + $params["Property"] = $PSBoundParameters["Property"] + $selectProperties = $PSBoundParameters["Property"] + $selectProperties = $selectProperties -Join ',' + $properties = "`$select=$($selectProperties)" + $params["Uri"] = "$baseUri/?$properties" + } + + Write-Debug("============================ TRANSFORMATIONS ============================") + $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug + Write-Debug("=========================================================================`n") + + $data = Invoke-GraphRequest -Uri $($params.Uri) -Method GET -Headers $customHeaders | Convertto-json | convertfrom-json + $data | ForEach-Object { + if($null -ne $_) { + Add-Member -InputObject $_ -MemberType AliasProperty -Name userIdentities -Value identities + } + } + $data + } +'@ +} diff --git a/module/EntraBeta/customizations/Get-EntraBetaUserManager.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUserManager.ps1 index ab840b5e4..5be69e9f4 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUserManager.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUserManager.ps1 @@ -7,6 +7,14 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [ALias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +23,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } if($PSBoundParameters.ContainsKey("Debug")) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaUserOwnedDevice.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUserOwnedDevice.ps1 index fe07f1670..8877bc656 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUserOwnedDevice.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUserOwnedDevice.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +27,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/EntraBeta/customizations/Get-EntraBetaUserOwnedObject.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUserOwnedObject.ps1 index b3f2ee308..41a3e9edb 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUserOwnedObject.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUserOwnedObject.ps1 @@ -7,12 +7,24 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $Method = "GET" $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - if ($null -ne $PSBoundParameters["ObjectId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + if ($null -ne $PSBoundParameters["UserId"]) { + $params["UserId"] = $PSBoundParameters["UserId"] } $URI = "/beta/users/$($params.UserId)/ownedObjects/?" diff --git a/module/EntraBeta/customizations/Get-EntraBetaUserRegisteredDevice.ps1 b/module/EntraBeta/customizations/Get-EntraBetaUserRegisteredDevice.ps1 index 2177b0bcc..5a813dc68 100644 --- a/module/EntraBeta/customizations/Get-EntraBetaUserRegisteredDevice.ps1 +++ b/module/EntraBeta/customizations/Get-EntraBetaUserRegisteredDevice.ps1 @@ -7,6 +7,18 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'GetQuery')] + param ( + [Parameter(ParameterSetName = "GetQuery", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Int32]] $Top, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $UserId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] $All, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String[]] $Property + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -15,9 +27,9 @@ { $params["Verbose"] = $PSBoundParameters["Verbose"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["UserId"]) { - $params["UserId"] = $PSBoundParameters["ObjectId"] + $params["UserId"] = $PSBoundParameters["UserId"] } if($null -ne $PSBoundParameters["All"]) { diff --git a/module/EntraBeta/customizations/New-EntraBetaAdministrativeUnitMember.ps1 b/module/EntraBeta/customizations/New-EntraBetaAdministrativeUnitMember.ps1 index b44ff1415..fcb59009d 100644 --- a/module/EntraBeta/customizations/New-EntraBetaAdministrativeUnitMember.ps1 +++ b/module/EntraBeta/customizations/New-EntraBetaAdministrativeUnitMember.ps1 @@ -7,6 +7,39 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] + [System.Nullable`1[System.Boolean]] $MailEnabled, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $GroupTypes, + [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] + [System.String] $DisplayName, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $Description, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $MembershipRule, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsAssignableToRole, + [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] + [System.Nullable`1[System.Boolean]] $SecurityEnabled, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $ProxyAddresses, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $Visibility, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $MembershipRuleProcessingState, + [Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)] + [System.String] $MailNickname, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $OdataType, + [Alias("Id")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $AdministrativeUnitId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AssignedLabel]] $AssignedLabels + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -107,7 +140,7 @@ Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") - $response = New-MGBetaAdministrativeUnitMember -Headers $customHeaders -AdministrativeUnitId $ID -BodyParameter $params + $response = New-MGBetaAdministrativeUnitMember -Headers $customHeaders -AdministrativeUnitId $AdministrativeUnitId -BodyParameter $params $response } '@ diff --git a/module/EntraBeta/customizations/New-EntraBetaApplicationPasswordCredential.ps1 b/module/EntraBeta/customizations/New-EntraBetaApplicationPasswordCredential.ps1 index d9d739b70..006415a6e 100644 --- a/module/EntraBeta/customizations/New-EntraBetaApplicationPasswordCredential.ps1 +++ b/module/EntraBeta/customizations/New-EntraBetaApplicationPasswordCredential.ps1 @@ -7,6 +7,20 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $EndDate, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $CustomKeyIdentifier, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $StartDate, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Value + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -25,9 +39,9 @@ { $body["displayName"] = $PSBoundParameters["CustomKeyIdentifier"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } if($PSBoundParameters.ContainsKey("Verbose")) { diff --git a/module/EntraBeta/customizations/New-EntraBetaAttributeSet.ps1 b/module/EntraBeta/customizations/New-EntraBetaAttributeSet.ps1 index 9c5d16974..83c30cf43 100644 --- a/module/EntraBeta/customizations/New-EntraBetaAttributeSet.ps1 +++ b/module/EntraBeta/customizations/New-EntraBetaAttributeSet.ps1 @@ -3,8 +3,51 @@ # ------------------------------------------------------------------------------ @{ SourceName = "New-AzureADMSAttributeSet" - TargetName = "New-MgBetaDirectoryAttributeSet" + TargetName = $null Parameters = $null Outputs = $null + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Alias('Id')] + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $AttributeSetId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Int32]] $MaxAttributesPerSet, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $Description + ) + + PROCESS { + $params = @{} + $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand + + if ($null -ne $PSBoundParameters["AttributeSetId"]) + { + $params["Id"] = $PSBoundParameters["AttributeSetId"] + } + if ($null -ne $PSBoundParameters["MaxAttributesPerSet"]) + { + $params["MaxAttributesPerSet"] = $PSBoundParameters["MaxAttributesPerSet"] + } + if ($null -ne $PSBoundParameters["Description"]) + { + $params["Description"] = $PSBoundParameters["Description"] + } + + Write-Debug("============================ TRANSFORMATIONS ============================") + $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug + Write-Debug("=========================================================================`n") + + $response = New-MgBetaDirectoryAttributeSet @params -Headers $customHeaders + $response | ForEach-Object { + if($null -ne $_) { + Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id + + } + } + $response + } +'@ } \ No newline at end of file diff --git a/module/EntraBeta/customizations/New-EntraBetaServicePrincipalPasswordCredential.ps1 b/module/EntraBeta/customizations/New-EntraBetaServicePrincipalPasswordCredential.ps1 index affba0485..532a4e606 100644 --- a/module/EntraBeta/customizations/New-EntraBetaServicePrincipalPasswordCredential.ps1 +++ b/module/EntraBeta/customizations/New-EntraBetaServicePrincipalPasswordCredential.ps1 @@ -7,18 +7,34 @@ Parameters = $null Outputs = $null CustomScript = @' + function New-EntraBetaServicePrincipalPasswordCredential { + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $CustomKeyIdentifier, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $StartDate, + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias("ObjectId")] + [System.String] $ServicePrincipalId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $Value, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.DateTime]] $EndDate + ) + PROCESS{ $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/beta/servicePrincipals' $Method = "POST" - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ServicePrincipalId"]) { - $params["ObjectId"] = $PSBoundParameters["ObjectId"] + $params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"] $params["StartDate"] = $PSBoundParameters["StartDate"] $params["EndDate"] = $PSBoundParameters["EndDate"] - $URI = "$baseUri/$($params.ObjectId)/addPassword" + $URI = "$baseUri/$($params.ServicePrincipalId)/addPassword" $body = @{ passwordCredential = @{ startDateTime = $PSBoundParameters["StartDate"]; @@ -52,6 +68,7 @@ $targetTypeList += $target } $targetTypeList - } + } +} '@ } \ No newline at end of file diff --git a/module/EntraBeta/customizations/Remove-EntraBetaApplicationProxyApplication.ps1 b/module/EntraBeta/customizations/Remove-EntraBetaApplicationProxyApplication.ps1 index 48e3ad727..3c98af220 100644 --- a/module/EntraBeta/customizations/Remove-EntraBetaApplicationProxyApplication.ps1 +++ b/module/EntraBeta/customizations/Remove-EntraBetaApplicationProxyApplication.ps1 @@ -7,14 +7,22 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Nullable`1[System.Boolean]] $RemoveADApplication + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $ObjectId = $PSBoundParameters["ObjectId"] + $ObjectId = $PSBoundParameters["ApplicationId"] } if($null -ne $PSBoundParameters["RemoveADApplication"] -and $true -eq $PSBoundParameters["RemoveADApplication"] ) { diff --git a/module/EntraBeta/customizations/Remove-EntraBetaServicePrincipalPasswordCredential.ps1 b/module/EntraBeta/customizations/Remove-EntraBetaServicePrincipalPasswordCredential.ps1 index e9d99be45..bbeb0d237 100644 --- a/module/EntraBeta/customizations/Remove-EntraBetaServicePrincipalPasswordCredential.ps1 +++ b/module/EntraBeta/customizations/Remove-EntraBetaServicePrincipalPasswordCredential.ps1 @@ -7,28 +7,29 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $KeyId, + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias("ObjectId")] + [System.String] $ServicePrincipalId + ) + PROCESS{ $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $baseUri = 'https://graph.microsoft.com/beta/servicePrincipals' $Method = "POST" - if($PSBoundParameters.ContainsKey("Verbose")) + if($null -ne $PSBoundParameters["ServicePrincipalId"] -and $null -ne $PSBoundParameters["KeyId"]) { - $params["Verbose"] = $PSBoundParameters["Verbose"] - } - if($null -ne $PSBoundParameters["ObjectId"] -and $null -ne $PSBoundParameters["KeyId"]) - { - $params["ObjectId"] = $PSBoundParameters["ObjectId"] + $params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"] $params["KeyId"] = $PSBoundParameters["KeyId"] - $URI = "$baseUri/$($params.ObjectId)/removePassword" + $URI = "$baseUri/$($params.ServicePrincipalId)/removePassword" $body = @{ "keyId" = $($params.KeyId) } } - if($PSBoundParameters.ContainsKey("Debug")) - { - $params["Debug"] = $PSBoundParameters["Debug"] - } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug Write-Debug("=========================================================================`n") diff --git a/module/EntraBeta/customizations/Set-EntraBetaApplication.ps1 b/module/EntraBeta/customizations/Set-EntraBetaApplication.ps1 index 615497fc7..ddf186048 100644 --- a/module/EntraBeta/customizations/Set-EntraBetaApplication.ps1 +++ b/module/EntraBeta/customizations/Set-EntraBetaApplication.ps1 @@ -7,6 +7,55 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.ApiApplication] $Api, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AddIn]] $AddIns, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.WebApplication] $Web, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DisplayName, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $IdentifierUris, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.ParentalControlSettings] $ParentalControlSettings, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.PreAuthorizedApplication]] $PreAuthorizedApplications, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsDeviceOnlyAuthSupported, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $Tags, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.KeyCredential]] $KeyCredentials, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $TokenEncryptionKeyId, + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $ApplicationId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsFallbackPublicClient, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.OptionalClaims] $OptionalClaims, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $GroupMembershipClaims, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.PublicClientApplication] $PublicClient, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.PasswordCredential]] $PasswordCredentials, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $OrgRestrictions, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $SignInAudience, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [Microsoft.Open.MSGraph.Model.InformationalUrl] $InformationalUrl, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.RequiredResourceAccess]] $RequiredResourceAccess, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.AppRole]] $AppRoles + ) + PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand @@ -121,9 +170,9 @@ { $params["GroupMembershipClaims"] = $PSBoundParameters["GroupMembershipClaims"] } - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] } if($null -ne $PSBoundParameters["AppRoles"]) { diff --git a/module/EntraBeta/customizations/Set-EntraBetaApplicationLogo.ps1 b/module/EntraBeta/customizations/Set-EntraBetaApplicationLogo.ps1 index 3b9626b8b..9b9e52f3e 100644 --- a/module/EntraBeta/customizations/Set-EntraBetaApplicationLogo.ps1 +++ b/module/EntraBeta/customizations/Set-EntraBetaApplicationLogo.ps1 @@ -6,7 +6,22 @@ TargetName = $null Parameters = $null outputs = $null - CustomScript = @' + CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'File')] + param ( + [Parameter(ParameterSetName = "File", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $FilePath, + [Alias('ObjectId')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = "Stream")] + [Parameter(ParameterSetName = "File")] + [Parameter(ParameterSetName = "ByteArray")] + [System.String] $ApplicationId, + [Parameter(ParameterSetName = "ByteArray", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.Byte[]] $ImageByteArray, + [Parameter(ParameterSetName = "Stream", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.IO.Stream] $FileStream + ) PROCESS { try{ $params = @{} @@ -14,9 +29,9 @@ $baseUri = 'https://graph.microsoft.com/beta/applications' $Method = "PUT" - if($null -ne $PSBoundParameters["ObjectId"]) + if($null -ne $PSBoundParameters["ApplicationId"]) { - $params["ApplicationId"] = $PSBoundParameters["ObjectId"] + $params["ApplicationId"] = $PSBoundParameters["ApplicationId"] $URI = "$baseUri/$($params.ApplicationId)/logo" } if($null -ne $PSBoundParameters["FilePath"]){ diff --git a/module/EntraBeta/customizations/Set-EntraBetaAttributeSet.ps1 b/module/EntraBeta/customizations/Set-EntraBetaAttributeSet.ps1 index 98d1da6d1..636eb66fd 100644 --- a/module/EntraBeta/customizations/Set-EntraBetaAttributeSet.ps1 +++ b/module/EntraBeta/customizations/Set-EntraBetaAttributeSet.ps1 @@ -7,70 +7,32 @@ Parameters = $null Outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = '')] + param ( + [Alias("Id")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $AttributeSetId, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.String] $Description, + [Parameter(Mandatory = $false, ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $true)] + [System.Int32] $MaxAttributesPerSet + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand - if ($null -ne $PSBoundParameters["OutVariable"]) + if ($null -ne $PSBoundParameters["AttributeSetId"]) { - $params["OutVariable"] = $PSBoundParameters["OutVariable"] - } - if($PSBoundParameters.ContainsKey("Debug")) - { - $params["Debug"] = $PSBoundParameters["Debug"] - } - if ($null -ne $PSBoundParameters["Id"]) - { - $params["AttributeSetId"] = $PSBoundParameters["Id"] - } - if ($null -ne $PSBoundParameters["PipelineVariable"]) - { - $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] - } - if ($null -ne $PSBoundParameters["InformationVariable"]) - { - $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] - } - if($PSBoundParameters.ContainsKey("Verbose")) - { - $params["Verbose"] = $PSBoundParameters["Verbose"] - } - if ($null -ne $PSBoundParameters["ProgressAction"]) - { - $params["ProgressAction"] = $PSBoundParameters["ProgressAction"] + $params["AttributeSetId"] = $PSBoundParameters["AttributeSetId"] } if ($null -ne $PSBoundParameters["Description"]) { $params["Description"] = $PSBoundParameters["Description"] } - if ($null -ne $PSBoundParameters["InformationAction"]) - { - $params["InformationAction"] = $PSBoundParameters["InformationAction"] - } if ($null -ne $PSBoundParameters["MaxAttributesPerSet"]) { $params["MaxAttributesPerSet"] = $PSBoundParameters["MaxAttributesPerSet"] } - if ($null -ne $PSBoundParameters["ErrorAction"]) - { - $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] - } - if ($null -ne $PSBoundParameters["OutBuffer"]) - { - $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] - } - if ($null -ne $PSBoundParameters["WarningAction"]) - { - $params["WarningAction"] = $PSBoundParameters["WarningAction"] - } - if ($null -ne $PSBoundParameters["ErrorVariable"]) - { - $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] - } - if ($null -ne $PSBoundParameters["WarningVariable"]) - { - $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] - } Write-Debug("============================ TRANSFORMATIONS ============================") $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug diff --git a/module/EntraBeta/customizations/Set-EntraBetaDevice.ps1 b/module/EntraBeta/customizations/Set-EntraBetaDevice.ps1 index 6b8166863..fd14729bb 100644 --- a/module/EntraBeta/customizations/Set-EntraBetaDevice.ps1 +++ b/module/EntraBeta/customizations/Set-EntraBetaDevice.ps1 @@ -3,67 +3,187 @@ # ------------------------------------------------------------------------------ @{ SourceName = "Set-AzureADDevice" - TargetName = "Update-MgBetaDevice" - Parameters = @( - @{ - SourceName = "ApproximateLastLogonTimeStamp" - TargetName = "ApproximateLastSignInDateTime" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceId" - TargetName = "DeviceId1" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceObjectVersion" - TargetName = "DeviceVersion" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceOSType" - TargetName = "OperatingSystem" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceOSVersion" - TargetName = "OperatingSystemVersion" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DevicePhysicalIds" - TargetName = "PhysicalIds" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "DeviceTrustType" - TargetName = "TrustType" - ConversionType = "Name" - SpecialMapping = $null - } - @{ - SourceName = "AlternativeSecurityIds" - TargetName = "BodyParameter" - ConversionType = "ScriptBlock" - SpecialMapping = @' - $key = [System.Text.Encoding]::UTF8.GetString($TmpValue.key) - $Temp = @{ - alternativeSecurityIds = @( - @{ - type = $TmpValue.type - key = [System.Text.Encoding]::ASCII.GetBytes($key) - } - ) + TargetName = $null + Parameters = $null + Outputs = $null + CustomScript = @' + [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.Nullable`1[System.Boolean]] $IsManaged, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $AccountEnabled, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceOSVersion, + [Alias("ObjectId")] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $DeviceObjectId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceOSType, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $ProfileType, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DisplayName, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.DateTime]] $ApproximateLastLogonTimeStamp, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Boolean]] $IsCompliant, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceTrustType, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Nullable`1[System.Int32]] $DeviceObjectVersion, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $DeviceMetadata, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.Collections.Generic.List`1[System.String]] $SystemLabels + ) + + PROCESS { + $params = @{} + $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand + + 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($PSBoundParameters.ContainsKey("Debug")) + { + $params["Debug"] = $PSBoundParameters["Debug"] + } + if($null -ne $PSBoundParameters["InformationVariable"]) + { + $params["InformationVariable"] = $PSBoundParameters["InformationVariable"] + } + if($null -ne $PSBoundParameters["OutBuffer"]) + { + $params["OutBuffer"] = $PSBoundParameters["OutBuffer"] + } + if($null -ne $PSBoundParameters["IsManaged"]) + { + $params["IsManaged"] = $PSBoundParameters["IsManaged"] + } + if($null -ne $PSBoundParameters["ErrorAction"]) + { + $params["ErrorAction"] = $PSBoundParameters["ErrorAction"] + } + if($null -ne $PSBoundParameters["AccountEnabled"]) + { + $params["AccountEnabled"] = $PSBoundParameters["AccountEnabled"] + } + if($null -ne $PSBoundParameters["PipelineVariable"]) + { + $params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] + } + if($null -ne $PSBoundParameters["DeviceOSVersion"]) + { + $params["OperatingSystemVersion"] = $PSBoundParameters["DeviceOSVersion"] + } + if($null -ne $PSBoundParameters["DeviceObjectId"]) + { + $params["DeviceId"] = $PSBoundParameters["DeviceObjectId"] + } + if($null -ne $PSBoundParameters["DeviceOSType"]) + { + $params["OperatingSystem"] = $PSBoundParameters["DeviceOSType"] + } + if($null -ne $PSBoundParameters["ProfileType"]) + { + $params["ProfileType"] = $PSBoundParameters["ProfileType"] + } + if($null -ne $PSBoundParameters["DisplayName"]) + { + $params["DisplayName"] = $PSBoundParameters["DisplayName"] + } + if($null -ne $PSBoundParameters["DeviceId"]) + { + $params["DeviceId1"] = $PSBoundParameters["DeviceId"] + } + if($null -ne $PSBoundParameters["ApproximateLastLogonTimeStamp"]) + { + $params["ApproximateLastSignInDateTime"] = $PSBoundParameters["ApproximateLastLogonTimeStamp"] + } + if($null -ne $PSBoundParameters["ErrorVariable"]) + { + $params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] + } + if($null -ne $PSBoundParameters["InformationAction"]) + { + $params["InformationAction"] = $PSBoundParameters["InformationAction"] + } + if($null -ne $PSBoundParameters["WarningAction"]) + { + $params["WarningAction"] = $PSBoundParameters["WarningAction"] + } + if($null -ne $PSBoundParameters["IsCompliant"]) + { + $params["IsCompliant"] = $PSBoundParameters["IsCompliant"] + } + if($null -ne $PSBoundParameters["OutVariable"]) + { + $params["OutVariable"] = $PSBoundParameters["OutVariable"] + } + if($null -ne $PSBoundParameters["DeviceTrustType"]) + { + $params["TrustType"] = $PSBoundParameters["DeviceTrustType"] + } + if($null -ne $PSBoundParameters["DeviceObjectVersion"]) + { + $params["DeviceVersion"] = $PSBoundParameters["DeviceObjectVersion"] + } + if($null -ne $PSBoundParameters["WarningVariable"]) + { + $params["WarningVariable"] = $PSBoundParameters["WarningVariable"] + } + if($null -ne $PSBoundParameters["ProgressAction"]) + { + $params["ProgressAction"] = $PSBoundParameters["ProgressAction"] + } + if($PSBoundParameters.ContainsKey("Verbose")) + { + $params["Verbose"] = $PSBoundParameters["Verbose"] + } + if($null -ne $PSBoundParameters["DeviceMetadata"]) + { + $params["DeviceMetadata"] = $PSBoundParameters["DeviceMetadata"] + } + if($null -ne $PSBoundParameters["SystemLabels"]) + { + $params["SystemLabels"] = $PSBoundParameters["SystemLabels"] + } + + Write-Debug("============================ TRANSFORMATIONS ============================") + $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug + Write-Debug("=========================================================================`n") + + $response = Update-MgBetaDevice @params -Headers $customHeaders + $response | ForEach-Object { + if($null -ne $_) { + Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id + } - $Value = $Temp -'@ } - ) - Outputs = $null + $response + } +'@ } \ No newline at end of file diff --git a/module/EntraBeta/customizations/Set-EntraBetaIdentityProvider.ps1 b/module/EntraBeta/customizations/Set-EntraBetaIdentityProvider.ps1 index 6b20673be..8b5f1c1fa 100644 --- a/module/EntraBeta/customizations/Set-EntraBetaIdentityProvider.ps1 +++ b/module/EntraBeta/customizations/Set-EntraBetaIdentityProvider.ps1 @@ -7,13 +7,27 @@ Parameters = $null outputs = $null CustomScript = @' + [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] + param ( + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $Type, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $ClientSecret, + [Alias('Id')] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [System.String] $IdentityProviderBaseId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $ClientId, + [Parameter(ParameterSetName = "InvokeByDynamicParameters")] + [System.String] $Name + ) PROCESS { $params = @{} $customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand $body = @{} - if($null -ne $PSBoundParameters["Id"]) + if($null -ne $PSBoundParameters["IdentityProviderBaseId"]) { - $params["IdentityProviderBaseId"] = $PSBoundParameters["Id"] + $params["IdentityProviderBaseId"] = $PSBoundParameters["IdentityProviderBaseId"] } if($null -ne $PSBoundParameters["Type"]) { diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaAdministrativeUnitMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaAdministrativeUnitMember.md index ae1fc24a5..6b8392f4a 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaAdministrativeUnitMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaAdministrativeUnitMember.md @@ -28,7 +28,7 @@ Adds an administrative unit member. ```powershell Add-EntraBetaAdministrativeUnitMember -RefObjectId - -ObjectId + -AdministrativeUnitId [] ``` @@ -49,7 +49,7 @@ Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $User = Get-EntraBetaUser -SearchString '' $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId RefObjectId = $User.ObjectId } Add-EntraBetaAdministrativeUnitMember @params @@ -57,19 +57,19 @@ Add-EntraBetaAdministrativeUnitMember @params This example shows how to add an administrative unit member. You can use the command `Get-EntraBetaAdministrativeUnit` to get administrative unit ID. You can use the command `Get-EntraBetaUser` to get user ID. -- `ObjectId` parameter specifies the ID of an administrative unit. +- `AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `RefObjectId` parameter specifies the ID of the user or group you want to add as a member of the administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of a Microsoft Entra ID administrative unit. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaApplicationOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaApplicationOwner.md index 75c593811..74c538e9a 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaApplicationOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaApplicationOwner.md @@ -26,7 +26,7 @@ Adds an owner to an application. ```powershell Add-EntraBetaApplicationOwner - -ObjectId + -ApplicationId -RefObjectId [] ``` @@ -44,7 +44,7 @@ Connect-Entra -Scopes 'Application.ReadWrite.All' $ApplicationId = (Get-EntraBetaApplication -SearchString '').ObjectId $UserObjectId = (Get-EntraBetaUser -SearchString '').ObjectId $params = @{ - ObjectId = $ApplicationId + ApplicationId = $ApplicationId RefObjectId = $UserObjectId } Add-EntraBetaApplicationOwner @params @@ -52,19 +52,19 @@ Add-EntraBetaApplicationOwner @params This example demonstrates how to add an owner to an application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of an application. +- `-ApplicationId` parameter specifies the ID of an application. - `-RefObjectId` parameter specifies the ID of a user. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredOwner.md index 50bc6b448..c0081280a 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredOwner.md @@ -27,7 +27,7 @@ Adds a registered owner for a device. ```powershell Add-EntraBetaDeviceRegisteredOwner - -ObjectId + -DeviceId -RefObjectId [] ``` @@ -42,10 +42,10 @@ The `Add-EntraBetaDeviceRegisteredOwner` cmdlet adds a registered owner for a Mi ```powershell Connect-Entra -Scopes 'Device.ReadWrite.All' -$User = Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com' +$User = Get-EntraBetaUser -UserId 'SawyerM@contoso.com' $Device = Get-EntraBetaDevice -SearchString '' $params = @{ - ObjectId = $Device.ObjectId + DeviceId = $Device.ObjectId RefObjectId = $User.ObjectId } Add-EntraBetaDeviceRegisteredOwner @params @@ -53,20 +53,20 @@ Add-EntraBetaDeviceRegisteredOwner @params This example shows how to add a registered owner to a device. -`-ObjectId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered owner. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraBetaDevice` to get device Id. +`-DeviceId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered owner. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraBetaDevice` to get device Id. `-RefObjectId` parameter specifies the unique identifier (Object ID) of the user who will be added as a registered owner of the device. The $User.ObjectId variable should contain the Object ID of the user. You can use the command `Get-EntraBetaUser` to get user Id. ## Parameters -### -ObjectId +### -DeviceId Specifies the ID of the device. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredUser.md index c02904aa9..fbf985e7e 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDeviceRegisteredUser.md @@ -27,7 +27,7 @@ Adds a registered user for a device. ```powershell Add-EntraBetaDeviceRegisteredUser - -ObjectId + -DeviceId -RefObjectId [] ``` @@ -42,10 +42,10 @@ The `Add-EntraBetaDeviceRegisteredUser` cmdlet adds a registered user for a Micr ```powershell Connect-Entra -Scopes 'Device.ReadWrite.All' -$User = Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com' +$User = Get-EntraBetaUser -UserId 'SawyerM@contoso.com' $Device = Get-EntraBetaDevice -SearchString '' $params = @{ - ObjectId = $Device.ObjectId + DeviceId = $Device.ObjectId RefObjectId = $User.ObjectId } Add-EntraBetaDeviceRegisteredUser @params @@ -53,20 +53,20 @@ Add-EntraBetaDeviceRegisteredUser @params This example shows how to add a registered user to a device. -- `-ObjectId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered user. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraBetaDevice` to get device Id. +- `-DeviceId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered user. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraBetaDevice` to get device Id. - `-RefObjectId` parameter specifies the unique identifier (Object ID) of the user who will be added as a registered user of the device. The $User.ObjectId variable should contain the Object ID of the user. You can use the command `Get-EntraBetaUser` to get user Id. ## Parameters -### -ObjectId +### -DeviceId Specifies the ID of the device. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDirectoryRoleMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDirectoryRoleMember.md index fdca40138..abb8fda01 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDirectoryRoleMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaDirectoryRoleMember.md @@ -26,7 +26,7 @@ Adds a member to a directory role. ```powershell Add-EntraBetaDirectoryRoleMember - -ObjectId + -DirectoryRoleId -RefObjectId [] ``` @@ -42,7 +42,7 @@ The `Add-EntraBetaDirectoryRoleMember` cmdlet adds a member to a Microsoft Entra ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $params = @{ - ObjectId = '019ea7a2-1613-47c9-81cb-20ba35b1ae48' + DirectoryRoleId = '019ea7a2-1613-47c9-81cb-20ba35b1ae48' RefObjectId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } Add-EntraBetaDirectoryRoleMember @params @@ -50,19 +50,19 @@ Add-EntraBetaDirectoryRoleMember @params This example adds a member to a directory role. -- `ObjectId` parameter specifies the ID of the directory role to which the member will be added. Use the `Get-EntraBetaDirectoryRole` command to retrieve the details of the directory role. +- `DirectoryRoleId` parameter specifies the ID of the directory role to which the member will be added. Use the `Get-EntraBetaDirectoryRole` command to retrieve the details of the directory role. - `RefObjectId` parameter specifies the ID of Microsoft Entra ID object to assign as owner/manager/member. ## Parameters -### -ObjectId +### -DirectoryRoleId Specifies the ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupMember.md index 3cf97b1db..7a31cd553 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupMember.md @@ -25,16 +25,16 @@ Add a member to a group. ```powershell Add-EntraBetaGroupMember - -ObjectId + -GroupId -RefObjectId [] ``` ## Description -The `Add-EntraBetaGroupMember` cmdlet adds a member to a group. Specify the `ObjectId` and `RefObjectId` parameters to add a member to a group. +The `Add-EntraBetaGroupMember` cmdlet adds a member to a group. Specify the `GroupId` and `RefObjectId` parameters to add a member to a group. -`-ObjectId` - specifies the unique identifier (Object ID) of the group to which you want to add a member. +`-GroupId` - specifies the unique identifier (Object ID) of the group to which you want to add a member. `-RefObjectId` - specifies the unique identifier (Object ID) of the member to be added to the group. @@ -45,7 +45,7 @@ The `Add-EntraBetaGroupMember` cmdlet adds a member to a group. Specify the `Obj ```powershell Connect-Entra -Scopes 'GroupMember.ReadWrite.All' $params = @{ - ObjectId = 'dddddddd-2222-3333-5555-rrrrrrrrrrrr' + GroupId = 'dddddddd-2222-3333-5555-rrrrrrrrrrrr' RefObjectId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } @@ -56,14 +56,14 @@ This example demonstrates how to add a member to a group. ## Parameters -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupOwner.md index d715acf55..558c6723c 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaGroupOwner.md @@ -26,16 +26,16 @@ Adds an owner to a group. ```powershell Add-EntraBetaGroupOwner - -ObjectId + -GroupId -RefObjectId [] ``` ## Description -The `Add-EntraBetaGroupOwner` cmdlet adds an owner to a Microsoft Entra ID group. Specify the `ObjectId` and `RefObjectId` parameters to add an owner to a group. +The `Add-EntraBetaGroupOwner` cmdlet adds an owner to a Microsoft Entra ID group. Specify the `GroupId` and `RefObjectId` parameters to add an owner to a group. -`-ObjectId` - specifies the unique identifier (Object ID) of the group to which you want to add an owner. +`-GroupId` - specifies the unique identifier (Object ID) of the group to which you want to add an owner. `-RefObjectId` - specifies the unique identifier (Object ID) of the owner to be added to the group (user or service principal). @@ -46,9 +46,9 @@ The `Add-EntraBetaGroupOwner` cmdlet adds an owner to a Microsoft Entra ID group ```powershell Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -$user = Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com' +$user = Get-EntraBetaUser -UserId 'SawyerM@contoso.com' $params = @{ - ObjectId = $group.ObjectId + GroupId = $group.ObjectId RefObjectId = $user.ObjectId } @@ -59,14 +59,14 @@ This example demonstrates how to add an owner to a group. ## Parameters -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaLifecyclePolicyGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaLifecyclePolicyGroup.md index 1e83e119f..f2251328a 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaLifecyclePolicyGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaLifecyclePolicyGroup.md @@ -27,7 +27,7 @@ Adds a group to a lifecycle policy. ```powershell Add-EntraBetaLifecyclePolicyGroup - -Id + -GroupLifecyclePolicyId -GroupId [] ``` @@ -45,7 +45,7 @@ Connect-Entra -Scopes 'Directory.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'Office365 group'" $policy = Get-EntraBetaGroupLifecyclePolicy | Select-Object -First 1 $params = @{ - Id = $policy.Id + GroupLifecyclePolicyId = $policy.Id groupId = $group.ObjectId } Add-EntraBetaLifecyclePolicyGroup @params @@ -53,7 +53,7 @@ Add-EntraBetaLifecyclePolicyGroup @params This example adds a group to the lifecycle policy. -- `-Id` parameter specifies the ID of the Lifecycle Policy add to the group. +- `-GroupLifecyclePolicyId` parameter specifies the ID of the Lifecycle Policy add to the group. - `-GroupId` parameter specifies the ID of the group add to the Lifecycle Policy. ## Parameters @@ -74,14 +74,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupLifecyclePolicyId Specifies the ID of the lifecycle policy object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaScopedRoleMembership.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaScopedRoleMembership.md index b763305a7..5176d54d6 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaScopedRoleMembership.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Add-EntraBetaScopedRoleMembership.md @@ -27,7 +27,7 @@ Assign a Microsoft Entra role with an administrative unit scope. ```powershell Add-EntraBetaScopedRoleMembership - -ObjectId + -AdministrativeUnitId [-RoleMemberInfo ] [-RoleObjectId ] [] @@ -35,7 +35,7 @@ Add-EntraBetaScopedRoleMembership ## Description -The `Add-EntraBetaScopedRoleMembership` cmdlet adds a scoped role membership to an administrative unit. Specify `ObjectId` parameter to add a scoped role membership. +The `Add-EntraBetaScopedRoleMembership` cmdlet adds a scoped role membership to an administrative unit. Specify `AdministrativeUnitId` parameter to add a scoped role membership. For delegated scenarios, the calling user needs at least the Privileged Role Administrator Microsoft Entra role. @@ -51,7 +51,7 @@ $Unit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ' + -ServicePrincipalId -RefObjectId [] ``` @@ -43,7 +43,7 @@ Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy $ServicePrincipalId = (Get-EntraBetaServicePrincipal -Top 1).ObjectId $OwnerId = (Get-EntraBetaUser -Top 1).ObjectId $Params = @{ - ObjectId = $ServicePrincipalId + ServicePrincipalId = $ServicePrincipalId RefObjectId = $OwnerId } Add-EntraBetaServicePrincipalOwner @Params @@ -51,19 +51,19 @@ Add-EntraBetaServicePrincipalOwner @Params This example demonstrates how to add an owner to a service principal. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. - `-RefObjectId` parameter specifies the user object Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnit.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnit.md index 329dfbe88..817e2eb72 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnit.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnit.md @@ -40,7 +40,7 @@ Get-EntraBetaAdministrativeUnit ```powershell Get-EntraBetaAdministrativeUnit - -ObjectId + -AdministrativeUnitId [-All] [-Property ] [] @@ -48,7 +48,7 @@ Get-EntraBetaAdministrativeUnit ## Description -The `Get-EntraBetaAdministrativeUnit` cmdlet gets a Microsoft Entra ID administrative unit. Specify `ObjectId` parameter to get a specific administrative unit. +The `Get-EntraBetaAdministrativeUnit` cmdlet gets a Microsoft Entra ID administrative unit. Specify `AdministrativeUnitId` parameter to get a specific administrative unit. ## Examples @@ -98,7 +98,7 @@ This command gets all the administrative units. ```powershell Connect-Entra -Scopes 'AdministrativeUnit.Read.All' -Get-EntraBetaAdministrativeUnit -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaAdministrativeUnit -AdministrativeUnitId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -109,7 +109,7 @@ DeletedDateTime Id Description Displa This example returns the details of the specified administrative unit. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ### Example 4: Get administrative units filter by display name @@ -176,14 +176,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnitMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnitMember.md index 42ef22a84..68bb562f1 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnitMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAdministrativeUnitMember.md @@ -27,7 +27,7 @@ Gets a member of an administrative unit. ```powershell Get-EntraBetaAdministrativeUnitMember - -ObjectId + -AdministrativeUnitId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraBetaAdministrativeUnitMember ## Description -The `Get-EntraBetaAdministrativeUnitMember` cmdlet gets a member of a Microsoft Entra ID administrative unit. Specify `ObjectId` parameters to retrieve an administrative unit member. +The `Get-EntraBetaAdministrativeUnitMember` cmdlet gets a member of a Microsoft Entra ID administrative unit. Specify `AdministrativeUnitId` parameters to retrieve an administrative unit member. In delegated scenarios with work or school accounts, the signed-in user must either be a member user or be assigned a supported Microsoft Entra role, or a custom role with the necessary permissions. The following least privileged roles are supported for this operation: @@ -46,12 +46,12 @@ In delegated scenarios with work or school accounts, the signed-in user must eit ## Examples -### Example 1: Get an administrative unit member by ObjectId +### Example 1: Get an administrative unit member by AdministrativeUnitId ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" -Get-EntraBetaAdministrativeUnitMember -ObjectId $AdministrativeUnit.ObjectId +Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId $AdministrativeUnit.Id ``` ```Output @@ -66,14 +66,14 @@ ffffffff-5555-6666-7777-aaaaaaaaaaaa This example returns the list of administrative unit members from specified administrative unit ObjectId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. -### Example 2: Get all administrative unit members by ObjectId +### Example 2: Get all administrative unit members by AdministrativeUnitId ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" -Get-EntraBetaAdministrativeUnitMember -ObjectId $AdministrativeUnit.ObjectId -All +Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId $AdministrativeUnit.Id -All ``` ```Output @@ -88,14 +88,14 @@ ffffffff-5555-6666-7777-aaaaaaaaaaaa This example returns the list of all administrative unit members from specified administrative unit ObjectId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. -### Example 3: Get top three administrative unit members by ObjectId +### Example 3: Get top three administrative unit members by AdministrativeUnitId ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" -Get-EntraBetaAdministrativeUnitMember -ObjectId $AdministrativeUnit.ObjectId -Top 3 +Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId $AdministrativeUnit.Id -Top 3 ``` ```Output @@ -108,18 +108,18 @@ dddddddd-3333-4444-5555-eeeeeeeeeeee This example returns top three administrative unit members from specified administrative unit ObjectId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplication.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplication.md index 7b38240f0..a3180d32b 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplication.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplication.md @@ -48,7 +48,7 @@ Get-EntraBetaApplication ```powershell Get-EntraBetaApplication - -ObjectId + -ApplicationId [-All] [-Property ] [] @@ -60,11 +60,11 @@ The `Get-EntraBetaApplication` cmdlet gets a Microsoft Entra ID application. ## Examples -### Example 1: Get an application by ObjectId +### Example 1: Get an application by ApplicationId ```powershell Connect-Entra -Scopes 'Application.Read.All' -Get-EntraBetaApplication -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaApplication -ApplicationId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -192,14 +192,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationExtensionProperty.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationExtensionProperty.md index c57bcbfa4..5dcbbd7af 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationExtensionProperty.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationExtensionProperty.md @@ -26,7 +26,7 @@ Gets application extension properties. ```powershell Get-EntraBetaApplicationExtensionProperty - -ObjectId + -ApplicationId [-Property ] [] ``` @@ -42,7 +42,7 @@ The `Get-EntraBetaApplicationExtensionProperty` cmdlet gets application extensio ```powershell Connect-Entra -Scopes 'Application.Read.All' $Application = Get-EntraBetaApplication -SearchString '' -Get-EntraBetaApplicationExtensionProperty -ObjectId $Application.ObjectId +Get-EntraBetaApplicationExtensionProperty -ApplicationId $Application.Id ``` ```Output @@ -53,18 +53,18 @@ DeletedDateTime Id AppDisplayName DataType IsM This command gets the extension properties for the specified application in Microsoft Entra ID. You cane use the command `Get-EntraBetaApplication` to get application Id. -- `-ObjectId` parameter specifies the the unique identifier of a application. +- `-ApplicationId` parameter specifies the the unique identifier of a application. ## Parameters -### -ObjectId +### -ApplicationId Specifies the unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationLogo.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationLogo.md index 9d98210d9..30a727d7d 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationLogo.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationLogo.md @@ -27,7 +27,7 @@ Retrieve the logo of an application. ```powershell Get-EntraBetaApplicationLogo - -ObjectId + -ApplicationId [-FileName ] [-FilePath ] [-View ] @@ -36,7 +36,7 @@ Get-EntraBetaApplicationLogo ## Description -The `Get-EntraBetaApplicationLogo` cmdlet retrieves the logo that is set for an application. Specify the `ObjectId` parameter to get a specific application logo for an application. +The `Get-EntraBetaApplicationLogo` cmdlet retrieves the logo that is set for an application. Specify the `ApplicationId` parameter to get a specific application logo for an application. ## Examples @@ -44,7 +44,7 @@ The `Get-EntraBetaApplicationLogo` cmdlet retrieves the logo that is set for an ```powershell Connect-Entra -Scopes 'Application.Read.All' -Get-EntraBetaApplicationLogo -ObjectId 'bbbbbbbb-1111-1111-1111-cccccccccccc' -FilePath 'D:\outfile1.jpg' +Get-EntraBetaApplicationLogo -ApplicationId 'bbbbbbbb-1111-1111-1111-cccccccccccc' -FilePath 'D:\outfile1.jpg' ``` This example shows how to retrieve the application logo for an application that is specified through the Object ID parameter. @@ -83,14 +83,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId -The ObjectID of the application for which the logo is to be retrieved. +The ApplicationId of the application for which the logo is to be retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationOwner.md index 31920fdee..b218c9424 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationOwner.md @@ -26,7 +26,7 @@ Gets the owner of an application. ```powershell Get-EntraBetaApplicationOwner - -ObjectId + -ApplicationId [-Top ] [-All] [-Property ] @@ -44,7 +44,7 @@ The `Get-EntraBetaApplicationOwner` cmdlet get an owner of an Microsoft Entra ID ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraBetaApplication -SearchString '' -Get-EntraBetaApplicationOwner -ObjectId $Application.ObjectId +Get-EntraBetaApplicationOwner -ApplicationId $Application.ObjectId ``` ```Output @@ -58,7 +58,7 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example demonstrates how to get the owners of an application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. ### Example 2: Get the details about the owner of an application @@ -93,7 +93,7 @@ This example demonstrates how to get the owners of an application in Microsoft E ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraBetaApplication -SearchString '' -Get-EntraBetaApplicationOwner -ObjectId $Application.ObjectId -All +Get-EntraBetaApplicationOwner -ApplicationId $Application.ObjectId -All ``` ```Output @@ -107,14 +107,14 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example demonstrates how to get the all owners of a specified application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. ### Example 4: Get top two owners of an application ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraBetaApplication -SearchString '' -Get-EntraBetaApplicationOwner -ObjectId $Application.ObjectId -Top 2 +Get-EntraBetaApplicationOwner -ApplicationId $Application.ObjectId -Top 2 ``` ```Output @@ -126,7 +126,7 @@ cccccccc-2222-3333-4444-dddddddddddd This example demonstrates how to get the two owners of a specified application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. ## Parameters @@ -146,14 +146,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationPasswordCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationPasswordCredential.md index e60ff2081..20c21a45d 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationPasswordCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationPasswordCredential.md @@ -24,14 +24,14 @@ Gets the password credential for an application. ```powershell Get-EntraBetaApplicationPasswordCredential - -ObjectId + -ApplicationId [-Property ] [] ``` ## Description -The `Get-EntraBetaApplicationPasswordCredential` cmdlet receives the password credentials for a Microsoft Entra ID application. Specify `ObjectId` parameter to cmdlet receives the password credentials. +The `Get-EntraBetaApplicationPasswordCredential` cmdlet receives the password credentials for a Microsoft Entra ID application. Specify `ApplicationId` parameter to cmdlet receives the password credentials. ## Examples @@ -40,7 +40,7 @@ The `Get-EntraBetaApplicationPasswordCredential` cmdlet receives the password cr ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraBetaApplicationPasswordCredential -ObjectId $application.ObjectId +Get-EntraBetaApplicationPasswordCredential -ApplicationId $application.ObjectId ``` ```Output @@ -51,18 +51,18 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This example shows how to retrieve the password credential for specified application. -- `-ObjectId` specifies the ID of an application object in Microsoft Entra ID. +- `-ApplicationId` specifies the ID of an application object in Microsoft Entra ID. ## Parameters -### -ObjectId +### -ApplicationId The objectID of the application for which to get the password credential. Use `Get-EntraBetaApplication` for more details. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyApplication.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyApplication.md index 853c57818..b7e918d85 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyApplication.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyApplication.md @@ -26,14 +26,14 @@ Retrieves an application configured for Application Proxy in Microsoft Entra ID. ```powershell Get-EntraBetaApplicationProxyApplication - -ObjectId + -ApplicationId [-Property ] [] ``` ## Description -The `Get-EntraBetaApplicationProxyApplication` cmdlet retrieves an application configured for Application Proxy in Microsoft Entra ID. Specify `ObjectId` parameter to retrieve application configured for application proxy. +The `Get-EntraBetaApplicationProxyApplication` cmdlet retrieves an application configured for Application Proxy in Microsoft Entra ID. Specify `ApplicationId` parameter to retrieve application configured for application proxy. ## Examples @@ -41,7 +41,7 @@ The `Get-EntraBetaApplicationProxyApplication` cmdlet retrieves an application c ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Get-EntraBetaApplicationProxyApplication -ObjectId 'bbbbbbbb-1111-2222-3333-cccccccccccc' +Get-EntraBetaApplicationProxyApplication -ApplicationId 'bbbbbbbb-1111-2222-3333-cccccccccccc' ``` ```Output @@ -53,20 +53,20 @@ https://testp-m365x99297270.msapppr... This example retrieves an application configured for Application Proxy. -- `ObjectId` parameter specifies the application ID. +- `ApplicationId` parameter specifies the application ID. ## Parameters -### -ObjectId +### -ApplicationId -This ObjectId is the unique application ID of the application. -This ObjectId can be found using the `Get-EntraBetaApplication` command. -You can also find ObjectId in the Microsoft Portal by navigating to Microsoft Entra ID, Enterprise Applications, All Applications, Select your application, go to the properties tab, and use the ObjectId on that page. +This ApplicationId is the unique application ID of the application. +This ApplicationId can be found using the `Get-EntraBetaApplication` command. +You can also find ApplicationId in the Microsoft Portal by navigating to Microsoft Entra ID, Enterprise Applications, All Applications, Select your application, go to the properties tab, and use the ObjectId on that page. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnector.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnector.md index 34bbb0e4d..5311df863 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnector.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnector.md @@ -48,7 +48,7 @@ Get-EntraBetaApplicationProxyConnector ```powershell Get-EntraBetaApplicationProxyConnector - -Id + -OnPremisesPublishingProfileId [-All] [] ``` @@ -79,7 +79,7 @@ This command Retrieve all connectors. ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Get-EntraBetaApplicationProxyConnector -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaApplicationProxyConnector -OnPremisesPublishingProfileId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -90,7 +90,7 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb This example demonstrates how to Retrieve information for a specific connector. -- `Id` parameter specifies the connector ID. +- `OnPremisesPublishingProfileId` parameter specifies the connector ID. ### Example 3: Retrieve information for a top one connector @@ -173,7 +173,7 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -Id +### -OnPremisesPublishingProfileId The ID of the specific connector. You can find this ID by running the command without this parameter to get the desired ID, or by going into the portal and viewing connector details. @@ -181,7 +181,7 @@ You can find this ID by running the command without this parameter to get the de ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorGroupMembers.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorGroupMembers.md index df56b721f..da851a247 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorGroupMembers.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorGroupMembers.md @@ -27,7 +27,7 @@ The `Get-EntraBetaApplicationProxyConnectorGroupMembers` get all the Application ```powershell Get-EntraBetaApplicationProxyConnectorGroupMembers - -Id + -OnPremisesPublishingProfileId [-All] [-Top ] [-Filter ] @@ -43,7 +43,7 @@ The `Get-EntraBetaApplicationProxyConnectorGroupMembers` get all the Application ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Get-EntraBetaApplicationProxyConnectorGroupMembers -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaApplicationProxyConnectorGroupMembers -OnPremisesPublishingProfileId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -55,13 +55,13 @@ bbbbbbbb-1111-2222-3333-cccccccccccc 106.195.6.123 AppProxy Machine active 1.5.3 This example retrieves all the connectors in the group. -- `Id` parameter specifies the connector group ID. +- `OnPremisesPublishingProfileId` parameter specifies the connector group ID. ### Example 2: Gets top one connector in the group ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Get-EntraBetaApplicationProxyConnectorGroupMembers -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Top 1 +Get-EntraBetaApplicationProxyConnectorGroupMembers -OnPremisesPublishingProfileId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Top 1 ``` ```Output @@ -72,14 +72,14 @@ bbbbbbbb-1111-2222-3333-cccccccccccc 106.195.6.123 AppProxy Machine active 1.5.3 This example retrieves top one connector in the group. -- `Id` parameter specifies the connector group ID. +- `OnPremisesPublishingProfileId` parameter specifies the connector group ID. ### Example 3: Gets the connectors in the group with filter parameter ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' $params = @{ - Id = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + OnPremisesPublishingProfileId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' Filter = "machineName eq 'AppProxy Machine'" } Get-EntraBetaApplicationProxyConnectorGroupMembers @params @@ -94,7 +94,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc 106.195.6.123 AppProxy Machine active 1.5.3 This example retrieves a connector in the group using machineName property. -- `Id` parameter specifies the connector group ID. +- `OnPremisesPublishingProfileId` parameter specifies the connector group ID. ## Parameters @@ -130,14 +130,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -Id +### -OnPremisesPublishingProfileId The ID of the Connector group. This ID can be found by running the `Get-EntraBetaApplicationProxyConnectorGroup` command. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorMemberOf.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorMemberOf.md index 3abfc44b3..13c06d158 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorMemberOf.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationProxyConnectorMemberOf.md @@ -27,7 +27,7 @@ The `Get-EntraBetaApplicationProxyConnectorMemberOf` command gets the ConnectorG ```powershell Get-EntraBetaApplicationProxyConnectorMemberOf - -Id + -OnPremisesPublishingProfileId [] ``` @@ -42,7 +42,7 @@ If no group is assigned to the connector, by default it is in 'Default.' ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Get-EntraBetaApplicationProxyConnectorMemberOf -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaApplicationProxyConnectorMemberOf -OnPremisesPublishingProfileId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -53,18 +53,18 @@ bbbbbbbb-1111-2222-3333-cccccccccccc applicationProxy False Backup Applica This example retrieves the ConnectorGroup With Specified Connector ID. -- `-Id` parameter specifies the connector ID. +- `-OnPremisesPublishingProfileId` parameter specifies the connector ID. ## Parameters -### -Id +### -OnPremisesPublishingProfileId The ID of the connector. You can find ID by running `Get-EntraBetaApplicationProxyConnector`. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationServiceEndpoint.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationServiceEndpoint.md index ab99392b4..cc092ed75 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationServiceEndpoint.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaApplicationServiceEndpoint.md @@ -24,7 +24,7 @@ Retrieve the service endpoint of an application. ```powershell Get-EntraBetaApplicationServiceEndpoint - -ObjectId + -ApplicationId [-All] [-Top ] [-Property ] @@ -46,36 +46,36 @@ Other services can use the information stored in the ServiceEndpoint entity to f ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraBetaApplicationServiceEndpoint -ObjectId $application.ObjectId +Get-EntraBetaApplicationServiceEndpoint -ApplicationId $application.ObjectId ``` This example demonstrates how to retrieve service endpoint of the application that is specified through the Object ID parameter. -`-ObjectId` parameter specifies the ID of an application object in Microsoft Entra ID. +`-ApplicationId` parameter specifies the ID of an application object in Microsoft Entra ID. ### Example 2: Get all service endpoints ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraBetaApplicationServiceEndpoint -ObjectId $application.ObjectId -All +Get-EntraBetaApplicationServiceEndpoint -ApplicationId $application.ObjectId -All ``` This example demonstrates how to retrieve all service endpoints of a specified application. -`-ObjectId` parameter specifies the ID of an application object in Microsoft Entra ID. +`-ApplicationId` parameter specifies the ID of an application object in Microsoft Entra ID. ### Example 3: Get top five service endpoints ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraBetaApplicationServiceEndpoint -ObjectId $application.ObjectId -Top 5 +Get-EntraBetaApplicationServiceEndpoint -ApplicationId $application.ObjectId -Top 5 ``` This example demonstrates how to retrieve five service endpoints of a specified application. -`-ObjectId` parameter specifies the ID of an application object in Microsoft Entra ID. +`-ApplicationId` parameter specifies the ID of an application object in Microsoft Entra ID. ## Parameters @@ -95,14 +95,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the object ID of the application for which the service endpoint is retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAttributeSet.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAttributeSet.md index 3bb4f8274..8a8edb8c3 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAttributeSet.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAttributeSet.md @@ -36,7 +36,7 @@ Get-EntraBetaAttributeSet ```powershell Get-EntraBetaAttributeSet - -Id + -AttributeSetId [] ``` @@ -75,7 +75,7 @@ This example returns all attribute sets. ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' -Get-EntraBetaAttributeSet -Id 'Testing' +Get-EntraBetaAttributeSet -AttributeSetId 'Testing' ``` ```Output @@ -86,11 +86,11 @@ Testing Attributes for engineering team 10 This example demonstrates how to retrieve an attribute set by Id. -- `Id` parameter specifies the unique identifier for the attribute set within a tenant. +- `-AttributeSetId` parameter specifies the unique identifier for the attribute set within a tenant. ## Parameters -### -Id +### -AttributeSetId Unique identifier for the attribute set within a tenant. @@ -99,7 +99,7 @@ This identifier can be up to 32 characters long and may include Unicode characte ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContact.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContact.md index c71fe9f3e..c7c97873f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContact.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContact.md @@ -38,7 +38,7 @@ Get-EntraBetaContact ```powershell Get-EntraBetaContact - -ObjectId + -OrgContactId [-All] [-Property ] [] @@ -72,7 +72,7 @@ This example retrieves all contact objects in the directory. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' -Get-EntraBetaContact -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaContact -OrgContactId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -83,7 +83,7 @@ Contoso Contact aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb contact@contoso.com This example retrieves specified contact in the directory. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ### Example 3: Retrieve all contacts objects in the directory @@ -172,14 +172,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactDirectReport.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactDirectReport.md index 9c419f47b..5e48603c8 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactDirectReport.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactDirectReport.md @@ -26,7 +26,7 @@ Get the direct reports for a contact. ```powershell Get-EntraBetaContactDirectReport - -ObjectId + -OrgContactId [-All] [-Top ] [-Property ] @@ -44,37 +44,37 @@ The `Get-EntraBetaContactDirectReport` cmdlet gets the direct reports for a cont ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Top 1 -Get-EntraBetaContactDirectReport -ObjectId $Contact.ObjectId +Get-EntraBetaContactDirectReport -OrgContactId $Contact.ObjectId ``` This example shows how to retrieve direct reports for an organizational contact. You can use the command `Get-EntraBetaContact` to get organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ### Example 2: Get all direct reports of a contact ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Top 1 -Get-EntraBetaContactDirectReport -ObjectId $Contact.ObjectId -All +Get-EntraBetaContactDirectReport -OrgContactId $Contact.ObjectId -All ``` This example shows how to retrieve all direct reports for an organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ### Example 3: Get top two direct reports of a contact ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Top 1 -Get-EntraBetaContactDirectReport -ObjectId $Contact.ObjectId -Top 2 +Get-EntraBetaContactDirectReport -OrgContactId $Contact.ObjectId -Top 2 ``` This example shows how to retrieve top two direct reports for an organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ## Parameters @@ -94,14 +94,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactManager.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactManager.md index f84876e03..e9a8ad5c5 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactManager.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactManager.md @@ -25,7 +25,7 @@ Gets the manager of a contact. ```powershell Get-EntraBetaContactManager - -ObjectId + -OrgContactId [-Property ] [] ``` @@ -41,23 +41,23 @@ The `Get-EntraBetaContactManager` cmdlet gets the manager of a contact in Micros ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Top 1 -Get-EntraBetaContactManager -ObjectId $Contact.ObjectId +Get-EntraBetaContactManager -OrgContactId $Contact.ObjectId ``` The example demonstrates how to retrieve the manager of a contact. You can use the command `Get-EntraBetaContact` to get organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ## Parameters -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactMembership.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactMembership.md index fceb80dce..4172e7400 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactMembership.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContactMembership.md @@ -26,7 +26,7 @@ Get a contact membership. ```powershell Get-EntraBetaContactMembership - -ObjectId + -OrgContactId [-All] [-Top ] [-Property ] @@ -46,7 +46,7 @@ This command is useful to administrators who need to understand which groups, ro ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Filter "DisplayName eq 'Contoso Contact'" -Get-EntrabetaContactMembership -ObjectId $Contact.ObjectId +Get-EntrabetaContactMembership -OrgContactId $Contact.ObjectId ``` ```Output @@ -64,7 +64,7 @@ This command gets all the memberships for specified contact. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Filter "DisplayName eq 'Contoso Contact'" -Get-EntraBetaContactMembership -ObjectId $Contact.ObjectId -All +Get-EntraBetaContactMembership -OrgContactId $Contact.ObjectId -All ``` ```Output @@ -82,7 +82,7 @@ This command gets all the memberships for specified contact. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Filter "DisplayName eq 'Contoso Contact'" -Get-EntraBetaContactMembership -ObjectId $Contact.ObjectId -Top 2 +Get-EntraBetaContactMembership -OrgContactId $Contact.ObjectId -Top 2 ``` ```Output @@ -112,14 +112,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContract.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContract.md index b54880cc1..075f0c3cb 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContract.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaContract.md @@ -40,7 +40,7 @@ Get-EntraBetaContract ```powershell Get-EntraBetaContract - -ObjectId + -ContractId [-All] [-Property ] [] @@ -78,7 +78,7 @@ It isn't automatically updated if the customer tenant's display name changes. - `objectType` - a string that identifies the object type. The value is always `Contract`. -- `ObjectId` - the unique identifier for the partnership. +- `ContractId` - the unique identifier for the partnership. ## Examples @@ -135,14 +135,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ContractId Specifies the ID of a contract. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedDirectoryObject.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedDirectoryObject.md index 5027af564..faaa9d2a7 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedDirectoryObject.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedDirectoryObject.md @@ -26,7 +26,7 @@ Retrieves a soft deleted directory object from the directory. ```powershell Get-EntraBetaDeletedDirectoryObject - -Id + -DirectoryObjectId [-Property ] [] ``` @@ -44,7 +44,7 @@ Office 365 Groups). ```powershell Connect-Entra -Scopes 'AdministrativeUnit.Read.All', 'Application.Read.All','Group.Read.All','User.Read.All' -Get-EntraBetaDeletedDirectoryObject -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaDeletedDirectoryObject -DirectoryObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -55,7 +55,7 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 06-08-2024 04:23:34 This example shows how to retrieve the deleted directory object from the directory. -- `-Id` parameter specifies the Id of the directory object to retrieve. +- `-DirectoryObjectId` parameter specifies the Id of the directory object to retrieve. ### Example 2: Retrieve a deleted directory object with more details. @@ -76,14 +76,14 @@ This example shows how to retrieve the deleted directory object details from the ## Parameters -### -Id +### -DirectoryObjectId The Id of the directory object to retrieve. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedGroup.md index 8e85a64b5..a3f211b9b 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedGroup.md @@ -39,7 +39,7 @@ Get-EntraBetaDeletedGroup ```powershell Get-EntraBetaDeletedGroup - -Id + -GroupId [-All] [-Property ] [] @@ -148,11 +148,11 @@ test21 aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb test21 desc1 {Unifi This cmdlet retrieves deleted groups in the directory, having the specified display name. -### Example 6: Get deleted group by Id +### Example 6: Get deleted group by GroupId ```powershell Connect-Entra -Scopes 'Group.Read.All' -Get-EntraBetaDeletedGroup -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaDeletedGroup -GroupId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -161,9 +161,9 @@ DisplayName Id MailNickname Description GroupT test21 aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb test21 desc1 {Unified, DynamicMembership} ``` -This cmdlet retrieves the deleted group specified by Id. +This cmdlet retrieves the deleted group specified by GroupId. -- `-Id` parameter specifies the deleted group ID. +- `-GroupId` parameter specifies the deleted group ID. ## Parameters @@ -200,14 +200,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -Id +### -GroupId -The Id of the deleted group to be retrieved. +The GroupId of the deleted group to be retrieved. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDevice.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDevice.md index f25094898..9f4254591 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDevice.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDevice.md @@ -50,7 +50,7 @@ Get-EntraBetaDevice ```powershell Get-EntraBetaDevice - -ObjectId + -DeviceId [-All] [-Property ] [] @@ -58,7 +58,7 @@ Get-EntraBetaDevice ## Description -The `Get-EntraBetaDevice` cmdlet gets a device from Microsoft Entra ID. Specify the `ObjectId` parameter to get a specific device. +The `Get-EntraBetaDevice` cmdlet gets a device from Microsoft Entra ID. Specify the `DeviceId` parameter to get a specific device. ## Examples @@ -66,7 +66,7 @@ The `Get-EntraBetaDevice` cmdlet gets a device from Microsoft Entra ID. Specify ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraBetaDevice -ObjectId 'bbbbbbbb-1111-1111-1111-cccccccccccc' +Get-EntraBetaDevice -DeviceId 'bbbbbbbb-1111-1111-1111-cccccccccccc' ``` ```Output @@ -195,14 +195,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -DeviceId Specifies the ID of a device in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredOwner.md index ffef44c2e..393ec542f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredOwner.md @@ -27,7 +27,7 @@ Gets the registered owner of a device. ```powershell Get-EntraBetaDeviceRegisteredOwner - -ObjectId + -DeviceId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraBetaDeviceRegisteredOwner ## Description -The `Get-EntraBetaDeviceRegisteredOwner` cmdlet gets the registered owner of a device in Microsoft Entra ID. Specify `ObjectId` parameter gets the registered owner of a device. +The `Get-EntraBetaDeviceRegisteredOwner` cmdlet gets the registered owner of a device in Microsoft Entra ID. Specify `DeviceId` parameter gets the registered owner of a device. ## Examples @@ -45,7 +45,7 @@ The `Get-EntraBetaDeviceRegisteredOwner` cmdlet gets the registered owner of a d ```powershell Connect-Entra -Scopes 'Device.Read.All' $DevId = (Get-EntraDevice -Top 1).ObjectId -Get-EntraBetaDeviceRegisteredOwner -ObjectId $DevId +Get-EntraBetaDeviceRegisteredOwner -DeviceId $DevId ``` ```Output @@ -56,13 +56,13 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Maria Sullivan maria@contoso.com M This example shows how to find the registered owner of a device.. -- `-ObjectId` parameter specifies the device's ID +- `-DeviceId` parameter specifies the device's ID ### Example 2: Retrieve the registered owner of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraBetaDeviceRegisteredOwner -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc +Get-EntraBetaDeviceRegisteredOwner -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc ``` ```Output @@ -74,13 +74,13 @@ cccccccc-2222-3333-4444-dddddddddddd Parker McLean parker@contoso.com Mem This command gets the registered owner of a device. -- `-ObjectId` parameter specifies the device's ID +- `-DeviceId` parameter specifies the device's ID ### Example 3: Retrieve all the registered owners of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraBetaDeviceRegisteredOwner -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -All +Get-EntraBetaDeviceRegisteredOwner -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc -All ``` ```Output @@ -92,13 +92,13 @@ cccccccc-2222-3333-4444-dddddddddddd Parker McLean parker@contoso.com Mem This command retrieves all the registered owners of a device. -- `-ObjectId` parameter specifies the device's ID. +- `-DeviceId` parameter specifies the device's ID. ### Example 4: Retrieve top one registered owner of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraBetaDeviceRegisteredOwner -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -Top 1 +Get-EntraBetaDeviceRegisteredOwner -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc -Top 1 ``` ```Output @@ -109,7 +109,7 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Maria Sullivan maria@contoso.com Mem This command retrieves all the registered owners of a device. -- `-ObjectId` parameter specifies the device's ID. +- `-DeviceId` parameter specifies the device's ID. ## Parameters @@ -129,14 +129,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -DeviceId Specifies the ID of an object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredUser.md index 8fbcbfbe4..72c34dc82 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeviceRegisteredUser.md @@ -27,7 +27,7 @@ Retrieve a list of users that are registered users of the device. ```powershell Get-EntraBetaDeviceRegisteredUser - -ObjectId + -DeviceId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraBetaDeviceRegisteredUser ## Description -The `Get-EntraBetaDeviceRegisteredUser` cmdlet gets a registered user for a Microsoft Entra ID device. Specify `ObjectId` parameter to get a registered user for a Microsoft Entra ID device. +The `Get-EntraBetaDeviceRegisteredUser` cmdlet gets a registered user for a Microsoft Entra ID device. Specify `DeviceId` parameter to get a registered user for a Microsoft Entra ID device. ## Examples @@ -45,7 +45,7 @@ The `Get-EntraBetaDeviceRegisteredUser` cmdlet gets a registered user for a Micr ```powershell Connect-Entra -Scopes 'Device.Read.All' $DevId = (Get-EntraDevice -Top 1).ObjectId -Get-EntraBetaDeviceRegisteredUser -ObjectId $DevId +Get-EntraBetaDeviceRegisteredUser -DeviceId $DevId ``` ```Output @@ -63,7 +63,7 @@ This example demonstrates how to retrieve registered user for a specific Microso ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraBetaDeviceRegisteredUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -All +Get-EntraBetaDeviceRegisteredUser -DeviceId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -All ``` ```Output @@ -77,13 +77,13 @@ ffffffff-4444-5555-6666-gggggggggggg This example demonstrates how to retrieve all registered users for a specified device. -- `-ObjectId` parameter specifies an object ID of a device, which you want to retrieve. +- `-DeviceId` parameter specifies an object ID of a device, which you want to retrieve. ### Example 3: Get top two registered users of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraBetaDeviceRegisteredUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Top 2 +Get-EntraBetaDeviceRegisteredUser -DeviceId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Top 2 ``` ```Output @@ -95,7 +95,7 @@ cccccccc-2222-3333-4444-dddddddddddd This example demonstrates how to retrieve top two registered users for the specified device. -- `-ObjectId` parameter specifies an object ID of a device, which you want to retrieve. +- `-DeviceId` parameter specifies an object ID of a device, which you want to retrieve. ## Parameters @@ -115,14 +115,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -DeviceId Specifies an object ID of a device. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRole.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRole.md index 712c4ffe6..5af437ed0 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRole.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRole.md @@ -38,14 +38,14 @@ Get-EntraBetaDirectoryRole ```powershell Get-EntraBetaDirectoryRole - -ObjectId + -DirectoryRoleId [-Property ] [] ``` ## Description -The `Get-EntraBetaDirectoryRole` cmdlet gets a directory role from Microsoft Entra ID. Specify `ObjectId` parameter to get a directory role. +The `Get-EntraBetaDirectoryRole` cmdlet gets a directory role from Microsoft Entra ID. Specify `DirectoryRoleId` parameter to get a directory role. ## Examples @@ -53,7 +53,7 @@ The `Get-EntraBetaDirectoryRole` cmdlet gets a directory role from Microsoft Ent ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory' -Get-EntraBetaDirectoryRole -ObjectId '56644e28-bf8b-4dad-8595-24448ffa3cb8' +Get-EntraBetaDirectoryRole -DirectoryRoleId '56644e28-bf8b-4dad-8595-24448ffa3cb8' ``` ```Output @@ -64,7 +64,7 @@ DeletedDateTime Id Description This command gets the specified directory role. -- `-ObjectId` parameter specifies the ID of a directory role in Microsoft Entra ID. +- `-DirectoryRoleId` parameter specifies the ID of a directory role in Microsoft Entra ID. ### Example 2: Get all directory roles @@ -135,14 +135,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -DirectoryRoleId Specifies the ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleAssignment.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleAssignment.md index 7d80e58d6..9e7e5f304 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleAssignment.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleAssignment.md @@ -39,7 +39,7 @@ Get-EntraBetaDirectoryRoleAssignment ```powershell Get-EntraBetaDirectoryRoleAssignment - -Id + -UnifiedRoleAssignmentId [-All] [-Property ] [] @@ -56,7 +56,7 @@ Get-EntraBetaDirectoryRoleAssignment ## Description -The `Get-EntraBetaDirectoryRoleAssignment` cmdlet gets information about role assignments in Microsoft Entra ID. To get a role assignment, specify the `Id` parameter. Specify the `SearchString` or `Filter` parameter to find a particular role assignment. +The `Get-EntraBetaDirectoryRoleAssignment` cmdlet gets information about role assignments in Microsoft Entra ID. To get a role assignment, specify the `UnifiedRoleAssignmentId` parameter. Specify the `SearchString` or `Filter` parameter to find a particular role assignment. In delegated scenarios with work or school accounts, the signed-in user must have a supported Microsoft Entra role or a custom role with one of the following permissions: @@ -114,7 +114,7 @@ This command gets all the role assignments in Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory','EntitlementManagement.Read.All' -Get-EntraBetaDirectoryRoleAssignment -Id '00001111-aaaa-2222-bbbb-3333cccc4444' +Get-EntraBetaDirectoryRoleAssignment -UnifiedRoleAssignmentId '00001111-aaaa-2222-bbbb-3333cccc4444' ``` ```Output @@ -125,7 +125,7 @@ Id PrincipalId Ro This command gets the role assignments using specified roleAssignment Id. -- `Id` parameter specifies the roleAssignment object ID. +- `UnifiedRoleAssignmentId` parameter specifies the roleAssignment object ID. ### Example 4: Get role assignments filter by principalId @@ -213,14 +213,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -Id +### -UnifiedRoleAssignmentId The unique identifier of a Microsoft Entra ID roleAssignment object. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleDefinition.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleDefinition.md index 0554e5f58..c7542f8ba 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleDefinition.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleDefinition.md @@ -49,7 +49,7 @@ Get-EntraBetaDirectoryRoleDefinition ```powershell Get-EntraBetaDirectoryRoleDefinition - -Id + -UnifiedRoleDefinitionId [-All] [-Property ] [] @@ -57,7 +57,7 @@ Get-EntraBetaDirectoryRoleDefinition ## Description -The `Get-EntraBetaDirectoryRoleDefinition` cmdlet gets information about role definitions in Microsoft Entra ID. To get a role definition, specify the `Id` parameter. Specify the SearchString or Filter parameter to find particular role definition. +The `Get-EntraBetaDirectoryRoleDefinition` cmdlet gets information about role definitions in Microsoft Entra ID. To get a role definition, specify the `UnifiedRoleDefinitionId` parameter. Specify the SearchString or Filter parameter to find particular role definition. In delegated scenarios with work or school accounts, the signed-in user must have a supported Microsoft Entra role or a custom role with one of the following permissions: @@ -90,11 +90,11 @@ Guest Inviter 44ee44ee-ff55-aa66-bb77 This command returns all the role definitions present. -### Example 2: Get a role definition by ID +### Example 2: Get a role definition by UnifiedRoleDefinitionId ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory','EntitlementManagement.Read.All' -Get-EntraBetaDirectoryRoleDefinition -Id '1a327991-10cb-4266-877a-998fb4df78ec' +Get-EntraBetaDirectoryRoleDefinition -UnifiedRoleDefinitionId '1a327991-10cb-4266-877a-998fb4df78ec' ``` ```Output @@ -105,7 +105,7 @@ Restricted Guest User 2af84b1e-32c8-42b7-82bc-daa8240402 This command returns a specified role definition. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. ### Example 3: Filter role definitions by display name @@ -155,14 +155,14 @@ This command return all the role definitions containing the specified display na ## Parameters -### -Id +### -UnifiedRoleDefinitionId Specifies the ID of the role definition. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleMember.md index e76c70957..f496561ac 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDirectoryRoleMember.md @@ -27,14 +27,14 @@ Gets members of a directory role. ```powershell Get-EntraBetaDirectoryRoleMember - -ObjectId + -DirectoryRoleId [-Property ] [] ``` ## Description -The `Get-EntraBetaDirectoryRoleMember` cmdlet retrieves the members of a directory role in Microsoft Entra ID. To obtain the members of a specific directory role, specify the `ObjectId`. Use the `Get-EntraBetaDirectoryRole` cmdlet to get the `ObjectId` value. +The `Get-EntraBetaDirectoryRoleMember` cmdlet retrieves the members of a directory role in Microsoft Entra ID. To obtain the members of a specific directory role, specify the `DirectoryRoleId`. Use the `Get-EntraBetaDirectoryRole` cmdlet to get the `DirectoryRoleId` value. ## Examples @@ -42,7 +42,7 @@ The `Get-EntraBetaDirectoryRoleMember` cmdlet retrieves the members of a directo ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory' -Get-EntraBetaDirectoryRoleMember -ObjectId '1708c380-4b8a-4977-a46e-6031676f6b41' +Get-EntraBetaDirectoryRoleMember -DirectoryRoleId '1708c380-4b8a-4977-a46e-6031676f6b41' ``` ```Output @@ -53,18 +53,18 @@ bbbbbbbb-7777-8888-9999-cccccccccccc This example retrieves the members of the specified role. -- `-ObjectId` parameter specifies directory role ID. +- `-DirectoryRoleId` parameter specifies directory role ID. ## Parameters -### -ObjectId +### -DirectoryRoleId Specifies the ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroup.md index 20841688e..5e8b59d8b 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroup.md @@ -48,7 +48,7 @@ Get-EntraBetaGroup ```powershell Get-EntraBetaGroup - -ObjectId + -GroupId [-All] [-Property ] [] @@ -56,7 +56,7 @@ Get-EntraBetaGroup ## Description -The `Get-EntraBetaGroup` cmdlet gets a group in Microsoft Entra ID. Specify the `ObjectId` parameter to get a specific group. +The `Get-EntraBetaGroup` cmdlet gets a group in Microsoft Entra ID. Specify the `GroupId` parameter to get a specific group. ## Examples @@ -79,11 +79,11 @@ SimpleGroup eeeeeeee-4444-5555-6666-ffffff This example demonstrates how to get all groups from Microsoft Entra ID. -### Example 2: Get a specific group by using an ObjectId +### Example 2: Get a specific group by using an GroupId ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroup -ObjectId 'eeeeeeee-4444-5555-6666-ffffffffffff' +Get-EntraBetaGroup -GroupId 'eeeeeeee-4444-5555-6666-ffffffffffff' ``` ```Output @@ -225,14 +225,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -GroupId -The unique identifier of a group in Microsoft Entra ID. (ObjectId). +The unique identifier of a group in Microsoft Entra ID. (GroupId) ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupAppRoleAssignment.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupAppRoleAssignment.md index f283f85a8..f45016c3d 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupAppRoleAssignment.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupAppRoleAssignment.md @@ -26,7 +26,7 @@ Gets a group application role assignment. ```powershell Get-EntraBetaGroupAppRoleAssignment - -ObjectId + -GroupId [-All] [-Top ] [-Property ] @@ -35,7 +35,7 @@ Get-EntraBetaGroupAppRoleAssignment ## Description -The `Get-EntraBetaGroupAppRoleAssignment` cmdlet gets a group application role assignment in Microsoft Entra ID. Specify the `ObjectId` parameter to get a group application role assignment. +The `Get-EntraBetaGroupAppRoleAssignment` cmdlet gets a group application role assignment in Microsoft Entra ID. Specify the `GroupId` parameter to get a group application role assignment. ## Examples @@ -44,7 +44,7 @@ The `Get-EntraBetaGroupAppRoleAssignment` cmdlet gets a group application role a ```powershell Connect-Entra -Scopes 'Directory.Read.All' $GroupId = (Get-EntraBetaGroup -Top 1).ObjectId -Get-EntraBetaGroupAppRoleAssignment -ObjectId $GroupId +Get-EntraBetaGroupAppRoleAssignment -GroupId $GroupId ``` ```Output @@ -57,13 +57,13 @@ MSVrBV4APk--eAGnHqMKBDtEqPRvu8xLqWHDSXUhoTE M365 License Manager This example retrieves the application role assignments of a group. -- `-ObjectId` parameter specifies the ID of a group in Microsoft Entra ID. +- `-GroupId` parameter specifies the ID of a group in Microsoft Entra ID. ### Example 2: Retrieve all application role assignments of a group ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaGroupAppRoleAssignment -ObjectId 'eeeeeeee-4444-5555-6666-ffffffffffff' -All +Get-EntraBetaGroupAppRoleAssignment -GroupId 'eeeeeeee-4444-5555-6666-ffffffffffff' -All ``` ```Output @@ -76,13 +76,13 @@ MSVrBV4APk--eAGnHqMKBDtEqPRvu8xLqWHDSXUhoTE M365 License Manager This example retrieves all application role assignments of the specified group. -- `-ObjectId` parameter specifies the ID of a group in Microsoft Entra ID. +- `-GroupId` parameter specifies the ID of a group in Microsoft Entra ID. ### Example 3: Retrieve top two application role assignments of a group ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaGroupAppRoleAssignment -ObjectId 'cccccccc-8888-9999-0000-dddddddddddd' -Top 2 +Get-EntraBetaGroupAppRoleAssignment -GroupId 'cccccccc-8888-9999-0000-dddddddddddd' -Top 2 ``` ```Output @@ -94,7 +94,7 @@ MSVrBV4APk--eAGnHqMKBExhQK4StEFHidLvUymzo4I ProvisioningPowerBi This example retrieves top two application role assignments of the specified group. -- `-ObjectId` parameter specifies the ID of a group in Microsoft Entra ID. +- `-GroupId` parameter specifies the ID of a group in Microsoft Entra ID. ## Parameters @@ -114,14 +114,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupLifecyclePolicy.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupLifecyclePolicy.md index 83313f32b..41cf72645 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupLifecyclePolicy.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupLifecyclePolicy.md @@ -37,14 +37,14 @@ Get-EntraBetaGroupLifecyclePolicy ```powershell Get-EntraBetaGroupLifecyclePolicy - -Id + -GroupLifecyclePolicyId [-Property ] [] ``` ## Description -The `Get-EntraBetaGroupLifecyclePolicy` command retrieves the properties and relationships of a groupLifecyclePolicies object in Microsoft Entra ID. Specify the `-Id` parameter to get the group lifecycle policy. +The `Get-EntraBetaGroupLifecyclePolicy` command retrieves the properties and relationships of a groupLifecyclePolicies object in Microsoft Entra ID. Specify the `-GroupLifecyclePolicyId` parameter to get the group lifecycle policy. If you specify no parameters, this cmdlet gets all groupLifecyclePolicies. ## Examples @@ -68,7 +68,7 @@ This example demonstrates how to retrieve the properties and relationships of al ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaGroupLifecyclePolicy -Id 'ffffffff-5555-6666-7777-aaaaaaaaaaaa' +Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId 'ffffffff-5555-6666-7777-aaaaaaaaaaaa' ``` ```Output @@ -79,18 +79,18 @@ ffffffff-5555-6666-7777-aaaaaaaaaaaa example@contoso.com 200 This command is used to retrieve a specific Microsoft Group Lifecycle Policy. -- `-Id` parameter specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. +- `-GroupLifecyclePolicyId` parameter specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. ## Parameters -### -Id +### -GroupLifecyclePolicyId Specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupMember.md index 452427393..765718a58 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupMember.md @@ -25,7 +25,7 @@ Gets a member of a group. ```powershell Get-EntraBetaGroupMember - -ObjectId + -GroupId [-Top ] [-All] [-Property ] @@ -34,7 +34,7 @@ Get-EntraBetaGroupMember ## Description -The `Get-EntraBetaGroupMember` cmdlet gets a member of a group in Microsoft Entra ID. Specify the `ObjectId` parameter to get a member of a group. +The `Get-EntraBetaGroupMember` cmdlet gets a member of a group in Microsoft Entra ID. Specify the `GroupId` parameter to get a member of a group. In delegated scenarios, the signed-in user must have a supported Microsoft Entra role or a custom role with one of the following permissions: `microsoft.directory/groups/members/read`, `microsoft.directory/groups/members/limitedRead`, or `microsoft.directory/groups/hiddenMembers/read` (for hidden members). The following least privileged roles support this operation: @@ -59,7 +59,7 @@ To list members of a hidden group, the `Member.Read.Hidden` permission is also r ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupMember -ObjectId 'eeeeeeee-4444-5555-6666-ffffffffffff' +Get-EntraBetaGroupMember -GroupId 'eeeeeeee-4444-5555-6666-ffffffffffff' ``` ```Output @@ -70,13 +70,13 @@ bbbbbbbb-7777-8888-9999-cccccccccccc This example demonstrates how to retrieve group member by ID. -- `-ObjectId` Specifies the ID of a group. +- `-GroupId` Specifies the ID of a group. ### Example 2: Get two group member ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupMember -ObjectId 'bbbbbbbb-7777-8888-9999-cccccccccccc' -Top 2 +Get-EntraBetaGroupMember -GroupId 'bbbbbbbb-7777-8888-9999-cccccccccccc' -Top 2 ``` ```Output @@ -88,13 +88,13 @@ dddddddd-9999-0000-1111-eeeeeeeeeeee This example demonstrates how to retrieve top two groups from Microsoft Entra ID. -- `-ObjectId` specifies the ID of a group. +- `-GroupId` specifies the ID of a group. ### Example 3: Get all members within a group by group ID ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupMember -ObjectId 'dddddddd-9999-0000-1111-eeeeeeeeeeee' -All +Get-EntraBetaGroupMember -GroupId 'dddddddd-9999-0000-1111-eeeeeeeeeeee' -All ``` ```Output @@ -109,13 +109,13 @@ cccccccc-8888-9999-0000-dddddddddddd This example retrieves all members within a group by group ID. -- `-ObjectId` specifies the ID of a group. +- `-GroupId` specifies the ID of a group. ### Example 4: Retrieve and Select Group Member Properties ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupMember -ObjectId 'tttttttt-0000-2222-0000-aaaaaaaaaaaa' | Select-Object DisplayName, '@odata.type' +Get-EntraBetaGroupMember -GroupId 'tttttttt-0000-2222-0000-aaaaaaaaaaaa' | Select-Object DisplayName, '@odata.type' ``` ```Output @@ -127,9 +127,9 @@ test2 #microsoft.graph.servicePrincipal test3 #microsoft.graph.servicePrincipal ``` -This example retrieves the members of a specified group by its `ObjectId` and selects only the `DisplayName` and `@odata.type` properties for each member. +This example retrieves the members of a specified group by its `GroupId` and selects only the `DisplayName` and `@odata.type` properties for each member. -- `-ObjectId` specifies the ID of a group. +- `-GroupId` specifies the ID of a group. ## Parameters @@ -149,14 +149,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupOwner.md index e43e19141..6ec3ae132 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupOwner.md @@ -25,7 +25,7 @@ Gets an owner of a group. ```powershell Get-EntraBetaGroupOwner - -ObjectId + -GroupId [-All] [-Top ] [-Property ] @@ -34,7 +34,7 @@ Get-EntraBetaGroupOwner ## Description -The `Get-EntraBetaGroupOwner` cmdlet gets an owner of a group in Microsoft Entra ID. Specify `ObjectId` parameter gets an owner of a group. +The `Get-EntraBetaGroupOwner` cmdlet gets an owner of a group in Microsoft Entra ID. Specify `GroupId` parameter gets an owner of a group. In delegated scenarios, the signed-in user must have a supported Microsoft Entra role or a custom role with the `microsoft.directory/groups/owners/read` permission. The following least privileged roles support this operation: @@ -50,7 +50,7 @@ In delegated scenarios, the signed-in user must have a supported Microsoft Entra ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupOwner -ObjectId 'bbbbbbbb-1111-2222-3333-cccccccccccc' +Get-EntraBetaGroupOwner -GroupId 'bbbbbbbb-1111-2222-3333-cccccccccccc' ``` ```Output @@ -61,13 +61,13 @@ cccccccc-2222-3333-4444-dddddddddddd This example demonstrates how to retrieve the owner of a specific group. -- `-ObjectId` parameter specifies the ID of a group. +- `-GroupId` parameter specifies the ID of a group. ### Example 2: Gets all group owners ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupOwner -ObjectId 'ffffffff-5555-6666-7777-aaaaaaaaaaaa' -All +Get-EntraBetaGroupOwner -GroupId 'ffffffff-5555-6666-7777-aaaaaaaaaaaa' -All ``` ```Output @@ -80,13 +80,13 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example demonstrates how to retrieve the all owner of a specific group. -- `-ObjectId` parameter specifies the ID of a group. +- `-GroupId` parameter specifies the ID of a group. ### Example 3: Gets two group owners ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupOwner -ObjectId 'bbbbbbbb-7777-8888-9999-cccccccccccc' -Top 2 +Get-EntraBetaGroupOwner -GroupId 'bbbbbbbb-7777-8888-9999-cccccccccccc' -Top 2 ``` ```Output @@ -98,7 +98,7 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example demonstrates how to retrieve the top two owners of a specific group. -- `-ObjectId` parameter specifies the ID of a group. +- `-GroupId` parameter specifies the ID of a group. ## Parameters @@ -118,14 +118,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupPermissionGrant.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupPermissionGrant.md index 22c5e1a78..59174b3d2 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupPermissionGrant.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaGroupPermissionGrant.md @@ -26,7 +26,7 @@ Retrieves a list of permission grants that have been consented for this group. ```powershell Get-EntraBetaGroupPermissionGrant - -Id + -GroupId [-Property ] [] ``` @@ -41,7 +41,7 @@ Retrieves a list of permission grants that have been consented for this group. ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraBetaGroupPermissionGrant -Id 'CcDdEeFfGgHhIiJjKkLlMmNnOoPpQq3' +Get-EntraBetaGroupPermissionGrant -GroupId 'CcDdEeFfGgHhIiJjKkLlMmNnOoPpQq3' ``` ```Output @@ -57,14 +57,14 @@ This cmdlet list existing permission grants for the specified group. ## Parameters -### -Id +### -GroupId The unique identifier of group. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaIdentityProvider.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaIdentityProvider.md index bcd762cae..291932b8f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaIdentityProvider.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaIdentityProvider.md @@ -36,7 +36,7 @@ Get-EntraBetaIdentityProvider ```powershell Get-EntraBetaIdentityProvider - -Id + -IdentityProviderBaseId [-Property ] [] ``` @@ -76,7 +76,7 @@ This example retrieves the list of all configured identity providers and their p ```powershell Connect-Entra -Scopes 'IdentityProvider.Read.All' -Get-EntraBetaIdentityProvider -Id 'Google-OAUTH' +Get-EntraBetaIdentityProvider -IdentityProviderBaseId 'Google-OAUTH' ``` ```Output @@ -87,18 +87,18 @@ Google-OAUTH GoogleName This example retrieves the properties for the specified identity provider. -- `-Id` parameter specifies the unique identifier of the identity provider. +- `-IdentityProviderBaseId` parameter specifies the unique identifier of the identity provider. ## Parameters -### -Id +### -IdentityProviderBaseId The unique identifier for an identity provider. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaLifecyclePolicyGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaLifecyclePolicyGroup.md index 6444dce42..f74aea62f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaLifecyclePolicyGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaLifecyclePolicyGroup.md @@ -27,14 +27,14 @@ Retrieves the lifecycle policy object to which a group belongs. ```powershell Get-EntraBetaLifecyclePolicyGroup - -Id + -GroupId [-Property ] [] ``` ## Description -The `Get-EntraBetaLifecyclePolicyGroup` retrieves the lifecycle policy object to which a group belongs. Specify the `-Id` parameter to get the lifecycle policy object to which a group belongs. +The `Get-EntraBetaLifecyclePolicyGroup` retrieves the lifecycle policy object to which a group belongs. Specify the `-GroupId` parameter to get the lifecycle policy object to which a group belongs. ## Examples @@ -42,7 +42,7 @@ The `Get-EntraBetaLifecyclePolicyGroup` retrieves the lifecycle policy object to ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaLifecyclePolicyGroup -Id 'bbbbbbbb-1111-2222-3333-cccccccccccc' +Get-EntraBetaLifecyclePolicyGroup -GroupId 'bbbbbbbb-1111-2222-3333-cccccccccccc' ``` ```Output @@ -53,18 +53,18 @@ bbbbbbbb-1111-2222-3333-cccccccccccc admingroup@contoso.com 200 This example demonstrates how to retrieve lifecycle policy object by Id in Microsoft Entra ID. -- `-Id` - specifies the ID of a group. +- `-GroupId` - specifies the ID of a group. ## Parameters -### -Id +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaScopedRoleMembership.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaScopedRoleMembership.md index 5c04bc0b8..c2b3f6896 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaScopedRoleMembership.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaScopedRoleMembership.md @@ -27,7 +27,7 @@ List Microsoft Entra role assignments with administrative unit scope. ```powershell Get-EntraBetaScopedRoleMembership - -ObjectId + -AdministrativeUnitId [-ScopedRoleMembershipId ] [-Property ] [] @@ -35,7 +35,7 @@ Get-EntraBetaScopedRoleMembership ## Description -The `Get-EntraBetaScopedRoleMembership` cmdlet lists Microsoft Entra role assignments with an administrative unit scope. Use the `ObjectId` parameter to retrieve a specific scoped role membership. +The `Get-EntraBetaScopedRoleMembership` cmdlet lists Microsoft Entra role assignments with an administrative unit scope. Use the `AdministrativeUnitId` parameter to retrieve a specific scoped role membership. ## Examples @@ -45,7 +45,7 @@ The `Get-EntraBetaScopedRoleMembership` cmdlet lists Microsoft Entra role assign Connect-Entra -Scopes 'RoleManagement.Read.Directory' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId ScopedRoleMembershipId = 'dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc' } Get-EntraBetaScopedRoleMembership @params @@ -59,15 +59,15 @@ dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc aaaaaaaa-bbbb-aaaa-bbbb-cccccccccccc bb This example gets scoped role administrator. You cane use the command `Get-EntraBetaAdministrativeUnit` to get administrative unit Id. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `-ScopedRoleMembershipId` parameter specifies the scoped role membership Id. -### Example 2: List scoped administrators for administrative unit by ObjectId +### Example 2: List scoped administrators for administrative unit by AdministrativeUnitId ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" -Get-EntraBetaScopedRoleMembership -ObjectId $AdministrativeUnit.ObjectId +Get-EntraBetaScopedRoleMembership -AdministrativeUnitId $AdministrativeUnit.ObjectId ``` ```Output @@ -76,20 +76,20 @@ Id Administrative dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc aaaaaaaa-bbbb-aaaa-bbbb-cccccccccccc bbbbbbbb-1111-2222-3333-cccccccccccc ``` -This example list scoped administrators with objectId. +This example list scoped administrators with AdministrativeUnitId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md index 9baf1c6c0..305cfcf93 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md @@ -49,7 +49,7 @@ Get-EntraBetaServicePrincipal ```powershell Get-EntraBetaServicePrincipal - -ObjectId + -ServicePrincipalId [-All] [-Property ] [] @@ -78,11 +78,11 @@ ProvisioningPowerBi cccccccc-2222-3333-4444-dddddddddddd 2222333 This example retrieves all service principals from the directory. -### Example 2: Retrieve a service principal by ObjectId +### Example 2: Retrieve a service principal by ServicePrincipalId ```powershell Connect-Entra -Scopes 'Application.Read.All' -Get-EntraBetaServicePrincipal -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraBetaServicePrincipal -ServicePrincipalId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -93,7 +93,7 @@ M365 License Manager aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 0000111 This command retrieves specific service principal. -- `-ObjectId` Parameter specifies the ID of a service principal. +- `-ServicePrincipalId` Parameter specifies the ID of a service principal. ### Example 3: Retrieve all service principals from the directory @@ -286,14 +286,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignedTo.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignedTo.md index 8941ee434..3aad9b28f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignedTo.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignedTo.md @@ -27,7 +27,7 @@ Gets app role assignments for this app or service, granted to users, groups and ```powershell Get-EntraBetaServicePrincipalAppRoleAssignedTo - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -56,7 +56,7 @@ For delegated scenarios, the calling user needs at least one of the following Mi ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalAppRoleAssignedTo -ObjectId $ServicePrincipal.ObjectId +Get-EntraBetaServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -67,14 +67,14 @@ Id AppRoleId This example shows how to get app role assignments for an app or service, granted to users, groups and other service principals. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ### Example 2: Get all app role assignments ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" - Get-EntraBetaServicePrincipalAppRoleAssignedTo -ObjectId $ServicePrincipal.ObjectId -All + Get-EntraBetaServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` ```Output @@ -89,14 +89,14 @@ Id AppRoleId This command gets the all app role assignments for the service principal granted to users, groups and other service principals. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ### Example 3: Get five app role assignments ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalAppRoleAssignedTo -ObjectId $ServicePrincipal.ObjectId -Top 5 +Get-EntraBetaServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipal.ObjectId -Top 5 ``` ```Output @@ -111,7 +111,7 @@ Id AppRoleId This command gets the five app role assignments for the service principal granted to users, groups and other service principals. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ## Parameters @@ -131,14 +131,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignment.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignment.md index b3dc9b615..9a5107689 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignment.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalAppRoleAssignment.md @@ -27,7 +27,7 @@ Gets a service principal application role assignment. ```powershell Get-EntraBetaServicePrincipalAppRoleAssignment - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -56,7 +56,7 @@ For delegated scenarios, the calling user needs at least one of the following Mi ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" - Get-EntraBetaServicePrincipalAppRoleAssignment -ObjectId $ServicePrincipal.ObjectId + Get-EntraBetaServicePrincipalAppRoleAssignment -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -67,14 +67,14 @@ Id AppRoleId This command gets application role assignments for specified service principal. You can use the command `Get-EntraBetaServicePrincipal` to get service principal Id. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ### Example 2: Retrieve all application role assignments for a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" - Get-EntraBetaServicePrincipalAppRoleAssignment -ObjectId $ServicePrincipal.ObjectId -All + Get-EntraBetaServicePrincipalAppRoleAssignment -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` ```Output @@ -89,14 +89,14 @@ Id AppRoleId This command gets all application role assignments for specified service principal. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ### Example 3: Retrieve the top three application role assignments for a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalAppRoleAssignment -ObjectId $ServicePrincipal.ObjectId -Top 3 +Get-EntraBetaServicePrincipalAppRoleAssignment -ServicePrincipalId $ServicePrincipal.ObjectId -Top 3 ``` ```Output @@ -109,7 +109,7 @@ Id AppRoleId This command gets top three application role assignments for specified service principal. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ## Parameters @@ -129,14 +129,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalCreatedObject.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalCreatedObject.md index 543951ab9..be7c919fe 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalCreatedObject.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalCreatedObject.md @@ -27,7 +27,7 @@ Get objects created by a service principal. ```powershell Get-EntraBetaServicePrincipalCreatedObject - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -45,36 +45,36 @@ The `Get-EntraBetaServicePrincipalCreatedObject` cmdlet gets an object created b ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalCreatedObject -ObjectId $ServicePrincipal.ObjectId +Get-EntraBetaServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId ``` This example gets objects created by the service principal identified by $ServicePrincipalId. You can use the command `Get-EntraBetaServicePrincipal` to get service principal ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 2: Retrieve the all objects created by a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalCreatedObject -ObjectId $ServicePrincipal.ObjectId -All +Get-EntraBetaServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` This example demonstrates how to get the all object created by a specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 3: Retrieve the top two objects created by a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalCreatedObject -ObjectId $ServicePrincipal.ObjectId -Top 2 +Get-EntraBetaServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId -Top 2 ``` This example demonstrates how to get the top two object created by a specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ## Parameters @@ -94,14 +94,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalKeyCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalKeyCredential.md index 592aa30d6..fced1101a 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalKeyCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalKeyCredential.md @@ -27,7 +27,7 @@ Get key credentials for a service principal. ```powershell Get-EntraBetaServicePrincipalKeyCredential - -ObjectId + -ServicePrincipalId [] ``` @@ -42,7 +42,7 @@ The `Get-EntraBetaServicePrincipalKeyCredential` cmdlet gets the key credentials ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalKeyCredential -ObjectId $ServicePrincipal.ObjectId +Get-EntraBetaServicePrincipalKeyCredential -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -53,18 +53,18 @@ CustomKeyIdentifier DisplayName EndDateTime Key KeyId This example retrieves the key credentials for specified service principal in Microsoft Entra ID. You can use the command `Get-EntraBetaServicePrincipal` to get a service principal object Id. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of the application for which to get the password credential. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalMembership.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalMembership.md index c2e984202..beaa7a099 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalMembership.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalMembership.md @@ -27,7 +27,7 @@ Get a service principal membership. ```powershell Get-EntraBetaServicePrincipalMembership - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -45,7 +45,7 @@ The `Get-EntraBetaServicePrincipalMembership` cmdlet gets the memberships of a s ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalMembership -ObjectId $ServicePrincipal.ObjectId +Get-EntraBetaServicePrincipalMembership -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -56,14 +56,14 @@ Id DeletedDateTime This cmdlet retrieves a specified service principal memberships in Microsoft Entra ID. You can use the command `Get-EntraBetaServicePrincipal` to get service principal ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 2: Retrieve all memberships of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalMembership -ObjectId $ServicePrincipal.ObjectId -All +Get-EntraBetaServicePrincipalMembership -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` ```Output @@ -76,14 +76,14 @@ Id DeletedDateTime This command gets all memberships of a specified service principal. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 3: Retrieve top two memberships of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalMembership -ObjectId $ServicePrincipal.ObjectId -Top 2 +Get-EntraBetaServicePrincipalMembership -ServicePrincipalId $ServicePrincipal.ObjectId -Top 2 ``` ```Output @@ -96,7 +96,7 @@ Id DeletedDateTime This command gets top two memberships of a specified service principal. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ## Parameters @@ -116,14 +116,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOAuth2PermissionGrant.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOAuth2PermissionGrant.md index 7246eda49..555ebda85 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOAuth2PermissionGrant.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOAuth2PermissionGrant.md @@ -27,7 +27,7 @@ Gets an OAuth2PermissionGrant object. ```powershell Get-EntraBetaServicePrincipalOAuth2PermissionGrant - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -45,7 +45,7 @@ The `Get-EntraBetaServicePrincipalOAuth2PermissionGrant` cmdlet gets an OAuth2Pe ```powershell Connect-Entra -Scopes 'Directory.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOAuth2PermissionGrant -ObjectId $ServicePrincipal.ObjectId +Get-EntraBetaServicePrincipalOAuth2PermissionGrant -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -56,14 +56,14 @@ A1bC2dE3f... 00001111-aaaa-2222-bbbb-3333cccc4444 AllPrinci This cmdlet retrieves a OAuth2PermissionGrant object for a service principal in Microsoft Entra ID. You can use the command `Get-EntraBetaServicePrincipal` to get service principal Id. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ### Example 2: Get all OAuth2 permission grants of a service principal ```powershell Connect-Entra -Scopes 'Directory.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOAuth2PermissionGrant -ObjectId $ServicePrincipal.ObjectId -All +Get-EntraBetaServicePrincipalOAuth2PermissionGrant -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` ```Output @@ -76,14 +76,14 @@ A1bC2dE3f... 00001111-aaaa-2222-bbbb-3333cccc4444 Principal This example demonstrates how to get all OAuth2PermissionGrant objects for a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ### Example 3: Get two OAuth2 permission grants of a service principal ```powershell Connect-Entra -Scopes 'Directory.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOAuth2PermissionGrant -ObjectId $ServicePrincipal.ObjectId -Top 2 +Get-EntraBetaServicePrincipalOAuth2PermissionGrant -ServicePrincipalId $ServicePrincipal.ObjectId -Top 2 ``` ```Output @@ -95,7 +95,7 @@ A1bC2dE3f... 00001111-aaaa-2222-bbbb-3333cccc4444 Principal This example demonstrates how to get top two OAuth2PermissionGrant objects for a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ## Parameters @@ -115,14 +115,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwnedObject.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwnedObject.md index 36972aba2..c8395664e 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwnedObject.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwnedObject.md @@ -26,7 +26,7 @@ Gets an object owned by a service principal. ```powershell Get-EntraBetaServicePrincipalOwnedObject - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -44,7 +44,7 @@ The `Get-EntraBetaServicePrincipalOwnedObject` cmdlet retrieves an object owned ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOwnedObject -ObjectId $ServicePrincipal.ObjectId +Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -55,14 +55,14 @@ bbbbbbbb-1111-2222-3333-cccccccccccc The command retrieves the owned objects of a service principal. -- `-ObjectId` Parameter specifies the ID of a service principal. +- `-ServicePrincipalId` Parameter specifies the ID of a service principal. ### Example 2: Retrieve the all owned objects of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipalId = (Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''").ObjectId -Get-EntraBetaServicePrincipalOwnedObject -ObjectId $ServicePrincipalId -All +Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipalId -All ``` ```Output @@ -74,14 +74,14 @@ cccccccc-2222-3333-4444-dddddddddddd This example retrieves an object owned by a service principal in Microsoft Entra ID. You can use the command `Get-EntraBetaServicePrincipal` to get service principal Id. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ### Example 2: Retrieve all owned objects of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOwnedObject -ObjectId $ServicePrincipal.ObjectId -All +Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` ```Output @@ -93,14 +93,14 @@ cccccccc-2222-3333-4444-dddddddddddd The command receives the all owned objects of a service principal. -- `-ObjectId` Parameter specifies the ID of a service principal. +- `-ServicePrincipalId` Parameter specifies the ID of a service principal. ### Example 3: Retrieve top one owned object of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOwnedObject -ObjectId $ServicePrincipal.ObjectId -Top 1 +Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId -Top 1 ``` ```Output @@ -111,7 +111,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example retrieves the top one owned object of a specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ## Parameters @@ -131,14 +131,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwner.md index 0816d5a8f..ed2ff89ad 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalOwner.md @@ -25,7 +25,7 @@ Get the owner of a service principal. ```powershell Get-EntraBetaServicePrincipalOwner - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -43,7 +43,7 @@ The `Get-EntraBetaServicePrincipalOwner` cmdlet gets the owners of a service pri ```powershell Connect-Entra -Scopes 'Application.Read.All' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOwner -ObjectId $servicePrincipal.ObjectId +Get-EntraBetaServicePrincipalOwner -ServicePrincipalId $servicePrincipal.ObjectId ``` ```Output @@ -56,14 +56,14 @@ cccccccc-2222-3333-4444-dddddddddddd This example gets the owners of a specified service principal. You can use the comand `Get-EntraBetaServicePrincipal` to get service principal object Id. -- `-ObjectId` parameter specifies the unique identifier of a service principal. +- `-ServicePrincipalId` parameter specifies the unique identifier of a service principal. ### Example 2: Retrieve all the owners of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalOwner -ObjectId $servicePrincipal.ObjectId -All +Get-EntraBetaServicePrincipalOwner -ServicePrincipalId $servicePrincipal.ObjectId -All ``` ```Output @@ -76,7 +76,7 @@ cccccccc-2222-3333-4444-dddddddddddd This command gets all the owners of a service principal. You can use the comand `Get-EntraBetaServicePrincipal` to get service principal object Id. -- `-ObjectId` parameter specifies the unique identifier of a service principal. +- `-ServicePrincipalId` parameter specifies the unique identifier of a service principal. ### Example 3: Retrieve top two owners of a service principal @@ -95,7 +95,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This command gets top two owners of a service principal. You can use the comand `Get-EntraBetaServicePrincipal` to get service principal object Id. -- `-ObjectId` parameter specifies the unique identifier of a service principal. +- `-ServicePrincipalId` parameter specifies the unique identifier of a service principal. ### Example 4: Retrieve service principal owner details @@ -103,7 +103,7 @@ This command gets top two owners of a service principal. You can use the comand Connect-Entra -Scopes 'Application.Read.All' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" # Get the owners of the service principal -$owners = Get-EntraBetaServicePrincipalOwner -ObjectId $servicePrincipal.ObjectId -All +$owners = Get-EntraBetaServicePrincipalOwner -ServicePrincipalId $servicePrincipal.ObjectId -All $result = @() # Loop through each owner and get their UserPrincipalName and DisplayName @@ -149,14 +149,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalPasswordCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalPasswordCredential.md index 77e219f5a..b390e6da6 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalPasswordCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipalPasswordCredential.md @@ -27,7 +27,7 @@ Get credentials for a service principal. ```powershell Get-EntraBetaServicePrincipalPasswordCredential - -ObjectId + -ServicePrincipalId [] ``` @@ -42,7 +42,7 @@ The `Get-EntraBetaServicePrincipalPasswordCredential` cmdlet gets the password c ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Get-EntraBetaServicePrincipalPasswordCredential -ObjectId $ServicePrincipal.ObjectId +Get-EntraBetaServicePrincipalPasswordCredential -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -55,18 +55,18 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This example retrieves the password credentials for specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the object ID of a service principal. You can use the command `Get-EntraBetaServicePrincipal` to get a service principal Id. +- `-ServicePrincipalId` parameter specifies the object ID of a service principal. You can use the command `Get-EntraBetaServicePrincipal` to get a service principal Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of the service principal for which to get password credentials. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md index f4c0b9a6d..50dfc9473 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md @@ -37,7 +37,7 @@ Get-EntraBetaSubscribedSku ```powershell Get-EntraBetaSubscribedSku - -ObjectId + -SubscribedSkuId [-Property ] [] ``` @@ -65,11 +65,11 @@ cccc2222-dd33-4444-55ee-666666ffffff 2222cccc-33dd-eeee-ff44-aaaaaa555555 M365x9 This example demonstrates how to retrieve subscribed SKUs to Microsoft services. -### Example 2: Get subscribed SKUs by ObjectId +### Example 2: Get subscribed SKUs by SubscribedSkuId ```powershell Connect-Entra -Scopes 'Organization.Read.All' -Get-EntraBetaSubscribedSku -ObjectId 'aaaaaaaa-0b0b-1c1c-2d2d-333333333333' +Get-EntraBetaSubscribedSku -SubscribedSkuId 'aaaaaaaa-0b0b-1c1c-2d2d-333333333333' ``` ```Output @@ -80,7 +80,7 @@ aaaa0000-bb11-2222-33cc-444444dddddd 0000aaaa-11bb-cccc-dd22-eeeeee333333 M365x9 This example demonstrates how to retrieve specified subscribed SKUs to Microsoft services. -- `-ObjectId` parameter specifies the ID of the SKU (Stock Keeping Unit). +- `-SubscribedSkuId` parameter specifies the ID of the SKU (Stock Keeping Unit). ### Example 3: Retrieve all users assigned a specific license @@ -128,7 +128,7 @@ foreach ($User in $SelectedUsers) { try { # Check if the group display name is already in the hashtable if (-not $GroupDisplayNames.ContainsKey($AssignedByGroup)) { - $Group = Get-EntraBetaGroup -ObjectId $AssignedByGroup + $Group = Get-EntraBetaGroup -GroupId $AssignedByGroup $GroupDisplayNames[$AssignedByGroup] = $Group.DisplayName } @@ -164,14 +164,14 @@ This example shows a list of users, their licenses, and the source of the licens ## Parameters -### -ObjectId +### -SubscribedSkuId The object ID of the SKU (Stock Keeping Unit). ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index fa2640f96..898d47ed3 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -50,7 +50,7 @@ Get-EntraBetaUser ```powershell Get-EntraBetaUser - -ObjectId + -UserId [-All] [-Property ] [] @@ -83,7 +83,7 @@ This example demonstrates how to get top three users from Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUser -UserId 'SawyerM@contoso.com' ``` ```Output @@ -94,7 +94,7 @@ Sawyer Miller bbbbbbbb-1111-2222-3333-cccccccccccc sawyerm@tenant.com sawyerm@te This command gets the specified user. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. ### Example 3: Search among retrieved users @@ -146,7 +146,7 @@ In this example, we retrieve all users whose MailNickname starts with Ada. ```powershell Connect-Entra -Scopes 'User.Read.All','AuditLog.Read.All' -Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com' -Property 'SignInActivity' | Select-Object -ExpandProperty 'SignInActivity' +Get-EntraBetaUser -UserId 'SawyerM@contoso.com' -Property 'SignInActivity' | Select-Object -ExpandProperty 'SignInActivity' ``` ```Output @@ -344,14 +344,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID (as a User Principal Name (UPN) or ObjectId) of a user in Microsoft Entra ID. +Specifies the ID (as a User Principal Name (UPN) or UserId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserCreatedObject.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserCreatedObject.md index f0bf4e47e..3e35c7cb2 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserCreatedObject.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserCreatedObject.md @@ -26,7 +26,7 @@ Get objects created by the user. ```powershell Get-EntraBetaUserCreatedObject - -ObjectId + -UserId [-All] [-Top ] [] @@ -42,7 +42,7 @@ The `Get-EntraBetaUserCreatedObject` cmdlet gets objects created by a user in Mi ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraBetaUserCreatedObject -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserCreatedObject -UserId 'SawyerM@contoso.com' ``` ```Output @@ -56,13 +56,13 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example retrieves an object created by the specified user. -- `-ObjectId` parameter specifies the object Id of a user(as a UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the object Id of a user(as a UserPrincipalName or UserId). ### Example 2: Get all user-created objects ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraBetaUserCreatedObject -ObjectId 'SawyerM@contoso.com' -All +Get-EntraBetaUserCreatedObject -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -76,13 +76,13 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example retrieves all objects created by the specified user. -- `-ObjectId` parameter specifies the object Id of a user(as a UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the object Id of a user(as a UserPrincipalName or UserId). ### Example 3: Get a top one user-created object ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraBetaUserCreatedObject -ObjectId 'SawyerM@contoso.com' -Top 1 +Get-EntraBetaUserCreatedObject -UserId 'SawyerM@contoso.com' -Top 1 ``` ```Output @@ -93,7 +93,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example retrieves top one object created by the specified user. -- `-ObjectId` parameter specifies the object Id of a user(as a UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the object Id of a user(as a UserPrincipalName or UserId). ## Parameters @@ -113,14 +113,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID (as a UserPrincipalName or ObjectId) of a user in Microsoft Entra ID. +Specifies the ID (as a UserPrincipalName or UserId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserDirectReport.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserDirectReport.md index ed7fe5ae3..c392a9b9a 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserDirectReport.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserDirectReport.md @@ -26,7 +26,7 @@ Get the user's direct reports. ```powershell Get-EntraBetaUserDirectReport - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -43,7 +43,7 @@ The `Get-EntraBetaUserDirectReport` cmdlet gets the direct reports for a user in ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraBetaUserDirectReport -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserDirectReport -UserId 'SawyerM@contoso.com' ``` ```Output @@ -54,13 +54,13 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example demonstrates how to retrieve direct reports for a user in Microsoft Entra ID. -- `-ObjectId` Parameter specifies the ID of a user (UserPrincipalName or ObjectId). +- `-UserId` Parameter specifies the ID of a user (UserPrincipalName or UserId). ### Example 2: Get all direct reports ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraBetaUserDirectReport -ObjectId 'SawyerM@contoso.com' -All +Get-EntraBetaUserDirectReport -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -72,13 +72,13 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb This example demonstrates how to retrieve all direct reports for a user in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a user (UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the ID of a user (UserPrincipalName or UserId). ### Example 3: Get a top two direct reports ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraBetaUserDirectReport -ObjectId 'SawyerM@contoso.com' -Top 2 +Get-EntraBetaUserDirectReport -UserId 'SawyerM@contoso.com' -Top 2 ``` ```Output @@ -90,7 +90,7 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb This example demonstrates how to retrieve top five direct reports for a user in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a user (UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the ID of a user (UserPrincipalName or UserId). ## Parameters @@ -110,14 +110,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user's UserPrincipalName or ObjectId in Microsoft Entra ID. +Specifies the ID of a user's UserPrincipalName or UserId in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserExtension.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserExtension.md index cb3b8e3d8..2774efafd 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserExtension.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserExtension.md @@ -26,7 +26,7 @@ Gets a user extension. ```powershell Get-EntraBetaUserExtension - -ObjectId + -UserId [-Property ] [] ``` @@ -42,29 +42,33 @@ The `Get-EntraBetaUserExtension` cmdlet gets a user extension in Microsoft Entra ```powershell Connect-Entra -Scopes 'User.Read' $UserId = (Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com').ObjectId -Get-EntraBetaUserExtension -ObjectId $UserId +Get-EntraBetaUserExtension -UserId $UserId ``` ```Output -Id --- -com.contoso.roamingSettings +onPremisesDistinguishedName : +@odata.context : https://graph.microsoft.com/beta/$metadata#users(identities,onPremisesDistinguishedName,employeeId,createdDateTime)/$entity +identities : {@{issuer=SawyerM@contoso.com; signInType=userPrincipalName; issuerAssignedId=SawyerM@contoso.com}} +employeeId : +id : 00aa00aa-bb11-cc22-dd33-44ee44ee44ee +createdDateTime : 18/07/2024 05:13:40 +userIdentities : {@{issuer=SawyerM@contoso.com; signInType=userPrincipalName; issuerAssignedId=SawyerM@contoso.com}} ``` This example shows how to retrieve the extension attributes for a specified user. You can use the command `Get-EntraBetaUser` to get user object Id. -- `-ObjectId` parameter specifies the user object Id. +- `-UserId` parameter specifies the user object Id. ## Parameters -### -ObjectId +### -UserId Specifies the ID of an object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserLicenseDetail.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserLicenseDetail.md index ad2e47f90..41e037b00 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserLicenseDetail.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserLicenseDetail.md @@ -26,7 +26,7 @@ Retrieves license details for a user. ```powershell Get-EntraBetaUserLicenseDetail - -ObjectId + -UserId [-Property ] [] ``` @@ -41,7 +41,7 @@ This cmdlet retrieves license details for a user. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserLicenseDetail -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserLicenseDetail -UserId 'SawyerM@contoso.com' ``` ```Output @@ -56,14 +56,14 @@ This example demonstrates how to retrieve license details for a user from Micros ## Parameters -### -ObjectId +### -UserId The object ID of the user for which the license details are retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md index 09c4f63db..1bfd165f6 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md @@ -27,7 +27,7 @@ Gets the manager of a user. ```powershell Get-EntraBetaUserManager - -ObjectId + -UserId [-Property ] [] ``` @@ -35,7 +35,7 @@ Get-EntraBetaUserManager ## Description The `Get-EntraBetaUserManager` cmdlet gets the manager of a user in Microsoft Entra ID. Specify -`ObjectId` parameter to get the specific manager of user. +`UserId` parameter to get the specific manager of user. ## Examples @@ -43,7 +43,7 @@ The `Get-EntraBetaUserManager` cmdlet gets the manager of a user in Microsoft En ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserManager -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserManager -UserId 'SawyerM@contoso.com' ``` ```Output @@ -62,7 +62,7 @@ displayName : Sawyer Miller This example demonstrates how to retrieve the manager of a specific user. -- `-ObjectId` Parameter specifies ObjectID or User Principal Name of User. +- `-UserId` Parameter specifies UserId or User Principal Name of User. ### Example 2: Retrieve users without managers @@ -93,14 +93,14 @@ This example demonstrates how to retrieve users without managers. ## Parameters -### -ObjectId +### -UserId -The unique identifier of a user in Microsoft Entra ID (User Principal Name or ObjectId). +The unique identifier of a user in Microsoft Entra ID (User Principal Name or UserId). ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md index 5f39f434f..3cc00741b 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md @@ -26,7 +26,7 @@ Get user memberships. ```powershell Get-EntraBetaUserMembership - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -43,7 +43,7 @@ The `Get-EntraBetaUserMembership` cmdlet gets user memberships in Microsoft Entr ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraBetaUserMembership -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserMembership -UserId 'SawyerM@contoso.com' ``` ```Output @@ -90,7 +90,7 @@ This example demonstrates how to retrieve user memberships in Microsoft Entra ID ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraBetaUserMembership -ObjectId 'SawyerM@contoso.com' -All +Get-EntraBetaUserMembership -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -110,7 +110,7 @@ This example demonstrates how to retrieve users all memberships in Microsoft Ent ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraBetaUserMembership -ObjectId 'SawyerM@contoso.com' -Top 3 +Get-EntraBetaUserMembership -UserId 'SawyerM@contoso.com' -Top 3 ``` ```Output @@ -157,14 +157,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOAuth2PermissionGrant.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOAuth2PermissionGrant.md index 9984a83a8..71433e536 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOAuth2PermissionGrant.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOAuth2PermissionGrant.md @@ -27,7 +27,7 @@ Gets an oAuth2PermissionGrant object. ```powershell Get-EntraBetaUserOAuth2PermissionGrant - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraBetaUserOAuth2PermissionGrant ## Description -The `Get-EntraBetaUserOAuth2PermissionGrant` cmdlet gets an oAuth2PermissionGrant object for the specified user in Microsoft Entra ID. Specify `ObjectId` parameter to retrieve an oAuth2PermissionGrant object. +The `Get-EntraBetaUserOAuth2PermissionGrant` cmdlet gets an oAuth2PermissionGrant object for the specified user in Microsoft Entra ID. Specify `UserId` parameter to retrieve an oAuth2PermissionGrant object. In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation. @@ -56,7 +56,7 @@ In delegated scenarios with work or school accounts, the signed-in user must be ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaUserOAuth2PermissionGrant -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserOAuth2PermissionGrant -UserId 'SawyerM@contoso.com' ``` ```Output @@ -66,13 +66,13 @@ HXFXwKLgoUC4rwbZbCDIdffW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 00001111-aaaa-2 9uBzRwC0s0CFCDQN6O4Ik_fW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 11112222-bbbb-3333-cccc-4444dddd5555 Principal 13-01-2024 08:0... ``` -This example retrieves the OAuth2 permission grants for a user using the ObjectId parameter. Use the `Get-EntraBetaUser` cmdlet to obtain the `ObjectId` value. +This example retrieves the OAuth2 permission grants for a user using the ObjectId parameter. Use the `Get-EntraBetaUser` cmdlet to obtain the `UserId` value. ### Example 2: Retrieve the OAuth2 permission grants for a user using object ID parameter ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaUserOAuth2PermissionGrant -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserOAuth2PermissionGrant -UserId 'SawyerM@contoso.com' ``` ```Output @@ -84,13 +84,13 @@ HXFXwKLgoUC4rwbZbCDIdffW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 00001111-aaaa-2 This example retrieves the OAuth2 permission grants for a user using object ID parameter. -- `-ObjectId` parameter specifies the user ID. +- `-UserId` parameter specifies the user ID. ### Example 3: Retrieve the OAuth2 permission grants for a user using All parameter ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaUserOAuth2PermissionGrant -ObjectId 'SawyerM@contoso.com' -All +Get-EntraBetaUserOAuth2PermissionGrant -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -102,13 +102,13 @@ HXFXwKLgoUC4rwbZbCDIdffW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 00001111-aaaa-2 This example retrieves the OAuth2 permission grants for a user using All parameter. -- `-ObjectId` parameter specifies the user ID. +- `-UserId` parameter specifies the user ID. ### Example 4: Retrieve top one OAuth2 permission grant ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraBetaUserOAuth2PermissionGrant -ObjectId 'SawyerM@contoso.com' -Top 1 +Get-EntraBetaUserOAuth2PermissionGrant -UserId 'SawyerM@contoso.com' -Top 1 ``` ```Output @@ -119,7 +119,7 @@ HXFXwKLgoUC4rwbZbCDIdffW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 00001111-aaaa-2 This Example Retrieve top one the OAuth2 permission grant in Microsoft Entra ID. -- `-ObjectId` parameter specifies the user ID. +- `-UserId` parameter specifies the user ID. ## Parameters @@ -139,14 +139,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId Specifies the ID (as a User Principal Name or ObjectId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedDevice.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedDevice.md index 0c2f39fa5..5ec1dd0fc 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedDevice.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedDevice.md @@ -26,7 +26,7 @@ Get registered devices owned by a user. ```powershell Get-EntraBetaUserOwnedDevice - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -43,7 +43,7 @@ The `Get-EntraBetaUserOwnedDevice` cmdlet gets registered devices owned by the s ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserOwnedDevice -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserOwnedDevice -UserId 'SawyerM@contoso.com' ``` ```Output @@ -59,7 +59,7 @@ This command gets the registered devices owned by the specified user. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserOwnedDevice -ObjectId 'SawyerM@contoso.com' -All +Get-EntraBetaUserOwnedDevice -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -75,7 +75,7 @@ This command gets all the registered devices owned by the specified user. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserOwnedDevice -ObjectId 'SawyerM@contoso.com' -Top 1 +Get-EntraBetaUserOwnedDevice -UserId 'SawyerM@contoso.com' -Top 1 ``` ```Output @@ -104,14 +104,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a User Principal Name or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedObject.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedObject.md index c16dcd706..4fbb8e049 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedObject.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserOwnedObject.md @@ -27,7 +27,7 @@ Get objects owned by a user. ```powershell Get-EntraBetaUserOwnedObject - -ObjectId + -UserId [-Top ] [-All] [-Property ] @@ -36,7 +36,7 @@ Get-EntraBetaUserOwnedObject ## Description -The `Get-EntraBetaUserOwnedObject` cmdlet gets objects owned by a user in Microsoft Entra ID. Specify `ObjectId` parameter to get objects owned by user. +The `Get-EntraBetaUserOwnedObject` cmdlet gets objects owned by a user in Microsoft Entra ID. Specify `UserId` parameter to get objects owned by user. ## Examples @@ -44,7 +44,7 @@ The `Get-EntraBetaUserOwnedObject` cmdlet gets objects owned by a user in Micros ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraBetaUserOwnedObject -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserOwnedObject -UserId 'SawyerM@contoso.com' ``` ```Output @@ -55,7 +55,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example retrieves objects owned by the specified user. -- `-ObjectId` Parameter specifies the ID of a user as a UserPrincipalName or ObjectId. +- `-UserId` Parameter specifies the ID of a user as a UserPrincipalName or UserId. ### Example 2: Get objects owned by a user with additional details @@ -87,7 +87,7 @@ This example retrieves objects owned by the specified user with more lookup deta ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraBetaUserOwnedObject -ObjectId 'SawyerM@contoso.com' -All +Get-EntraBetaUserOwnedObject -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -100,13 +100,13 @@ cccccccc-2222-3333-4444-dddddddddddd This example retrieves all the objects owned by the specified user. -- `-ObjectId` parameter specifies the ID of a user as a UserPrincipalName or ObjectId. +- `-UserId` parameter specifies the ID of a user as a UserPrincipalName or UserId. ### Example 4: Get top three objects owned by a user ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraBetaUserOwnedObject -ObjectId 'SawyerM@contoso.com' -Top 3 +Get-EntraBetaUserOwnedObject -UserId 'SawyerM@contoso.com' -Top 3 ``` ```Output @@ -119,7 +119,7 @@ cccccccc-2222-3333-4444-dddddddddddd This example retrieves the top three objects owned by the specified user. -- `-ObjectId` parameter specifies the ID of a user as a UserPrincipalName or ObjectId. +- `-UserId` parameter specifies the ID of a user as a UserPrincipalName or UserId. ## Parameters @@ -139,14 +139,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a User Principal Name or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserRegisteredDevice.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserRegisteredDevice.md index 44ac74d69..220fc0799 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserRegisteredDevice.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserRegisteredDevice.md @@ -27,7 +27,7 @@ Get devices registered by a user. ```powershell Get-EntraBetaUserRegisteredDevice - -ObjectId + -UserId [-Top ] [-All] [-Property ] @@ -44,7 +44,7 @@ The `Get-EntraBetaUserRegisteredDevice` cmdlet gets devices registered by a user ```Powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserRegisteredDevice -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserRegisteredDevice -UserId 'SawyerM@contoso.com' ``` ```Output @@ -60,7 +60,7 @@ This command gets the devices that are registered to the specified user. ```Powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserRegisteredDevice -ObjectId 'SawyerM@contoso.com' -All +Get-EntraBetaUserRegisteredDevice -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -76,7 +76,7 @@ This command gets all the devices that are registered to the specified user. ```Powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraBetaUserRegisteredDevice -ObjectId 'SawyerM@contoso.com' -Top 1 +Get-EntraBetaUserRegisteredDevice -UserId 'SawyerM@contoso.com' -Top 1 ``` ```Output @@ -105,14 +105,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a User Principal Name or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserThumbnailPhoto.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserThumbnailPhoto.md index 16031e352..c5754b6c6 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserThumbnailPhoto.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserThumbnailPhoto.md @@ -26,7 +26,8 @@ Retrieve the thumbnail photo of a user. ```powershell Get-EntraBetaUserThumbnailPhoto - -ObjectId + -UserId + [-Property ] [] ``` @@ -40,7 +41,7 @@ Retrieve the thumbnail photo of a user. ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraBetaUserThumbnailPhoto -ObjectId 'SawyerM@contoso.com' +Get-EntraBetaUserThumbnailPhoto -UserId 'SawyerM@contoso.com' ``` ```Output @@ -49,20 +50,20 @@ Id Height Width default 292 278 ``` -This example shows how to retrieve the thumbnail photo of a user that is specified through the value of the ObejctId parameter. +This example shows how to retrieve the thumbnail photo of a user that is specified through the value of the UserId parameter. -- `-ObjectId` parameter specifies the user for which the thumbnail photo is retrieved. +- `-UserId` parameter specifies the user for which the thumbnail photo is retrieved. ## Parameters -### -ObjectId +### -UserId The object ID of the user for which the thumbnail photo is retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAdministrativeUnitMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAdministrativeUnitMember.md index c10162851..c850c4f19 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAdministrativeUnitMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAdministrativeUnitMember.md @@ -28,7 +28,7 @@ Currently only group objects are supported. ```powershell New-EntraBetaAdministrativeUnitMember - -Id + -AdministrativeUnitId [-GroupTypes ] [-AssignedLabels ] [-OdataType ] @@ -47,7 +47,7 @@ New-EntraBetaAdministrativeUnitMember ## Description -The `New-EntraBetaAdministrativeUnitMember` cmdlet creates a Microsoft Entra ID object as a member of an administrative unit. Specify `Id`, `DisplayName`, `MailNickname`, `SecurityEnabled` and `MailEnabled` parameters for create a new administrative unit member. +The `New-EntraBetaAdministrativeUnitMember` cmdlet creates a Microsoft Entra ID object as a member of an administrative unit. Specify `AdministrativeUnitId`, `DisplayName`, `MailNickname`, `SecurityEnabled` and `MailEnabled` parameters for create a new administrative unit member. Currently only Microsoft Entra ID groups are supported to create administrative unit members. @@ -60,7 +60,7 @@ For information about creating dynamic groups, see Using attributes to create ad ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $params = @{ - Id = 'bbbbbbbb-1111-2222-3333-cccccccccccc' + AdministrativeUnitId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' OdataType = 'Microsoft.Graph.Group' DisplayName = 'NewAUMember' Description = 'createdUnitMember' @@ -95,14 +95,14 @@ Any users that don't qualify are removed from the group. ## Parameters -### -Id +### -AdministrativeUnitId -Specifies the ID of a Microsoft Entra ID administrative unit. +Specifies the AdministrativeUnitId of a Microsoft Entra ID administrative unit. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationExtensionProperty.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationExtensionProperty.md index dd9c6e007..011aa08b7 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationExtensionProperty.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationExtensionProperty.md @@ -27,7 +27,7 @@ Creates an application extension property. ```powershell New-EntraBetaApplicationExtensionProperty - -ObjectId + -ApplicationId [-DataType ] -Name [-TargetObjects ] @@ -46,7 +46,7 @@ The `New-EntraBetaApplicationExtensionProperty` cmdlet creates an application ex Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraBetaApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId Name = 'NewAttribute' } @@ -61,7 +61,7 @@ DeletedDateTime Id AppDisplayName DataType Is This command creates an application extension property of the string type for the specified object. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-Name` parameter specifies the name of the extension property. ### Example 2: Create an extension property with data type parameter @@ -70,7 +70,7 @@ This command creates an application extension property of the string type for th Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraBetaApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId Name = 'NewAttribute' DataType = 'Boolean' } @@ -86,7 +86,7 @@ DeletedDateTime Id AppDisplayName DataType Is This command creates an application extension property of the specified data type for the specified object. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-Name` parameter specifies the name of the extension property. - `-DataType` parameter specifies the data type of the value the extension property can hold. @@ -98,7 +98,7 @@ $Application = Get-EntraBetaApplication -SearchString '' $targets = New-Object System.Collections.Generic.List[System.String] $targets.Add('User') $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId Name = 'NewAttribute' TargetObjects = $targets } @@ -114,7 +114,7 @@ DeletedDateTime Id AppDisplayName DataType Is The example shows how to create an application extension property with the specified target objects for the specified object. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-Name` parameter specifies the name of the extension property. - `-TargetObjects` parameter specifies the Microsoft Graph resources that use the extension property. All values must be in PascalCase. @@ -159,14 +159,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies a unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationKeyCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationKeyCredential.md index 28ed19652..8ecc2c243 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationKeyCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationKeyCredential.md @@ -26,7 +26,7 @@ Creates a key credential for an application. ```powershell New-EntraBetaApplicationKeyCredential - -ObjectId + -ApplicationId [-CustomKeyIdentifier ] [-Type ] [-Usage ] @@ -53,7 +53,7 @@ Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy $AppId = (Get-EntraApplication -Top 1).Objectid $params = @{ - ObjectId = $AppId + ApplicationId = $AppId CustomKeyIdentifier = 'EntraPowerShellKey' StartDate = '2024-03-21T14:14:14Z' Type = 'Symmetric' @@ -76,7 +76,7 @@ Value : {49, 50, 51} This example shows how to create an application key credential. -- `-ObjectId` Specifies a unique ID of an application +- `-ApplicationId` Specifies a unique ID of an application - `-CustomKeyIdentifier` Specifies a custom key ID. - `-StartDate` Specifies the time when the key becomes valid as a DateTime object. - `-Type` Specifies the type of the key. @@ -99,7 +99,7 @@ $base64Thumbprint = [System.Convert]::ToBase64String($bin) $keyid = [System.Guid]::NewGuid().ToString() $params = @{ - ObjectId = '22223333-cccc-4444-dddd-5555eeee6666' + ApplicationId = '22223333-cccc-4444-dddd-5555eeee6666' CustomKeyIdentifier = $base64Thumbprint Type = 'AsymmetricX509Cert' Usage = 'Verify' @@ -113,7 +113,7 @@ New-EntraBetaApplicationKeyCredential @params This example shows how to create an application key credential. -- `-ObjectId` Specifies a unique ID of an application +- `-ApplicationId` Specifies a unique ID of an application - `-CustomKeyIdentifier` Specifies a custom key ID. - `-StartDate` Specifies the time when the key becomes valid as a DateTime object. - `-EndDate` Specifies the time when the key becomes invalid as a DateTime object. @@ -155,14 +155,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies a unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationPasswordCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationPasswordCredential.md index c562f5917..cb2c9ba98 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationPasswordCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaApplicationPasswordCredential.md @@ -26,7 +26,7 @@ Creates a password credential for an application. ```powershell New-EntraBetaApplicationPasswordCredential - -ObjectId + -ApplicationId [-CustomKeyIdentifier ] [-StartDate ] [-EndDate ] @@ -44,7 +44,7 @@ The `New-EntraBetaApplicationPasswordCredential` cmdlet creates a password crede ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "displayName eq ''" -New-EntraBetaApplicationPasswordCredential -ObjectId $application.Id +New-EntraBetaApplicationPasswordCredential -ApplicationId $application.Id ``` ```Output @@ -55,7 +55,7 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. ### Example 2: Create a password credential using CustomKeyIdentifier parameter @@ -63,7 +63,7 @@ This command creates new password credential for specified application. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "displayName eq ''" $parameters = @{ - ObjectId = $application.Id + ApplicationId = $application.Id CustomKeyIdentifier = '' } New-EntraBetaApplicationPasswordCredential @parameters @@ -78,7 +78,7 @@ CustomKeyIdentifier DisplayName EndDateTime This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. - `-CustomKeyIdentifier` Speicifies unique binary identifier. ### Example 3: Create a password credential using StartDate parameter @@ -87,7 +87,7 @@ This command creates new password credential for specified application. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "displayName eq ''" $parameters = @{ - ObjectId = $application.Id + ApplicationId = $application.Id StartDate = (Get-Date).AddYears(0) CustomKeyIdentifier = '' } @@ -103,7 +103,7 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. - `-StartDate` Speicifies the date and time at which the password becomes valid. ### Example 4: Create a password credential using EndDate parameter @@ -112,7 +112,7 @@ This command creates new password credential for specified application. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "displayName eq ''" $parameters = @{ - ObjectId = $application.Id + ApplicationId = $application.Id EndDate = (Get-Date).AddYears(2) CustomKeyIdentifier = '' } @@ -128,19 +128,19 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. - `-EndDate` Speicifies The date and time at which the password expires. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAttributeSet.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAttributeSet.md index 95d562a6e..2ea61015b 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAttributeSet.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaAttributeSet.md @@ -28,7 +28,7 @@ Adds a new attribute set. New-EntraBetaAttributeSet [-Description ] [-MaxAttributesPerSet ] - [-Id ] + [-AttributeSetId ] [] ``` @@ -45,7 +45,7 @@ In delegated scenarios with work or school accounts, the signed-in user must be ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' $params = @{ - Id = 'Testing' + AttributeSetId = 'Testing' Description = 'Attributes for engineering team' MaxAttributesPerSet = 10 } @@ -61,7 +61,7 @@ Testing Attributes for engineering team 10 This example demonstrates hoe to add a single attribute set. -- `-Id` parameter specifies the name of the attribute set. +- `-AttributeSetId` parameter specifies the name of the attribute set. - `-Description` parameter specifies the description for the attribute set. - `-MaxAttributesPerSet` parameter specifies the maximum number of custom security attributes. @@ -83,14 +83,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -AttributeSetId Name of the attribute set. Unique identifier for the attribute set within a tenant, up to 32 Unicode characters. It can't contain spaces or special characters, is case sensitive, and can't be changed later. Required. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: False Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaGroupAppRoleAssignment.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaGroupAppRoleAssignment.md index 4dd29e877..fbbbfdae0 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaGroupAppRoleAssignment.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaGroupAppRoleAssignment.md @@ -28,8 +28,8 @@ Assign a group of users to an application role. ```powershell New-EntraBetaGroupAppRoleAssignment -ResourceId - -Id - -ObjectId + -AppRoleId + -GroupId -PrincipalId [] ``` @@ -47,7 +47,7 @@ Connect-Entra -Scopes 'AppRoleAssignment.ReadWrite.All' $appname = 'Box' $spo = Get-EntraBetaServicePrincipal -Filter "Displayname eq '$appname'" $group = Get-EntraBetaGroup -SearchString 'Contoso Team' -New-EntraBetaGroupAppRoleAssignment -ObjectId $group.ObjectId -PrincipalId $group.ObjectId -ResourceId $spo.ObjectId -Id $spo.Approles[1].id +New-EntraBetaGroupAppRoleAssignment -GroupId $group.ObjectId -PrincipalId $group.ObjectId -ResourceId $spo.ObjectId -AppRoleId $spo.Approles[1].id ``` ```Output @@ -59,21 +59,21 @@ DeletedDateTime Id AppRoleId This example demonstrates how to assign a group of users to an application role in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a group to which you're assigning the app role. +- `-GroupId` parameter specifies the ID of a group to which you're assigning the app role. - `-PrincipalId` parameter specifies the ID of a group to which you're assigning the app role. - `-ResourceId` parameter specifies the ID of a resource service Principal, which has defined the app role. -- `-Id` parameter specifies the ID of a appRole (defined on the resource service principal) to assign to the group. +- `-AppRoleId` parameter specifies the ID of a appRole (defined on the resource service principal) to assign to the group. ## Parameters -### -Id +### -AppRoleId Specifies the ID of the app role (defined on the resource service principal) to assign. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named @@ -82,14 +82,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId -Specifies the ID of a group in Microsoft Entra ID. +Specifies the ID of a user (as a UserPrincipalName or GroupId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaServicePrincipalPasswordCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaServicePrincipalPasswordCredential.md index f174efc8a..05dc67fc4 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaServicePrincipalPasswordCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/New-EntraBetaServicePrincipalPasswordCredential.md @@ -27,7 +27,7 @@ Creates a password credential for a service principal. ```powershell New-EntraBetaServicePrincipalPasswordCredential - -ObjectId + -ServicePrincipalId [-EndDate ] [-StartDate ] [] @@ -45,7 +45,7 @@ The `New-EntraBetaServicePrincipalPasswordCredential` cmdlet creates a password Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" $Params = @{ - ObjectId = $ServicePrincipal.ObjectId + ServicePrincipalId = $ServicePrincipal.ObjectId StartDate = '2024-04-21T14:14:14Z' } New-EntraBetaServicePrincipalPasswordCredential @Params @@ -67,7 +67,7 @@ EndDate : 08-08-2026 10:30:00 This example demonstrates how to create a password credential with StartDate for a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-StarteDate` parameter specifies the date and time at which the password becomes valid. ### Example 2: Create a password credential with EndtDate @@ -76,7 +76,7 @@ This example demonstrates how to create a password credential with StartDate for Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" $Params = @{ - ObjectId = $ServicePrincipal.ObjectId + ServicePrincipalId = $ServicePrincipal.ObjectId EndDate = '2030-03-21T14:14:14Z' } New-EntraBetaServicePrincipalPasswordCredential @Params @@ -98,7 +98,7 @@ EndDate : 08-08-2026 10:30:00 This example demonstrates how to create a password credential with EndDate for a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-EndDate` parameter specifies the date and time at which the password expires represented using ISO 8601 format and is always in UTC time. ## Parameters @@ -119,14 +119,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of the service principal. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnit.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnit.md index 64e65d9be..2fdf8f8c1 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnit.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnit.md @@ -25,13 +25,13 @@ Removes an administrative unit. ```powershell Remove-EntraBetaAdministrativeUnit - -ObjectId + -AdministrativeUnitId [] ``` ## Description -The `Remove-EntraBetaAdministrativeUnit` cmdlet removes an administrative unit from Microsoft Entra ID. Specify `ObjectId` parameter to delete an administrative unit. +The `Remove-EntraBetaAdministrativeUnit` cmdlet removes an administrative unit from Microsoft Entra ID. Specify `AdministrativeUnitId` parameter to delete an administrative unit. To delete an administrative unit, the calling principal must have at least the Privileged Role Administrator role in Microsoft Entra. @@ -42,23 +42,23 @@ To delete an administrative unit, the calling principal must have at least the P ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" -Remove-EntraBetaAdministrativeUnit -ObjectId $AdministrativeUnit.ObjectId +Remove-EntraBetaAdministrativeUnit -AdministrativeUnitId $AdministrativeUnit.ObjectId ``` This command removes the specified administrative unit from Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnitMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnitMember.md index d0d4f895f..b4f130ec5 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnitMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaAdministrativeUnitMember.md @@ -26,14 +26,14 @@ Removes an administrative unit member. ```powershell Remove-EntraBetaAdministrativeUnitMember - -ObjectId + -AdministrativeUnitId -MemberId [] ``` ## Description -The `Remove-EntraBetaAdministrativeUnitMember` cmdlet removes an administrative unit member in Microsoft Entra ID. Specify `ObjectId` and `MemberId` to remove an administrative unit member. +The `Remove-EntraBetaAdministrativeUnitMember` cmdlet removes an administrative unit member in Microsoft Entra ID. Specify `AdministrativeUnitId` and `MemberId` to remove an administrative unit member. To remove a member from an administrative unit, the calling principal must have at least the Privileged Role Administrator role in Microsoft Entra. @@ -45,7 +45,7 @@ To remove a member from an administrative unit, the calling principal must have Connect-Entra -Scopes 'AdministrativeUnit.Read.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId MemberId = 'eeeeeeee-4444-5555-6666-ffffffffffff' } Remove-EntraBetaAdministrativeUnitMember @params @@ -53,7 +53,7 @@ Remove-EntraBetaAdministrativeUnitMember @params This command removes a specified member (user or group) from a specified administrative unit. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `-MemberId` parameter specifies the ID of the administrative unit member. ## Parameters @@ -74,14 +74,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplication.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplication.md index af0967146..a8eefb017 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplication.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplication.md @@ -25,13 +25,13 @@ Deletes an application object. ```powershell Remove-EntraBetaApplication - -ObjectId + -ApplicationId [] ``` ## Description -The `Remove-EntraBetaApplication` cmdlet deletes an application object identified by ObjectId. Specify the `ObjectId` parameter to delete an application object. +The `Remove-EntraBetaApplication` cmdlet deletes an application object identified by ApplicationId. Specify the `ApplicationId` parameter to delete an application object. ## Examples @@ -40,21 +40,21 @@ The `Remove-EntraBetaApplication` cmdlet deletes an application object identifie ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' $Application = Get-EntraBetaApplication -SearchString '' -Remove-EntraBetaApplication -ObjectId $Application.ObjectId +Remove-EntraBetaApplication -ApplicationId $Application.ObjectId ``` This example demonstrates how to delete an application object. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationExtensionProperty.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationExtensionProperty.md index 29cefeed3..ceb3691ab 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationExtensionProperty.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationExtensionProperty.md @@ -26,7 +26,7 @@ Removes an application extension property. ```powershell Remove-EntraBetaApplicationExtensionProperty - -ObjectId + -ApplicationId -ExtensionPropertyId [] ``` @@ -43,7 +43,7 @@ The `Remove-EntraBetaApplicationExtensionProperty` cmdlet removes an application Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraBetaApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId ExtensionPropertyId = 'cccc2222-dd33-4444-55ee-666666ffffff' } @@ -52,7 +52,7 @@ Remove-EntraBetaApplicationExtensionProperty @params This example removes the extension property that has the specified ID from an application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-ExtensionPropertyId` parameter specifies the unique identifier of the extension property to remove. ## Parameters @@ -73,14 +73,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationKeyCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationKeyCredential.md index 0f627f39e..94f17eefd 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationKeyCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationKeyCredential.md @@ -25,7 +25,7 @@ Removes a key credential from an application. ```powershell Remove-EntraBetaApplicationKeyCredential - -ObjectId + -ApplicationId -KeyId [] ``` @@ -44,7 +44,7 @@ An application can use this command along with `New-EntraBetaApplicationKeyCrede Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "displayName eq ''" $params = @{ - ObjectId = $application.Id + ApplicationId = $application.Id KeyId = 'aaaaaaaa-0b0b-1c1c-2d2d-333333333333' } @@ -53,7 +53,7 @@ Remove-EntraBetaApplicationKeyCredential @params This command removes the specified key credential from the specified application. -- `-ObjectId` Specifies the ID of an application. +- `-ApplicationId` Specifies the ID of an application. - `-KeyId` Specifies a custom key ID. Use `Get-EntraBetaApplicationKeyCredential` to get the keyId details. ## Parameters @@ -74,14 +74,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies a unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationOwner.md index 61bb2a7ad..78acdbbd2 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationOwner.md @@ -27,7 +27,7 @@ Removes an owner from an application. ```powershell Remove-EntraBetaApplicationOwner -OwnerId - -ObjectId + -ApplicationId [] ``` @@ -43,7 +43,7 @@ The `Remove-EntraBetaApplicationOwner` cmdlet removes an owner from an applicati Connect-Entra -Scopes 'Application.ReadWrite.All' $Application = Get-EntraBetaApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId OwnerId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } Remove-EntraBetaApplicationOwner @params @@ -51,19 +51,19 @@ Remove-EntraBetaApplicationOwner @params This example removes the specified owner from the specified application. You can use the command `Get-EntraBetaApplication` to get application Id. -- `-ObjectId` parameter specifies the the unique identifier of a application. +- `-ApplicationId` parameter specifies the the unique identifier of a application. - `-OwnerId` parameter specifies the ID of the owner. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationPasswordCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationPasswordCredential.md index 3bd6f6ecf..4e325b087 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationPasswordCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationPasswordCredential.md @@ -25,7 +25,7 @@ Removes a password credential from an application. ```powershell Remove-EntraBetaApplicationPasswordCredential - -ObjectId + -ApplicationId -KeyId [] ``` @@ -41,13 +41,13 @@ The `Remove-EntraBetaApplicationPasswordCredential` cmdlet removes a password cr ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' $application = Get-EntraBetaApplication -Filter "displayName eq 'Contoso Helpdesk App'" -$KeyIDs = Get-EntraBetaApplicationPasswordCredential -ObjectId $application.Id -Remove-EntraBetaApplicationPasswordCredential -ObjectId $application.Id -KeyId $KeyIds[0].KeyId +$KeyIDs = Get-EntraBetaApplicationPasswordCredential -ApplicationId $application.Id +Remove-EntraBetaApplicationPasswordCredential -ApplicationId $application.Id -KeyId $KeyIds[0].KeyId ``` This example demonstrates how to remove the password credential for an application. -- `ObjectId` Specifies the ID of the application. Use `Get-EntraBetaApplication` to get application ObjectId value. +- `ApplicationId` Specifies the ID of the application. Use `Get-EntraBetaApplication` to get application ApplicationId value. - `KeyId` Specifies the ID of the password credential. Use `Get-EntraBetaApplicationPasswordCredential` to retrieve a specific credential details. ## Parameters @@ -68,14 +68,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of the application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplication.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplication.md index 06eeb6c83..453e51b08 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplication.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplication.md @@ -26,7 +26,7 @@ Deletes an Application Proxy application. ```powershell Remove-EntraBetaApplicationProxyApplication - -ObjectId + -ApplicationId [-RemoveADApplication ] [] ``` @@ -41,37 +41,37 @@ The `Remove-EntraBetaApplicationProxyApplication` cmdlet removes Application Pro ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Remove-EntraBetaApplicationProxyApplication -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Remove-EntraBetaApplicationProxyApplication -ApplicationId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` This example removes a Proxy Application. -- `ObjectId` parameter specifies the application ID. +- `ApplicationId` parameter specifies the application ID. ### Example 2: Remove a Proxy Application, and remove it from Microsoft Entra ID completely ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Remove-EntraBetaApplicationProxyApplication -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RemoveADApplication $true +Remove-EntraBetaApplicationProxyApplication -ApplicationId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RemoveADApplication $true ``` This example removes a Proxy Application, and removes it from Microsoft Entra ID completely. -- `ObjectId` parameter specifies the application ID. +- `ApplicationId` parameter specifies the application ID. - `RemoveADApplication` parameter specifies the user confirmation to delete application completely. ## Parameters -### -ObjectId +### -ApplicationId The unique application ID of the application. -This ObjectId can be found using the `Get-EntraBetaApplication` command. -You can also find this ObjectId in the Microsoft by navigating to Microsoft Entra ID > App registrations > All applications. Select your application. This will takes you to the application's overview page. Use the ObjectId on that page. +This ApplicationId can be found using the `Get-EntraBetaApplication` command. +You can also find this ApplicationId in the Microsoft by navigating to Microsoft Entra ID > App registrations > All applications. Select your application. This will takes you to the application's overview page. Use the ObjectId on that page. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.md index 7b4b43539..58e580176 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaApplicationProxyApplicationConnectorGroup.md @@ -26,7 +26,7 @@ The `Remove-EntraBetaApplicationProxyApplicationConnectorGroupcmdlet` sets the c ```powershell Remove-EntraBetaApplicationProxyApplicationConnectorGroup - -ObjectId + -OnPremisesPublishingProfileId [] ``` @@ -41,16 +41,16 @@ The application must be configured for Application Proxy in Microsoft Entra ID. ```POWERSHELL Connect-Entra -Scopes 'Directory.ReadWrite.All' -Remove-EntraBetaApplicationProxyApplicationConnectorGroup -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Remove-EntraBetaApplicationProxyApplicationConnectorGroup -OnPremisesPublishingProfileId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` This example removes the Connector Group associated with an application, setting the group to 'Default.' -- `ObjectId` parameter specifies the application ID. +- `OnPremisesPublishingProfileId` parameter specifies the application ID. ## Parameters -### -ObjectId +### -OnPremisesPublishingProfileId The unique application ID of the application. The application ID can be found using the `Get-EntraBetaApplication` command. @@ -59,7 +59,7 @@ You can also find objectId in the Microsoft Entra Admin Center by navigating to ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaContact.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaContact.md index d2ada0eca..d611cd079 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaContact.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaContact.md @@ -27,7 +27,7 @@ Removes a contact. ```powershell Remove-EntraBetaContact - -ObjectId + -OrgContactId [] ``` @@ -42,21 +42,21 @@ The `Remove-EntraBetaContact` removes a contact from Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Filter "DisplayName eq 'Contoso Contact'" -Remove-EntraBetaContact -ObjectId $Contact.ObjectId +Remove-EntraBetaContact -OrgContactId $Contact.ObjectId ``` The example shows how to remove a contact. ## Parameters -### -ObjectId +### -OrgContactId Specifies the object ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDevice.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDevice.md index ca97b62e5..edde24ed2 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDevice.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDevice.md @@ -27,7 +27,7 @@ Deletes a device. ```powershell Remove-EntraBetaDevice - -ObjectId + -DeviceId [] ``` @@ -44,21 +44,21 @@ The calling user must be in one of the following Microsoft Entra roles: Intune A ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' $Device = Get-EntraBetaDevice -Filter "DisplayName eq 'Woodgrove Desktop'" -Remove-EntraBetaDevice -ObjectId $Device.ObjectId +Remove-EntraBetaDevice -DeviceId $Device.ObjectId ``` This command removes the specified device. ## Parameters -### -ObjectId +### -DeviceId Specifies the object ID of a device in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredOwner.md index e13777203..717be523f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredOwner.md @@ -28,7 +28,7 @@ Removes the registered owner of a device. ```powershell Remove-EntraBetaDeviceRegisteredOwner -OwnerId - -ObjectId + -DeviceId [] ``` @@ -44,21 +44,21 @@ The `Remove-EntraBetaDeviceRegisteredOwner` cmdlet removes the registered owner Connect-Entra -Scopes 'Directory.AccessAsUser.All' $Device = Get-EntraBetaDevice -Top 1 $Owner = Get-EntraBetaDeviceRegisteredOwner -ObjectId $Device.ObjectId -Remove-EntraBetaDeviceRegisteredOwner -ObjectId $Device.ObjectId -OwnerId $Owner.ObjectId +Remove-EntraBetaDeviceRegisteredOwner -DeviceId $Device.ObjectId -OwnerId $Owner.ObjectId ``` This examples shows how to remove the owner of a device. ## Parameters -### -ObjectId +### -DeviceId Specifies an object ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredUser.md index 229afe3d0..9b23da22a 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDeviceRegisteredUser.md @@ -27,7 +27,7 @@ Removes a registered user from a device. ```powershell Remove-EntraBetaDeviceRegisteredUser - -ObjectId + -DeviceId -UserId [] ``` @@ -43,22 +43,22 @@ The `Remove-EntraBetaDeviceRegisteredUser` cmdlet removes a registered user from ```Powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All' $Device = Get-EntraBetaDevice -Top 1 -$User = Get-EntraBetaDeviceRegisteredUser -ObjectId $Device.ObjectId -Remove-EntraBetaDeviceRegisteredUser -ObjectId $Device.ObjectId -OwnerId $Owner.ObjectId +$User = Get-EntraBetaDeviceRegisteredUser -DeviceId $Device.ObjectId +Remove-EntraBetaDeviceRegisteredUser -DeviceId $Device.ObjectId -UserId $User.ObjectId ``` This example shows how to remove the registered user from device. ## Parameters -### -ObjectId +### -DeviceId Specifies the ID of an object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleAssignment.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleAssignment.md index f9fcab52d..358410f3d 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleAssignment.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleAssignment.md @@ -26,7 +26,7 @@ Delete a Microsoft Entra ID roleAssignment. ```powershell Remove-EntraBetaDirectoryRoleAssignment - -Id + -UnifiedRoleAssignmentId [] ``` @@ -40,23 +40,23 @@ The `Remove-EntraBetaDirectoryRoleAssignment` cmdlet removes a role assignment f ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory','EntitlementManagement.ReadWrite.All' -Remove-EntraBetaDirectoryRoleAssignment -Id 'Y1vFBcN4i0e3ngdNDocmngJAWGnAbFVAnJQyBBLv1lM-1' +Remove-EntraBetaDirectoryRoleAssignment -UnifiedRoleAssignmentId 'Y1vFBcN4i0e3ngdNDocmngJAWGnAbFVAnJQyBBLv1lM-1' ``` This example removes the specified role assignment from Microsoft Entra ID. -- `-Id` parameter specifies the role assignment ID. +- `-UnifiedRoleAssignmentId` parameter specifies the role assignment ID. ## Parameters -### -Id +### -UnifiedRoleAssignmentId The unique identifier of an object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: 0 diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleDefinition.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleDefinition.md index e24ce1f5e..4c5de3ec4 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleDefinition.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleDefinition.md @@ -26,7 +26,7 @@ Delete a Microsoft Entra ID Directory roleDefinition object. ```powershell Remove-EntraBetaDirectoryRoleDefinition - -Id + -UnifiedRoleDefinitionId [] ``` @@ -42,24 +42,23 @@ You can't delete built-in roles. This feature requires a Microsoft Entra ID P1 o ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' -$DirectoryRoleDefinition = Get-EntraBetaDirectoryRoleDefinition -Filter "DisplayName eq 'Guest Inviter'" -Remove-EntraBetaDirectoryRoleDefinition -Id $DirectoryRoleDefinition.ObjectId +Remove-EntraBetaDirectoryRoleDefinition -UnifiedRoleDefinitionId 'a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1' ``` This example demonstrates how to remove the specified role definition from Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. ## Parameters -### -Id +### -UnifiedRoleDefinitionId The unique identifier of an object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: 0 diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleMember.md index db4ef9f9d..6140527e0 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaDirectoryRoleMember.md @@ -26,7 +26,7 @@ Removes a member of a directory role. ```powershell Remove-EntraBetaDirectoryRoleMember - -ObjectId + -DirectoryRoleId -MemberId [] ``` @@ -42,7 +42,7 @@ The `Remove-EntraBetaDirectoryRoleMember` cmdlet removes a member from a directo ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $params = @{ - ObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + DirectoryRoleId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' MemberId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } Remove-EntraBetaDirectoryRoleMember @params @@ -50,7 +50,7 @@ Remove-EntraBetaDirectoryRoleMember @params This example removes the specified member from the specified role. -- `-ObjectId` parameter specifies the object ID of the directory role. +- `-DirectoryRoleId` parameter specifies the object ID of the directory role. - `-MemberId` parameter specifies the object ID of the role member to removed. ## Parameters @@ -71,14 +71,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -DirectoryRoleId Specifies the object ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroup.md index 1eb76423c..596dfb90b 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroup.md @@ -26,13 +26,13 @@ Removes a group. ```powershell Remove-EntraBetaGroup - -ObjectId + -GroupId [] ``` ## Description -The `Remove-EntraBetaGroup` cmdlet removes a group from Microsoft Entra ID. Specify the `ObjectId` parameter removes a group. +The `Remove-EntraBetaGroup` cmdlet removes a group from Microsoft Entra ID. Specify the `GroupId` parameter removes a group. Unified Group can be restored withing 30 days after deletion using the `Restore-EntraBetaDeletedDirectoryObject` cmdlet. Security groups can't be restored after deletion. @@ -50,23 +50,23 @@ The following conditions apply for apps to delete role-assignable groups: ```powershell Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -Remove-EntraBetaGroup -ObjectId $group.Id +Remove-EntraBetaGroup -GroupId $group.Id ``` This example demonstrates how to remove a group in Microsoft Entra ID. -- `ObjectId` parameter specifies the group ID . +- `GroupId` parameter specifies the group ID . ## Parameters -### -ObjectId +### -GroupId Specifies the object ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupAppRoleAssignment.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupAppRoleAssignment.md index 314f1af51..3b36a45c9 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupAppRoleAssignment.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupAppRoleAssignment.md @@ -24,7 +24,7 @@ Delete a group application role assignment. ```powershell Remove-EntraBetaGroupAppRoleAssignment - -ObjectId + -GroupId -AppRoleAssignmentId [] ``` @@ -41,7 +41,7 @@ The `Remove-EntraBetaGroupAppRoleAssignment` cmdlet removes a group application Connect-Entra -Scopes 'Directory.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - ObjectId = $group.ObjectId + GroupId = $group.Id AppRoleAssignmentId = 'CcDdEeFfGgHhIiJjKkLlMmNnOoPpQq3' } Remove-EntraBetaGroupAppRoleAssignment @params @@ -49,7 +49,7 @@ Remove-EntraBetaGroupAppRoleAssignment @params This example demonstrates how to remove the specified group application role assignment. -- `-ObjectId` parameter specifies the object ID of a group. +- `-GroupId` parameter specifies the object ID of a group. - `-AppRoleAssignmentId` parameter specifies the object ID of a group application role assignment. ## Parameters @@ -70,14 +70,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the object ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupLifecyclePolicy.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupLifecyclePolicy.md index 436a3242b..4c50619a6 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupLifecyclePolicy.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupLifecyclePolicy.md @@ -26,13 +26,13 @@ Deletes a groupLifecyclePolicies object ```powershell Remove-EntraBetaGroupLifecyclePolicy - -Id + -GroupLifecyclePolicyId [] ``` ## Description -The `Remove-EntraBetaGroupLifecyclePolicy` command deletes a groupLifecyclePolicies object in Microsoft Entra ID. Specify `Id` parameter deletes the groupLifecyclePolicies object. +The `Remove-EntraBetaGroupLifecyclePolicy` command deletes a groupLifecyclePolicies object in Microsoft Entra ID. Specify `GroupLifecyclePolicyId` parameter deletes the groupLifecyclePolicies object. ## Examples @@ -40,21 +40,21 @@ The `Remove-EntraBetaGroupLifecyclePolicy` command deletes a groupLifecyclePolic ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Remove-EntraBetaGroupLifecyclePolicy -Id '1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5' +Remove-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId '1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5' ``` This example demonstrates how to delete the groupLifecyclePolicies object that has the specified ID. You can use `Get-EntraBetaGroupLifecyclePolicy` to get Id details. ## Parameters -### -Id +### -GroupLifecyclePolicyId Specifies the ID of the groupLifecyclePolicies object that this cmdlet removes. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupMember.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupMember.md index 2ea9d80aa..508782c05 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupMember.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupMember.md @@ -26,14 +26,14 @@ Removes a member from a group. ```powershell Remove-EntraBetaGroupMember - -ObjectId + -GroupId -MemberId [] ``` ## Description -The `Remove-EntraBetaGroupMember` cmdlet removes a member from a group in Microsoft Entra ID. Specify the `ObjectId` and `MemberId` parameters to remove a member from a group. +The `Remove-EntraBetaGroupMember` cmdlet removes a member from a group in Microsoft Entra ID. Specify the `GroupId` and `MemberId` parameters to remove a member from a group. ## Examples @@ -43,7 +43,7 @@ The `Remove-EntraBetaGroupMember` cmdlet removes a member from a group in Micros Connect-Entra -Scopes 'GroupMember.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - ObjectId = $group.ObjectId + GroupId = $group.ObjectId MemberId = 'zzzzzzzz-6666-8888-9999-pppppppppppp' } @@ -70,14 +70,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the object ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupOwner.md index 1a93536ca..2b942f2a6 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaGroupOwner.md @@ -27,13 +27,13 @@ Removes an owner from a group. ```powershell Remove-EntraBetaGroupOwner -OwnerId - -ObjectId + -GroupId [] ``` ## Description -The `Remove-EntraBetaGroupOwner` cmdlet removes an owner from a group in Microsoft Entra ID. Specify the `ObjectId` and `OwnerId` parameters to remove an owner from a group. +The `Remove-EntraBetaGroupOwner` cmdlet removes an owner from a group in Microsoft Entra ID. Specify the `GroupId` and `OwnerId` parameters to remove an owner from a group. ## Examples @@ -43,7 +43,7 @@ The `Remove-EntraBetaGroupOwner` cmdlet removes an owner from a group in Microso Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - ObjectId = $group.ObjectId + GroupId = $group.Id OwnerId = 'xxxxxxxx-8888-5555-9999-bbbbbbbbbbbb' } @@ -52,20 +52,20 @@ Remove-EntraBetaGroupOwner @params This example demonstrates how to remove an owner from a group in Microsoft Entra ID. -- `ObjectId` specifies the ID of a group in Microsoft Entra ID. +- `GroupId` specifies the ID of a group in Microsoft Entra ID. - `OwnerId` specifies the ID of an owner. ## Parameters -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaIdentityProvider.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaIdentityProvider.md index eb24ce44a..a26a3fd9b 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaIdentityProvider.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaIdentityProvider.md @@ -27,7 +27,7 @@ This cmdlet is used to delete an identity provider in the directory. ```powershell Remove-EntraBetaIdentityProvider - -Id + -IdentityProviderBaseId [] ``` @@ -45,23 +45,23 @@ The work or school account needs to belong to at least the External Identity Pro ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' -Remove-EntraBetaIdentityProvider -Id 'LinkedIn-OAUTH' +Remove-EntraBetaIdentityProvider -IdentityProviderBaseId 'LinkedIn-OAUTH' ``` This command demonstrates how to remove the specified identity provider. -- `-Id` parameter specifies the unique identifier of the identity provider. +- `-IdentityProviderBaseId` parameter specifies the unique identifier of the identity provider. ## Parameters -### -Id +### -IdentityProviderBaseId The unique identifier for an identity provider. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaLifecyclePolicyGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaLifecyclePolicyGroup.md index ada9c0fe2..28de46525 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaLifecyclePolicyGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaLifecyclePolicyGroup.md @@ -27,7 +27,7 @@ Removes a group from a lifecycle policy. ```powershell Remove-EntraBetaLifecyclePolicyGroup - -Id + -GroupLifecyclePolicyId -GroupId [] ``` @@ -45,7 +45,7 @@ Connect-Entra -Scopes 'Directory.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'Office365 group'" $policy = Get-EntraBetaLifecyclePolicyGroup -Id $group.ObjectId $params = @{ - Id = $policy.Id + GroupLifecyclePolicyId = $policy.Id GroupId = $group.ObjectId } Remove-EntraBetaLifecyclePolicyGroup @params @@ -59,7 +59,7 @@ True This example demonstrates how to remove a group from a lifecycle policy in Microsoft Entra ID with specified Id and groupId. -- `-Id` parameter specifies the lifecycle policy object ID. +- `-GroupLifecyclePolicyId` parameter specifies the lifecycle policy object ID. - `-GroupId` parameter specifies the ID of Office365 group. ## Parameters @@ -80,14 +80,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupLifecyclePolicyId Specifies the ID of the lifecycle policy object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaScopedRoleMembership.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaScopedRoleMembership.md index 0ba291dff..0d7fc3566 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaScopedRoleMembership.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaScopedRoleMembership.md @@ -27,14 +27,14 @@ Removes a scoped role membership. ```powershell Remove-EntraBetaScopedRoleMembership - -ObjectId + -AdministrativeUnitId -ScopedRoleMembershipId [] ``` ## Description -The `Remove-EntraBetaScopedRoleMembership` cmdlet removes a scoped role membership from Microsoft Entra ID. Specify `ObjectId` and `ScopedRoleMembershipId` parameter to remove a scoped role membership. +The `Remove-EntraBetaScopedRoleMembership` cmdlet removes a scoped role membership from Microsoft Entra ID. Specify `AdministrativeUnitId` and `ScopedRoleMembershipId` parameter to remove a scoped role membership. ## Examples @@ -44,7 +44,7 @@ The `Remove-EntraBetaScopedRoleMembership` cmdlet removes a scoped role membersh Connect-Entra -Scopes 'RoleManagement.Read.Directory' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId ScopedRoleMembershipId = 'dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc' } Remove-EntraBetaScopedRoleMembership @params @@ -52,12 +52,12 @@ Remove-EntraBetaScopedRoleMembership @params This cmdlet removes a specific scoped role membership from Microsoft Entra ID. You can use the command `Get-EntraBetaAdministrativeUnit` to get administrative unit Id. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `-ScopedRoleMembershipId` parameter specifies the ID of the scoped role membership to remove. To obtain the details of a scoped role membership, you can use the `Get-EntraBetaScopedRoleMembership` command. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit object. @@ -80,7 +80,7 @@ Specifies the ID of the scoped role membership to remove. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipal.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipal.md index d30485c05..f08fcb4a7 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipal.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipal.md @@ -27,7 +27,7 @@ Removes a service principal. ```powershell Remove-EntraBetaServicePrincipal - -ObjectId + -ServicePrincipalId [] ``` @@ -42,23 +42,23 @@ The `Remove-EntraBetaServicePrincipal` cmdlet removes a service principal in Mic ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -Remove-EntraBetaServicePrincipal -ObjectId $servicePrincipal.ObjectId +Remove-EntraBetaServicePrincipal -ServicePrincipalId $servicePrincipal.ObjectId ``` This example demonstrates how to remove a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalAppRoleAssignment.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalAppRoleAssignment.md index 7cbd3366a..89848d1ec 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalAppRoleAssignment.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalAppRoleAssignment.md @@ -27,7 +27,7 @@ Removes a service principal application role assignment. ```powershell Remove-EntraBetaServicePrincipalAppRoleAssignment - -ObjectId + -ServicePrincipalId -AppRoleAssignmentId [] ``` @@ -57,7 +57,7 @@ For delegated scenarios, the calling user needs at least one of the following Mi Connect-Entra -Scopes 'AppRoleAssignment.ReadWrite.All' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $ServicePrincipal.ObjectId AppRoleAssignmentId = '2bbbbbb2-3cc3-4dd4-5ee5-6ffffffffff6' } @@ -66,7 +66,7 @@ Remove-EntraBetaServicePrincipalAppRoleAssignment @params This example demonstrates how to remove a service principal application role assignment in Microsoft Entra ID. -- `-ObjectId` - specifies the unique identifier (Object ID) of the service principal or user from which you want to remove an app role assignment. +- `-ServicePrincipalId` - specifies the unique identifier (Object ID) of the service principal or user from which you want to remove an app role assignment. - `-AppRoleAssignmentId` - specifies the unique identifier (ID) of the app role assignment that you want to remove. The value `2bbbbbb2-3cc3-4dd4-5ee5-6ffffffffff6` represents the ID of the specific app role assignment to be removed. @@ -88,14 +88,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalOwner.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalOwner.md index 27d32e6c8..97d6d0798 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalOwner.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalOwner.md @@ -26,7 +26,7 @@ Removes an owner from a service principal. ```powershell Remove-EntraBetaServicePrincipalOwner -OwnerId - -ObjectId + -ServicePrincipalId [] ``` @@ -41,10 +41,10 @@ The `Remove-EntraBetaServicePrincipalOwner` cmdlet removes an owner from a servi ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" -$owner = Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com' +$owner = Get-EntraBetaUser -UserId 'SawyerM@contoso.com' $params= @{ - ObjectId = $servicePrincipal.Id + ServicePrincipalId = $servicePrincipal.Id OwnerId = $owner.Id } Remove-EntraBetaServicePrincipalOwner @params @@ -52,19 +52,19 @@ Remove-EntraBetaServicePrincipalOwner @params This example demonstrates how to remove an owner from a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. - `-OwnerId` parameter specifies the service principal owner Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalPasswordCredential.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalPasswordCredential.md index 67802a6a8..013e8b373 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalPasswordCredential.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaServicePrincipalPasswordCredential.md @@ -25,7 +25,7 @@ Removes a password credential from a service principal. ```powershell Remove-EntraBetaServicePrincipalPasswordCredential - -ObjectId + -ServicePrincipalId -KeyId [] ``` @@ -42,7 +42,7 @@ The `Remove-EntraBetaServicePrincipalPasswordCredential` cmdlet removes a passwo Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $ServicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq ''" $Params = @{ - ObjectId = $ServicePrincipal.ObjectId + ServicePrincipalId = $ServicePrincipal.ObjectId KeyId = 'bbbbbbbb-1c1c-2d2d-3e3e-444444444444' } Remove-EntraBetaServicePrincipalPasswordCredential @Params @@ -50,7 +50,7 @@ Remove-EntraBetaServicePrincipalPasswordCredential @Params This example demonstrates how to remove a password credential from a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ObjectId of a specified Service Principal Password Credential. +- `-ServicePrincipalId` parameter specifies the ObjectId of a specified Service Principal Password Credential. - `-KeyId` parameter specifies the unique identifier of a Password Credential. ## Parameters @@ -71,14 +71,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUser.md index fbe06b2e1..b84d22cf7 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUser.md @@ -25,13 +25,13 @@ Removes a user. ```powershell Remove-EntraBetaUser - -ObjectId + -UserId [] ``` ## Description -The `Remove-EntraBetaUser` cmdlet removes a user in Microsoft Entra ID. Specify the `ObjectId` parameter to remove the specified user in Microsoft Entra ID. +The `Remove-EntraBetaUser` cmdlet removes a user in Microsoft Entra ID. Specify the `UserId` parameter to remove the specified user in Microsoft Entra ID. The calling user must be assigned at least one of the following Microsoft Entra roles: @@ -44,21 +44,21 @@ The calling user must be assigned at least one of the following Microsoft Entra ```powershell Connect-Entra -Scopes 'User.ReadWrite.All' -Remove-EntraBetaUser -ObjectId 'SawyerM@Contoso.com' +Remove-EntraBetaUser -UserId 'SawyerM@Contoso.com' ``` This command removes the specified user in Microsoft Entra ID. ## Parameters -### -ObjectId +### -UserId -Specifies the ID of a user (as a UPN or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a UPN or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUserManager.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUserManager.md index 65aef82c7..756fc1b1f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUserManager.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Remove-EntraBetaUserManager.md @@ -26,13 +26,13 @@ Removes a user's manager. ```powershell Remove-EntraBetaUserManager - -ObjectId + -UserId [] ``` ## Description -The `Remove-EntraBetaUserManager` cmdlet removes a user's manager in Microsoft Entra ID. Specify the `ObjectId` parameter to remove the manager for a user in Microsoft Entra ID. +The `Remove-EntraBetaUserManager` cmdlet removes a user's manager in Microsoft Entra ID. Specify the `UserId` parameter to remove the manager for a user in Microsoft Entra ID. ## Examples @@ -40,8 +40,8 @@ The `Remove-EntraBetaUserManager` cmdlet removes a user's manager in Microsoft E ```powershell Connect-Entra -Scopes 'User.ReadWrite.All' -$User = Get-EntraBetaUser -ObjectId 'SawyerM@Contoso.com' -Remove-EntraBetaUserManager -ObjectId $User.ObjectId +$User = Get-EntraBetaUser -UserId 'SawyerM@Contoso.com' +Remove-EntraBetaUserManager -UserId $User.ObjectId ``` This example shows how to remove a user's manager. @@ -50,14 +50,14 @@ You can use `Get-EntraBetaUser` command to get the user's details. ## Parameters -### -ObjectId +### -UserId Specifies the ID of a user (as a User Principle Name or ObjectId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Revoke-EntraBetaUserAllRefreshToken.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Revoke-EntraBetaUserAllRefreshToken.md index 8b297a7c7..417563fe4 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Revoke-EntraBetaUserAllRefreshToken.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Revoke-EntraBetaUserAllRefreshToken.md @@ -24,7 +24,7 @@ Invalidates the refresh tokens issued to applications for a user. ```powershell Revoke-EntraBetaUserAllRefreshToken - -ObjectId + -UserId [] ``` @@ -44,7 +44,7 @@ This operation is usually performed by the user or an administrator if the user' ```powershell Connect-Entra -Scopes 'User.RevokeSessions.All' -Revoke-EntraBetaUserAllRefreshToken -ObjectId 'SawyerM@contoso.com' +Revoke-EntraBetaUserAllRefreshToken -UserId 'SawyerM@contoso.com' ``` ```Output @@ -55,18 +55,18 @@ True This example demonstrates how to revoke the tokens for the specified user. -- `-ObjectId` parameter specifies the unique identifier of a user. +- `-UserId` parameter specifies the unique identifier of a user. ## Parameters -### -ObjectId +### -UserId Specifies the unique ID of a user. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAdministrativeUnit.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAdministrativeUnit.md index 02614eed9..9e60ac84f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAdministrativeUnit.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAdministrativeUnit.md @@ -25,7 +25,7 @@ Updates an administrative unit. ```powershell Set-EntraBetaAdministrativeUnit - -Id + -AdministrativeUnitId [-IsMemberManagementRestricted ] [-Description ] [-DisplayName ] @@ -34,7 +34,7 @@ Set-EntraBetaAdministrativeUnit ## Description -The `Set-EntraBetaAdministrativeUnit` cmdlet updates an administrative unit in Microsoft Entra ID. Specify `Id` parameter to update a specific administrative unit. +The `Set-EntraBetaAdministrativeUnit` cmdlet updates an administrative unit in Microsoft Entra ID. Specify `AdministrativeUnitId` parameter to update a specific administrative unit. In delegated scenarios, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with the `microsoft.directory/administrativeUnits/allProperties/allTasks` permission. @@ -48,7 +48,7 @@ The Privileged Role Administrator is the least privileged role required for this Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - Id = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId DisplayName = 'UpdatedAU' } Set-EntraBetaAdministrativeUnit @params @@ -56,7 +56,7 @@ Set-EntraBetaAdministrativeUnit @params This Command update DisplayName of specific administrative unit. -- `-Id` parameter specifies the Id of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the Id of an administrative unit. - `-DisplayName` parameter specifies the display name for the administrative unit. ### Example 2: Update Description @@ -65,7 +65,7 @@ This Command update DisplayName of specific administrative unit. Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - Id = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId Description = 'Updated AU Description' } Set-EntraBetaAdministrativeUnit @params @@ -73,7 +73,7 @@ Set-EntraBetaAdministrativeUnit @params This example shows how to update the description of a specific administrative unit. -- `-Id` parameter specifies the Id of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the Id of an administrative unit. - `-Description` parameter specifies the description for the administrative unit. ### Example 3: Update IsMemberManagementRestricted @@ -82,7 +82,7 @@ This example shows how to update the description of a specific administrative un Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - Id = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId IsMemberManagementRestricted = $true } Set-EntraBetaAdministrativeUnit @params @@ -90,7 +90,7 @@ Set-EntraBetaAdministrativeUnit @params This example shows how to update the `IsMemberManagementRestricted` setting for a specific administrative unit. -- `-Id` parameter specifies the Id of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the Id of an administrative unit. - `-IsMemberManagementRestricted` parameter specifies the management rights on resources in the administrative units should be restricted to ONLY the administrators scoped on the administrative unit object. ## Parameters @@ -143,14 +143,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -AdministrativeUnitId Specifies the Id of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplication.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplication.md index 8e6c63331..3bbe6af55 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplication.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplication.md @@ -27,7 +27,7 @@ Updates the properties of an application object. ```powershell Set-EntraBetaApplication - -ObjectId + -ApplicationId [-Api ] [-OptionalClaims ] [-DisplayName ] @@ -64,7 +64,7 @@ Updates the properties of an application object. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId DisplayName = 'New Demo Application' } Set-EntraBetaApplication @params @@ -78,7 +78,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId IdentifierUris = 'https://mynewapp.contoso.com' } Set-EntraBetaApplication @params @@ -92,7 +92,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId GroupMembershipClaims = 'SecurityGroup' } Set-EntraBetaApplication @params @@ -106,7 +106,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId IsDeviceOnlyAuthSupported = $false } Set-EntraBetaApplication @params @@ -120,7 +120,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId Tags = 'mytag' } Set-EntraBetaApplication @params @@ -304,14 +304,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationLogo.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationLogo.md index 5d0a12dca..a50c62f30 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationLogo.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationLogo.md @@ -28,7 +28,7 @@ Sets the logo for an Application ```powershell Set-EntraBetaApplicationLogo - -ObjectId + -ApplicationId -FilePath [] ``` @@ -37,7 +37,7 @@ Set-EntraBetaApplicationLogo ```powershell Set-EntraBetaApplicationLogo - -ObjectId + -ApplicationId [] ``` @@ -45,7 +45,7 @@ Set-EntraBetaApplicationLogo ```powershell Set-EntraBetaApplicationLogo - -ObjectId + -ApplicationId [] ``` @@ -55,19 +55,15 @@ The `Set-EntraBetaApplicationLogo` cmdlet is used to set the logo for an applica ## Examples -### Example 1: Sets the application logo for the application specified by the ObjectID parameter +### Example 1: Sets the application logo for the application specified by the ApplicationId parameter ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' $application = Get-EntraBetaApplication -Filter "DisplayName eq 'Demo Application'" -$params = @{ - ObjectId = $application.ObjectId - FilePath = 'D:\applogo.jpg' -} -Set-EntraBetaApplicationLogo @params +Set-EntraBetaApplicationLogo -ApplicationId $application.Id -FilePath 'D:\applogo.jpg' ``` -This cmdlet sets the application logo for the application specified by the `-ObjectId` parameter to the image specified with the `-FilePath` parameter. +This cmdlet sets the application logo for the application specified by the `-ApplicationId` parameter to the image specified with the `-FilePath` parameter. ## Parameters @@ -87,14 +83,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId -The ObjectID of the Application for which the logo is set. +The ApplicationId of the Application for which the logo is set. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: False Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplication.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplication.md index fe10fd1f2..9e3b416f8 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplication.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplication.md @@ -26,7 +26,7 @@ The `Set-EntraBetaApplicationProxyApplication` allows you to modify and set conf ```powershell Set-EntraBetaApplicationProxyApplication - -ObjectId + -ApplicationId [-ExternalUrl ] [-InternalUrl ] [-ExternalAuthenticationType ] @@ -42,7 +42,7 @@ Set-EntraBetaApplicationProxyApplication ## Description -The `Set-EntraBetaApplicationProxyApplication` allows you to modify and set other settings for an application in Microsoft Entra ID configured to use ApplicationProxy. Specify `ObjectId` parameter to update application configured for application proxy. +The `Set-EntraBetaApplicationProxyApplication` allows you to modify and set other settings for an application in Microsoft Entra ID configured to use ApplicationProxy. Specify `ApplicationId` parameter to update application configured for application proxy. ## Examples @@ -51,7 +51,7 @@ The `Set-EntraBetaApplicationProxyApplication` allows you to modify and set othe ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' $params = @{ - ObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + ApplicationId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ExternalUrl = 'https://finance-awcycles.msappproxy.net/' InternalUrl = 'http://finance/' ExternalAuthenticationType = 'AadPreAuthentication' @@ -80,7 +80,7 @@ isPersistentCookieEnabled : False This example update `ExternalUrl`, `InternalUrl`, `ExternalAuthenticationType`, and `IsTranslateHostHeaderEnabled` parameter. -- `-ObjectId` parameter specifies the application ID. +- `-ApplicationId` parameter specifies the application ID. - `-ExternalUrl` parameter specifies the URL that use to access the application from outside user private network. - `-InternalUrl` parameter specifies the URL that use to access the application from inside user private network. - `-ExternalAuthenticationType` parameter specifies the external authentication type. @@ -91,7 +91,7 @@ This example update `ExternalUrl`, `InternalUrl`, `ExternalAuthenticationType`, ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' $params = @{ - ObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + ApplicationId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ExternalUrl = 'https://finance-awcycles.msappproxy.net/' InternalUrl = 'http://finance/' ExternalAuthenticationType = 'AadPreAuthentication' @@ -123,7 +123,7 @@ isPersistentCookieEnabled : False This example update `IsHttpOnlyCookieEnabled`, `IsSecureCookieEnabled`, and `IsPersistentCookieEnabled` parameter. -- `-ObjectId` parameter specifies the application ID. +- `-ApplicationId` parameter specifies the application ID. - `-ExternalUrl` parameter specifies the URL that use to access the application from outside user private network. - `-InternalUrl` parameter specifies the URL that use to access the application from inside user private network. - `-ExternalAuthenticationType` parameter specifies the external authentication type. @@ -137,7 +137,7 @@ This example update `IsHttpOnlyCookieEnabled`, `IsSecureCookieEnabled`, and `IsP ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' $params = @{ - ObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + ApplicationId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ExternalUrl = 'https://finance-awcycles.msappproxy.net/' InternalUrl = 'http://finance/' ExternalAuthenticationType = 'AadPreAuthentication' @@ -168,7 +168,7 @@ isPersistentCookieEnabled : False This example update `IsTranslateLinksInBodyEnabled`, `ApplicationServerTimeout`, and `ConnectorGroupId` parameter. -- `-ObjectId` parameter specifies the application ID. +- `-ApplicationId` parameter specifies the application ID. - `-ExternalUrl` parameter specifies the URL that use to access the application from outside user private network. - `-InternalUrl` parameter specifies the URL that use to access the application from inside user private network. - `-ConnectorGroupId` parameter specifies the Connector group ID that assigned to this application. @@ -178,7 +178,7 @@ This example update `IsTranslateLinksInBodyEnabled`, `ApplicationServerTimeout`, ## Parameters -### -ObjectId +### -ApplicationId Specifies a unique application ID of an application in Microsoft Entra ID. This objectid can be found using the `Get-EntraBetaApplication` command. @@ -186,7 +186,7 @@ This objectid can be found using the `Get-EntraBetaApplication` command. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplicationConnectorGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplicationConnectorGroup.md index cf7173488..061341d0f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplicationConnectorGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyApplicationConnectorGroup.md @@ -26,14 +26,14 @@ The `Set-EntraBetaApplicationProxyApplicationConnectorGroup` cmdlet assigns the ```powershell Set-EntraBetaApplicationProxyApplicationConnectorGroup - -ObjectId + -OnPremisesPublishingProfileId -ConnectorGroupId [] ``` ## Description -The `Set-EntraBetaApplicationProxyApplicationConnectorGroup` cmdlet sets the connector group assigned for the specified application. Specify `ObjectId` and `ConnectorGroupId` parameter to assign the given connector group to a specified application. +The `Set-EntraBetaApplicationProxyApplicationConnectorGroup` cmdlet sets the connector group assigned for the specified application. Specify `OnPremisesPublishingProfileId` and `ConnectorGroupId` parameter to assign the given connector group to a specified application. The application must be configured for Application Proxy in Microsoft Entra ID. @@ -44,7 +44,7 @@ The application must be configured for Application Proxy in Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' $params = @{ - ObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + OnPremisesPublishingProfileId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ConnectorGroupId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } Set-EntraBetaApplicationProxyApplicationConnectorGroup @params @@ -52,7 +52,7 @@ Set-EntraBetaApplicationProxyApplicationConnectorGroup @params This example set a new Connector Group for a specific application. -- `ObjectId` parameter specifies the application ID. +- `OnPremisesPublishingProfileId` parameter specifies the application ID. - `ConnectorGroupId` parameter specifies the connector group ID that assign to the application. ## Parameters @@ -74,7 +74,7 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -OnPremisesPublishingProfileId The unique application ID for the application the Connector group assigns to. The application ID can be found using the `Get-EntraBetaApplication` command. @@ -82,7 +82,7 @@ The application ID can be found using the `Get-EntraBetaApplication` command. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyConnector.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyConnector.md index 43bf96d73..3e9ab099e 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyConnector.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaApplicationProxyConnector.md @@ -26,7 +26,7 @@ The `Set-EntraBetaApplicationProxyConnector` cmdlet allows reassignment of the c ```powershell Set-EntraBetaApplicationProxyConnector - -Id + -OnPremisesPublishingProfileId -ConnectorGroupId [] ``` @@ -42,7 +42,7 @@ The `Set-EntraBetaApplicationProxyConnector` cmdlet allows reassignment of the c ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' $params = @{ - Id = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + OnPremisesPublishingProfileId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ConnectorGroupId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } Set-EntraBetaApplicationProxyConnector @params @@ -50,12 +50,12 @@ Set-EntraBetaApplicationProxyConnector @params This example demonstrates how to move a Connector to a different Connector Group. -- `-Id` parameter specifies the connector ID. +- `-OnPremisesPublishingProfileId` parameter specifies the connector ID. - `-ConnectorGroupId` parameter specifies the application proxy connector group ID. ## Parameters -### -Id +### -OnPremisesPublishingProfileId The ID of the Connector being moved. Use the `Get-EntraBetaApplicationProxyConnectorGroup` command to find the Connector Group ID. @@ -63,7 +63,7 @@ Use the `Get-EntraBetaApplicationProxyConnectorGroup` command to find the Connec ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAttributeSet.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAttributeSet.md index b3d8f64b4..bbf3b5250 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAttributeSet.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaAttributeSet.md @@ -26,7 +26,7 @@ Updates an existing attribute set. ```powershell Set-EntraBetaAttributeSet - -Id + -AttributeSetId [-Description ] [-MaxAttributesPerSet ] [] @@ -34,11 +34,13 @@ Set-EntraBetaAttributeSet ## Description -Updates a Microsoft Entra ID attribute set object identified by ID. Specify `Id` parameter to update an attribute set. +The `Set-EntraBetaAttributeSet` cmdlet updates a Microsoft Entra ID attribute set object specified by its ID. Specify `AttributeSetId` parameter to Update a Microsoft Entra ID attribute set object. -You can only update the `description` and `maxAttributesPerSet` properties. +In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. + +Note: Only the Attribute Definition Administrator role is supported for this operation. Ensure the signed-in user is assigned this role. -In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with the necessary permissions. The Attribute Definition Administrator is the only privileged role supported for this operation. +You can only update the `description` and `maxAttributesPerSet` properties. ## Examples @@ -47,7 +49,7 @@ In delegated scenarios with work or school accounts, the signed-in user must be ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' $params = @{ - Id = 'Engineering' + AttributeSetId = 'Engineering' Description = 'Attributes for engineering team' } Set-EntraBetaAttributeSet @params @@ -55,7 +57,7 @@ Set-EntraBetaAttributeSet @params This example update an attribute set. -- `Id` parameter specifies the name of the attribute set. You can `Get-EntraBetaAttributeSet` to get more details. +- `AttributeSetId` parameter specifies the name of the attribute set. You can `Get-EntraBetaAttributeSet` to get more details. - `Description` parameter specifies the description for the attribute set. ### Example 2: Update an attribute set using MaxAttributesPerSet @@ -63,7 +65,7 @@ This example update an attribute set. ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' $params = @{ - Id = 'Engineering' + AttributeSetId = 'Engineering' MaxAttributesPerSet = 10 } Set-EntraBetaAttributeSet @params @@ -71,7 +73,7 @@ Set-EntraBetaAttributeSet @params This example update an attribute set using MaxAttributesPerSet. -- `-Id` parameter specifies the name of the attribute set. You can `Get-EntraBetaAttributeSet` to get more details. +- `-AttributeSetId` parameter specifies the name of the attribute set. You can `Get-EntraBetaAttributeSet` to get more details. - `-MaxAttributesPerSet` parameter specifies the maximum number of custom security attributes. ## Parameters @@ -92,14 +94,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -AttributeSetId Name of the attribute set. Unique identifier for the attribute set within a tenant. This identifier can be up to 32 characters long and may include Unicode characters. It cannot contain spaces or special characters, and it cannot be changed later. The identifier is case insensitive. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDevice.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDevice.md index 395480ca4..48fa83abe 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDevice.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDevice.md @@ -26,7 +26,7 @@ Updates a device. ```powershell Set-EntraBetaDevice - -ObjectId + -DeviceObjectId [-DevicePhysicalIds ] [-DeviceOSType ] [-DeviceTrustType ] @@ -57,7 +57,7 @@ The calling user must have at least the Intune Administrator role in Microsoft E ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' -Set-EntraBetaDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DisplayName 'My OS/2 computer' +Set-EntraBetaDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DisplayName 'My OS/2 computer' ``` This example shows how to update a display name of a specified. @@ -69,7 +69,7 @@ Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' $NewId= New-Object Microsoft.Open.AzureAD.Model.AlternativeSecurityId $NewId.Key =[System.Text.Encoding]::UTF8.GetBytes('test') $NewId.type = 2 -Set-EntraBetaDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AlternativeSecurityIds $NewId +Set-EntraBetaDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AlternativeSecurityIds $NewId ``` This example shows how to update an alternative security ID of a specified device. @@ -78,7 +78,7 @@ This example shows how to update an alternative security ID of a specified devic ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' -Set-EntraBetaDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AccountEnabled $true +Set-EntraBetaDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AccountEnabled $true ``` This example shows how to update an account enabled of a specified device. @@ -87,7 +87,7 @@ This example shows how to update an account enabled of a specified device. ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' -Set-EntraBetaDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DeviceOSType Windows +Set-EntraBetaDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DeviceOSType Windows ``` This example shows how to update an OS type of a specified device. @@ -98,7 +98,7 @@ This example shows how to update an OS type of a specified device. Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' $params = @{ - ObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + DeviceObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' DeviceMetadata = 'Testdevice' DeviceObjectVersion = 4 DevicePhysicalIds = '[GID]:g:1234567890123456' @@ -320,14 +320,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -DeviceObjectId Specifies the object ID of a device in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDirectoryRoleDefinition.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDirectoryRoleDefinition.md index f7a18e36e..f85d4d183 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDirectoryRoleDefinition.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaDirectoryRoleDefinition.md @@ -26,7 +26,7 @@ Update an existing Microsoft Entra ID roleDefinition. ```powershell Set-EntraBetaDirectoryRoleDefinition - -Id + -UnifiedRoleDefinitionId [-IsEnabled ] [-InheritsPermissionsFrom ] [-Version ] @@ -50,7 +50,7 @@ Updates a Microsoft Entra roleDefinition object identified by ID. You can't upda Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $roleDefinition = Get-EntraBetaDirectoryRoleDefinition -Filter "DisplayName eq ''" $params = @{ - Id = $roleDefinition.ObjectId + UnifiedRoleDefinitionId = $roleDefinition.Id DisplayName = 'UpdatedDisplayName' } Set-EntraBetaDirectoryRoleDefinition @params @@ -58,7 +58,7 @@ Set-EntraBetaDirectoryRoleDefinition @params This example updates the specified role definition in Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. - `-DisplayName` parameter specifies the display name for the role definition. ### Example 2: Update an roleDefinition with Description @@ -67,7 +67,7 @@ This example updates the specified role definition in Microsoft Entra ID. Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $roleDefinition = Get-EntraBetaDirectoryRoleDefinition -Filter "DisplayName eq ''" $params = @{ - Id = $roleDefinition.ObjectId + UnifiedRoleDefinitionId = $roleDefinition.Id Description = 'MYROLEUPDATE1S' } Set-EntraBetaDirectoryRoleDefinition @params @@ -75,7 +75,7 @@ Set-EntraBetaDirectoryRoleDefinition @params This example updates the Description of specified role definition in Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. - `-Description` parameter specifies the description for the role definition. ### Example 3: Update an roleDefinition with IsEnabled @@ -84,7 +84,7 @@ This example updates the Description of specified role definition in Microsoft E Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $roleDefinition = Get-EntraBetaDirectoryRoleDefinition -Filter "DisplayName eq ''" $params = @{ - Id = $roleDefinition.ObjectId + UnifiedRoleDefinitionId = $roleDefinition.Id IsEnabled = $true } Set-EntraBetaDirectoryRoleDefinition @params @@ -92,7 +92,7 @@ Set-EntraBetaDirectoryRoleDefinition @params This example updates the IsEnabled of specified role definition in Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. - `-IsEnabled` parameter specifies whether the role definition is enabled. ### Example 4: Update an roleDefinition @@ -103,7 +103,7 @@ $roleDefinition = Get-EntraBetaDirectoryRoleDefinition -Filter "DisplayName eq ' $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/standard/read") $params = @{ - Id = $roleDefinition.ObjectId + UnifiedRoleDefinitionId = $roleDefinition.Id Description = 'Update' DisplayName = 'Update' ResourceScopes = '/' @@ -118,7 +118,7 @@ Set-EntraBetaDirectoryRoleDefinition @params This example updates the RolePermissions, TemplateId, TemplateId, ResourceScopes of specified role definition in Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. - `-RolePermissions` parameter specifies the permissions for the role definition. - `-IsEnabled` parameter specifies whether the role definition is enabled. - `-DisplayName` parameter specifies the display name for the role definition. @@ -161,14 +161,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -UnifiedRoleDefinitionId Specifies the roleDefinition object ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroup.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroup.md index a7c1cc9e8..907790d7d 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroup.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroup.md @@ -26,7 +26,7 @@ Sets the properties for an existing Microsoft Entra ID group. ```powershell Set-EntraBetaGroup - -Id + -GroupId [-GroupTypes ] [-DisplayName ] [-Description ] @@ -42,7 +42,7 @@ Set-EntraBetaGroup ## Description -The `Set-EntraBetaGroup` cmdlet sets the properties for an existing Microsoft Entra ID group. Specify the `Id` parameter to set the properties for an existing Microsoft Entra ID group. +The `Set-EntraBetaGroup` cmdlet sets the properties for an existing Microsoft Entra ID group. Specify the `GroupId` parameter to set the properties for an existing Microsoft Entra ID group. ## Examples @@ -52,7 +52,7 @@ The `Set-EntraBetaGroup` cmdlet sets the properties for an existing Microsoft En Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId DisplayName = 'UPDATE HelpDesk Team Leaders' } Set-EntraBetaGroup @params @@ -66,7 +66,7 @@ This command updates the display name of a specified group in Microsoft Entra ID Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId Description = 'This is my new group' } Set-EntraBetaGroup @params @@ -80,7 +80,7 @@ This example demonstrates how to update a group description. Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId MailNickName = 'newnickname' } Set-EntraBetaGroup @params @@ -94,7 +94,7 @@ This command updates the mail nickname of a specified group in Microsoft Entra I Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId SecurityEnabled = $true } Set-EntraBetaGroup @params @@ -108,7 +108,7 @@ This command updates the security enabled of a specified group in Microsoft Entr Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId MailEnabled = $false } Set-EntraBetaGroup @params @@ -122,7 +122,7 @@ This example demonstrates how to update a group main enabled. Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId Visibility = 'Private' GroupTypes = 'DynamicMembership' IsAssignableToRole = $true @@ -138,7 +138,7 @@ This example demonstrates how to update a property for an existing Microsoft Ent Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId MembershipRule = '(user.UserType -contains "Member")' } Set-EntraBetaGroup @params @@ -151,7 +151,7 @@ This example demonstrates how to update the membership rule of a specified group ```powershell Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraBetaGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -Set-EntraBetaGroup -Id $group.ObjectId -MembershipRuleProcessingState 'On' +Set-EntraBetaGroup -GroupId $group.ObjectId -MembershipRuleProcessingState 'On' ``` This example demonstrates how to update the membership rule processing state of a specified group in Microsoft Entra ID. @@ -207,14 +207,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupId Specifies the object ID of a group. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroupLifecyclePolicy.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroupLifecyclePolicy.md index 280c502ec..e89017571 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroupLifecyclePolicy.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaGroupLifecyclePolicy.md @@ -25,7 +25,7 @@ Updates a specific group Lifecycle Policy in Microsoft Entra ID. ```powershell Set-EntraBetaGroupLifecyclePolicy - -Id + -GroupLifecyclePolicyId [-AlternateNotificationEmails ] [-ManagedGroupTypes ] [-GroupLifetimeInDays ] @@ -44,7 +44,7 @@ The `Set-EntraBetaGroupLifecyclePolicy` command updates a specific group Lifecyc Connect-Entra -Scopes 'Directory.ReadWrite.All' $policy = Get-EntraBetaGroupLifecyclePolicy | Select-Object -First 1 $params = @{ - Id = $policy.Id + GroupLifecyclePolicyId = $policy.Id GroupLifetimeInDays = 200 AlternateNotificationEmails = 'example@contoso.com' ManagedGroupTypes = 'All' @@ -60,7 +60,7 @@ ffffffff-5555-6666-7777-aaaaaaaaaaaa example@contoso.com 200 This example updates the specified groupLifecyclePolicy in Microsoft Entra ID. -- `-Id` parameter specifies the ID of the Lifecycle Policy to be modified. +- `-GroupLifecyclePolicyId` parameter specifies the ID of the Lifecycle Policy to be modified. - `-GroupLifetimeInDays` parameter specifies the lifetime of the groups in the policy to 200 days. The GroupLifetimeInDays represents the number of days before a group expires and needs to be renewed. Once renewed, the group expiration is extended by the number of days defined. - `-AlternateNotificationEmails` parameter specifies the email address that receives notifications about the policy. Multiple email address can be defined by separating email address with a semicolon. - `-ManagedGroupTypes` parameter specifies which office 365 groups the policy applies to. Possible values are `All`, `Selected`, or `None`. @@ -101,14 +101,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupLifecyclePolicyId Specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaIdentityProvider.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaIdentityProvider.md index 294f7a769..3b9fe9248 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaIdentityProvider.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaIdentityProvider.md @@ -27,7 +27,7 @@ Update the properties of an existing identity provider configured in the directo ```powershell Set-EntraBetaIdentityProvider - -Id + -IdentityProviderBaseId [-Type ] [-Name ] [-ClientId ] @@ -48,7 +48,7 @@ The type of the identity provider can't be modified. ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' $params = @{ - Id = 'Google-OAuth' + IdentityProviderBaseId = 'Google-OAuth' ClientId = 'NewClientID' } Set-EntraBetaIdentityProvider @params @@ -56,7 +56,7 @@ Set-EntraBetaIdentityProvider @params This example updates the client ID for the specified identity provider. -- `-Id` parameter specifies the unique identifier of the identity provider. +- `-IdentityProviderBaseId` parameter specifies the unique identifier of the identity provider. - `-ClientId` parameter specifies the client identifier for the application, obtained during the application's registration with the identity provider. ### Example 2: Update client secret of an identity provider @@ -64,7 +64,7 @@ This example updates the client ID for the specified identity provider. ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' $params = @{ - Id = 'Google-OAuth' + IdentityProviderBaseId = 'Google-OAuth' ClientSecret = 'NewClientSecret' } Set-EntraBetaIdentityProvider @params @@ -72,7 +72,7 @@ Set-EntraBetaIdentityProvider @params This example updates the client secret for the specified identity provider. -- `-Id` parameter specifies the unique identifier of the identity provider. +- `-IdentityProviderBaseId` parameter specifies the unique identifier of the identity provider. - `-ClientSecret` parameter specifies the client secret for the application, obtained during registration with the identity provider. ### Example 3: Update display name of an identity provider @@ -80,7 +80,7 @@ This example updates the client secret for the specified identity provider. ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' $params = @{ - Id = 'Google-OAuth' + IdentityProviderBaseId = 'Google-OAuth' Name = 'NewGoogleName' } Set-EntraBetaIdentityProvider @params @@ -88,7 +88,7 @@ Set-EntraBetaIdentityProvider @params This example updates the display name for the specified identity provider. -- `-Id` parameter specifies the unique identifier of the identity provider. +- `-IdentityProviderBaseId` parameter specifies the unique identifier of the identity provider. - `-Name` parameter specifies the display name of the identity provider. ## Parameters @@ -125,14 +125,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -IdentityProviderBaseId The unique identifier for an identity provider. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaServicePrincipal.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaServicePrincipal.md index 545849010..a0c98ba05 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaServicePrincipal.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaServicePrincipal.md @@ -26,7 +26,7 @@ Updates a service principal. ```powershell Set-EntraBetaServicePrincipal - -ObjectId + -ServicePrincipalId [-KeyCredentials ] [-Homepage ] [-AppId ] @@ -56,7 +56,7 @@ The `Set-EntraBetaServicePrincipal` cmdlet updates a service principal in Micros Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId AccountEnabled = $False } Set-EntraBetaServicePrincipal @params @@ -64,7 +64,7 @@ Set-EntraBetaServicePrincipal @params This example demonstrates how to update `AccountEnabled` of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-AccountEnabled` parameter specifies indicates whether the account is enabled. ### Example 2: Update AppId and Homepage of a service principal @@ -73,7 +73,7 @@ This example demonstrates how to update `AccountEnabled` of a service principal Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId AppId = '22223333-cccc-4444-dddd-5555eeee6666' Homepage = 'https://*.e-days.com/SSO/SAML2/SP/AssertionConsumer.aspx?metadata=e-days|ISV9.2|primary|z' } @@ -82,7 +82,7 @@ Set-EntraBetaServicePrincipal @params This example demonstrates how to update `AppId` and Homepage of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-AppId` parameter specifies the application ID. - `-Homepage` parameter specifies the home page or landing page of the application. @@ -92,7 +92,7 @@ This example demonstrates how to update `AppId` and Homepage of a service princi Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId AlternativeNames = 'Service Principal Demo' DisplayName = 'NewName' } @@ -101,7 +101,7 @@ Set-EntraBetaServicePrincipal @params This example demonstrates how to update AlternativeNames and DisplayName of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ### Example 4: Update LogoutUrl and ReplyUrls of a service principal @@ -109,7 +109,7 @@ This example demonstrates how to update AlternativeNames and DisplayName of a se Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId LogoutUrl = 'https://securescore.office.com/SignOut' ReplyUrls = 'https://admin.contoso.com' } @@ -118,7 +118,7 @@ Set-EntraBetaServicePrincipal @params This example demonstrates how to update LogoutUrl and ReplyUrls of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-LogoutUrl` parameter specifies the sign out URL. - `-ReplyUrls` parameter specifies the URLs that user tokens are sent to for sign in with the associated application. @@ -128,7 +128,7 @@ This example demonstrates how to update LogoutUrl and ReplyUrls of a service pri Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId ServicePrincipalType = 'Application' AppRoleAssignmentRequired = $True } @@ -137,7 +137,7 @@ Set-EntraBetaServicePrincipal @params This example demonstrates how to update `ServicePrincipalType` and `AppRoleAssignmentRequired` of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-ServicePrincipalType` parameter specifies the service principal type. - `-AppRoleAssignmentRequired` parameter specifies indicates whether an application role assignment is required. @@ -154,7 +154,7 @@ $creds.Type = 'Symmetric' $creds.Usage = 'Sign' $creds.Value = [System.Text.Encoding]::UTF8.GetBytes('A') $creds.EndDate = Get-Date -Year 2025 -Month 12 -Day 20 -Set-EntraBetaServicePrincipal -ObjectId $servicePrincipal.ObjectId -KeyCredentials $creds +Set-EntraBetaServicePrincipal -ServicePrincipalId $servicePrincipal.ObjectId -KeyCredentials $creds ``` This example demonstrates how to update KeyCredentials of a service principal in Microsoft Entra ID. @@ -167,7 +167,7 @@ Use the `New-EntraBetaServicePrincipalPasswordCredential` and `Remove-EntraBetaS Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraBetaServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId PreferredSingleSignOnMode = 'saml' } Set-EntraBetaServicePrincipal @params @@ -175,7 +175,7 @@ Set-EntraBetaServicePrincipal @params This example demonstrates how to update `PreferredSingleSignOnMode` of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-PreferredSingleSignOnMode` parameter specifies the single sign-on mode configured for this application. ## Parameters @@ -308,14 +308,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Species the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUser.md index 501f92b0e..15369894e 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUser.md @@ -25,7 +25,7 @@ Updates a user. ```powershell Set-EntraBetaUser - -ObjectId + -UserId [-PostalCode ] [-MailNickName ] [-ShowInAddressList ] @@ -60,7 +60,7 @@ Set-EntraBetaUser ## Description -The `Set-EntraBetaUser` cmdlet updates a user in Microsoft Entra ID. Specify the `ObjectId` parameter to update a user in Microsoft Entra ID. +The `Set-EntraBetaUser` cmdlet updates a user in Microsoft Entra ID. Specify the `UserId` parameter to update a user in Microsoft Entra ID. ## Examples @@ -68,9 +68,9 @@ The `Set-EntraBetaUser` cmdlet updates a user in Microsoft Entra ID. Specify the ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' -$user = Get-EntraBetaUser -ObjectId 'SawyerM@contoso.com' +$user = Get-EntraBetaUser -UserId 'SawyerM@contoso.com' $params = @{ - ObjectId = $user.ObjectId + UserId = $user.ObjectId DisplayName = 'Updated user Name' } Set-EntraBetaUser @params @@ -78,14 +78,14 @@ Set-EntraBetaUser @params This example updates the specified user's Display name parameter. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. ### Example 2: Set the specified user's AccountEnabled parameter ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' $params = @{ - ObjectId = 'SawyerM@contoso.com' + UserId = 'SawyerM@contoso.com' AccountEnabled = $true } Set-EntraBetaUser @params @@ -93,7 +93,7 @@ Set-EntraBetaUser @params This example updates the specified user's AccountEnabled parameter. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-AccountEnabled` Specifies whether the account is enabled. ### Example 3: Set all but specified users as minors with parental consent @@ -101,12 +101,12 @@ This example updates the specified user's AccountEnabled parameter. ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' Get-EntraBetaUser -All | Where-Object -FilterScript { $_.DisplayName -notmatch '(George|James|Education)' } | -ForEach-Object { Set-EntraBetaUser -ObjectId $($_.ObjectId) -AgeGroup 'minor' -ConsentProvidedForMinor 'granted' } +ForEach-Object { Set-EntraBetaUser -UserId $($_.ObjectId) -AgeGroup 'minor' -ConsentProvidedForMinor 'granted' } ``` This example updates the specified user's as minors with parental consent. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-ConsentProvidedForMinor` Sets whether consent has to obtained for minors. Allowed values: null, granted, denied, and notRequired. ### Example 4: Set the specified user's property @@ -114,7 +114,7 @@ This example updates the specified user's as minors with parental consent. ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' $params = @{ - ObjectId = 'SawyerM@contoso.com' + UserId = 'SawyerM@contoso.com' City = 'Add city name' CompanyName = 'Microsoft' Country = 'Add country name' @@ -135,7 +135,7 @@ Set-EntraBetaUser @params This example updates the specified user's property. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-UserType` classify user types in your directory, such as "Member" and "Guest." - `-PasswordPolicies` Specifies password policies for the user. - `-OtherMails` Specifies other email addresses for the user @@ -145,7 +145,7 @@ This example updates the specified user's property. ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All' $params= @{ -ObjectId = 'SawyerM@contoso.com' +UserId = 'SawyerM@contoso.com' PasswordProfile = @{ Password= '*****' ForceChangePasswordNextLogin = $true @@ -157,7 +157,7 @@ Set-EntraBetaUser @params This example updates the specified user's PasswordProfile parameter. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-PasswordProfile` specifies the user's password profile. ## Parameters @@ -359,14 +359,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user (as a User Principle Name or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a User Principle Name or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserManager.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserManager.md index 81228f660..8d5210a36 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserManager.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserManager.md @@ -25,14 +25,14 @@ Updates a user's manager. ```powershell Set-EntraBetaUserManager - -ObjectId + -UserId -RefObjectId [] ``` ## Description -The `Set-EntraBetaUserManager` cmdlet update the manager for a user in Microsoft Entra ID. Specify the `ObjectId` and `RefObjectId` parameters to update the manager for a user in Microsoft Entra ID. +The `Set-EntraBetaUserManager` cmdlet update the manager for a user in Microsoft Entra ID. Specify the `UserId` and `RefObjectId` parameters to update the manager for a user in Microsoft Entra ID. ## Examples @@ -40,10 +40,10 @@ The `Set-EntraBetaUserManager` cmdlet update the manager for a user in Microsoft ```powershell Connect-Entra -Scopes 'User.ReadWrite.All' -$manager = Get-EntraBetaUser -ObjectId 'Manager@contoso.com' +$manager = Get-EntraBetaUser -UserId 'Manager@contoso.com' $params = @{ - ObjectId = 'SawyerM@contoso.com' - RefObjectId = $manager.ObjectId + UserId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' + RefObjectId = '55ff55ff-aa66-bb77-cc88-99dd99dd99dd' } Set-EntraBetaUserManager @params ``` @@ -52,14 +52,14 @@ This example demonstrates how to update the manager for the specified user. ## Parameters -### -ObjectId +### -UserId Specifies the ID (as a User Principle Name or ObjectId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserThumbnailPhoto.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserThumbnailPhoto.md index 7c1397712..5e7ecbbe9 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserThumbnailPhoto.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Set-EntraBetaUserThumbnailPhoto.md @@ -29,7 +29,7 @@ Set the thumbnail photo for a user. ```powershell Set-EntraBetaUserThumbnailPhoto -FilePath - [-ObjectId ] + [-UserId ] [] ``` @@ -38,7 +38,7 @@ Set-EntraBetaUserThumbnailPhoto ```powershell Set-EntraBetaUserThumbnailPhoto -ImageByteArray - [-ObjectId ] + [-UserId ] [] ``` @@ -47,7 +47,7 @@ Set-EntraBetaUserThumbnailPhoto ```powershell Set-EntraBetaUserThumbnailPhoto -FileStream - [-ObjectId ] + [-UserId ] [] ``` @@ -64,15 +64,15 @@ Updating any user's photo in the organization requires the User.ReadWrite.All pe ```powershell Connect-Entra -Scopes 'User.ReadWrite','User.ReadWrite.All' $params = @{ - ObjectId = 'SawyerM@contoso.com' + UserId = 'SawyerM@contoso.com' FilePath = 'D:\UserThumbnailPhoto.jpg' } Set-EntraBetaUserThumbnailPhoto @params ``` -This example sets the thumbnail photo of the user specified with the ObjectId parameter to the image specified with the FilePath parameter. +This example sets the thumbnail photo of the user specified with the UserId parameter to the image specified with the FilePath parameter. -- `-ObjectId` parameter specifies the ID of a user in Microsoft Entra ID. +- `-UserId` parameter specifies the ID of a user in Microsoft Entra ID. - `-FilePath` parameter specifies the file path of the image to be uploaded as the user thumbnail photo. ## Parameters @@ -125,14 +125,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -UserId The Object ID of the user for which the user thumbnail photo is set. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: False Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraAdministrativeUnitMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraAdministrativeUnitMember.md index 49221e320..4fd404ec5 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraAdministrativeUnitMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraAdministrativeUnitMember.md @@ -28,7 +28,7 @@ Adds an administrative unit member. ```powershell Add-EntraAdministrativeUnitMember -RefObjectId - -ObjectId + -AdministrativeUnitId [] ``` @@ -47,9 +47,9 @@ To add a user, group, or device to an administrative unit, the calling principal ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" -$User = Get-EntraUser -ObjectId 'SawyerM@contoso.com' +$User = Get-EntraUser -UserId 'SawyerM@contoso.com' $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId RefObjectId = $User.ObjectId } Add-EntraAdministrativeUnitMember @params @@ -57,19 +57,19 @@ Add-EntraAdministrativeUnitMember @params This example shows how to add an administrative unit member. You can use the command `Get-EntraAdministrativeUnit` to get administrative unit ID. You can use the command `Get-EntraUser` to get user ID. -- `ObjectId` parameter specifies the ID of an administrative unit. +- `AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `RefObjectId` parameter specifies the ID of the user or group you want to add as a member of the administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of a Microsoft Entra ID administrative unit. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraApplicationOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraApplicationOwner.md index 2de3a2e77..626edce35 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraApplicationOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraApplicationOwner.md @@ -26,7 +26,7 @@ Adds an owner to an application. ```powershell Add-EntraApplicationOwner - -ObjectId + -ApplicationId -RefObjectId [] ``` @@ -42,25 +42,25 @@ The `Add-EntraApplicationOwner` cmdlet adds an owner to a Microsoft Entra ID app ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' $ApplicationId = (Get-EntraApplication -Top 1).ObjectId -$UserObjectId = (Get-EntraUser -ObjectId 'SawyerM@contoso.com').ObjectId -Add-EntraApplicationOwner -ObjectId $ApplicationId -RefObjectId $UserObjectId +$UserObjectId = (Get-EntraUser -UserId 'SawyerM@contoso.com').ObjectId +Add-EntraApplicationOwner -ApplicationId $ApplicationId -RefObjectId $UserObjectId ``` This example demonstrates how to add an owner to an application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of an application. +- `-ApplicationId` parameter specifies the ID of an application. - `-RefObjectId` parameter specifies the ID of a user. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredOwner.md index 39fcd1db9..d7560b579 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredOwner.md @@ -26,7 +26,7 @@ Adds a registered owner for a device. ```powershell Add-EntraDeviceRegisteredOwner - -ObjectId + -DeviceId -RefObjectId [] ``` @@ -41,10 +41,10 @@ The `Add-EntraDeviceRegisteredOwner` cmdlet adds a registered owner for a Micros ```powershell Connect-Entra -Scopes 'Device.ReadWrite.All' -$User = Get-EntraUser -ObjectId 'SawyerM@contoso.com' +$User = Get-EntraUser -UserId 'SawyerM@contoso.com' $Device = Get-EntraDevice -SearchString '' $params = @{ - ObjectId = $Device.ObjectId + DeviceId = $Device.ObjectId RefObjectId = $User.ObjectId } Add-EntraDeviceRegisteredOwner @params @@ -52,20 +52,20 @@ Add-EntraDeviceRegisteredOwner @params This example shows how to add a registered user to a device. -- `-ObjectId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered user. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraDevice` to get device Id. +- `-DeviceId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered user. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraDevice` to get device Id. - `-RefObjectId` parameter specifies the unique identifier (Object ID) of the user who will be added as a registered user of the device. The $User.ObjectId variable should contain the Object ID of the user. You can use the command `Get-EntraUser` to get user Id. ## Parameters -### -ObjectId +### -DeviceId Specifies the object ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredUser.md index 1d0398982..231fb03b1 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDeviceRegisteredUser.md @@ -27,7 +27,7 @@ Adds a registered user for a device. ```powershell Add-EntraDeviceRegisteredUser - -ObjectId + -DeviceId -RefObjectId [] ``` @@ -42,10 +42,10 @@ The `Add-EntraDeviceRegisteredUser` cmdlet adds a registered user for a Microsof ```powershell Connect-Entra -Scopes 'Device.ReadWrite.All' -$User = Get-EntraUser -ObjectId 'SawyerM@contoso.com' +$User = Get-EntraUser -UserId 'SawyerM@contoso.com' $Device = Get-EntraDevice -SearchString '' $params = @{ - ObjectId = $Device.ObjectId + DeviceId = $Device.ObjectId RefObjectId = $User.ObjectId } Add-EntraDeviceRegisteredUser @params @@ -53,20 +53,20 @@ Add-EntraDeviceRegisteredUser @params This example shows how to add a registered user to a device. -- `-ObjectId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered user. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraDevice` to get device Id. +- `-DeviceId` parameter specifies the unique identifier (Object ID) of the device to which you want to add a registered user. The $Device.ObjectId variable should contain the Object ID of the device. You can use the command `Get-EntraDevice` to get device Id. - `-RefObjectId` parameter specifies the unique identifier (Object ID) of the user who will be added as a registered user of the device. The $User.ObjectId variable should contain the Object ID of the user. You can use the command `Get-EntraUser` to get user Id. ## Parameters -### -ObjectId +### -DeviceId Specifies the ID of the device. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDirectoryRoleMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDirectoryRoleMember.md index aea54004f..6e540769a 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDirectoryRoleMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraDirectoryRoleMember.md @@ -26,7 +26,7 @@ Adds a member to a directory role. ```powershell Add-EntraDirectoryRoleMember - -ObjectId + -DirectoryRoleId -RefObjectId [] ``` @@ -42,7 +42,7 @@ The `Add-EntraDirectoryRoleMember` cmdlet adds a member to a Microsoft Entra ID ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $params = @{ - ObjectId = '019ea7a2-1613-47c9-81cb-20ba35b1ae48' + DirectoryRoleId = '019ea7a2-1613-47c9-81cb-20ba35b1ae48' RefObjectId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } Add-EntraDirectoryRoleMember @params @@ -50,19 +50,19 @@ Add-EntraDirectoryRoleMember @params This example adds a member to a directory role. -- `ObjectId` parameter specifies the ID of the directory role to which the member is added. Use the Get-EntraDirectoryRole command to retrieve the details of the directory role. +- `DirectoryRoleId` parameter specifies the ID of the directory role to which the member is added. Use the Get-EntraDirectoryRole command to retrieve the details of the directory role. - `RefObjectId` parameter specifies the ID of Microsoft Entra ID object to assign as owner/manager/member. ## Parameters -### -ObjectId +### -DirectoryRoleId Specifies the ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupMember.md index a32949ea9..257709330 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupMember.md @@ -26,7 +26,7 @@ Adds a member to a group. ```powershell Add-EntraGroupMember - -ObjectId + -GroupId -RefObjectId [] ``` @@ -42,7 +42,7 @@ The Add-EntraGroupMember cmdlet adds a member to a group. ```powershell Connect-Entra -Scopes 'GroupMember.ReadWrite.All' $params = @{ - ObjectId = 'dddddddd-2222-3333-5555-rrrrrrrrrrrr' + GroupId = 'dddddddd-2222-3333-5555-rrrrrrrrrrrr' RefObjectId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } @@ -53,14 +53,14 @@ This example demonstrates how to add a member to a group. ## Parameters -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupOwner.md index 36f30669f..39513fd99 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraGroupOwner.md @@ -26,16 +26,16 @@ Adds an owner to a group. ```powershell Add-EntraGroupOwner - -ObjectId + -GroupId -RefObjectId [] ``` ## Description -The `Add-EntraGroupOwner` cmdlet adds an owner to a Microsoft Entra ID group. Specify the `ObjectId` and `RefObjectId` parameters to add an owner to a group. +The `Add-EntraGroupOwner` cmdlet adds an owner to a Microsoft Entra ID group. Specify the `GroupId` and `RefObjectId` parameters to add an owner to a group. -`-ObjectId` - specifies the unique identifier (Object ID) of the group to which you want to add an owner. +`-GroupId` - specifies the unique identifier (Object ID) of the group to which you want to add an owner. `-RefObjectId` - specifies the unique identifier (Object ID) of the owner to be added to the group. @@ -46,9 +46,9 @@ The `Add-EntraGroupOwner` cmdlet adds an owner to a Microsoft Entra ID group. Sp ```powershell Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -$user = Get-EntraUser -ObjectId 'SawyerM@contoso.com' +$user = Get-EntraUser -UserId 'SawyerM@contoso.com' $params = @{ - ObjectId = $group.ObjectId + GroupId = $group.ObjectId RefObjectId = $user.ObjectId } @@ -59,14 +59,14 @@ This example demonstrates how to add an owner to a group. ## Parameters -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraLifecyclePolicyGroup.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraLifecyclePolicyGroup.md index cfc915234..e47865efb 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraLifecyclePolicyGroup.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraLifecyclePolicyGroup.md @@ -28,7 +28,7 @@ Adds a group to a lifecycle policy. ```powershell Add-EntraLifecyclePolicyGroup -GroupId - -Id + -GroupLifecyclePolicyId [] ``` @@ -45,7 +45,7 @@ Connect-Entra -Scopes 'Directory.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'Office365 group'" $policy = Get-EntraGroupLifecyclePolicy | Select-Object -First 1 $params = @{ - Id = $policy.Id + GroupLifecyclePolicyId = $policy.Id groupId = $group.ObjectId } Add-EntraLifecyclePolicyGroup @params @@ -53,7 +53,7 @@ Add-EntraLifecyclePolicyGroup @params This example adds a group to the lifecycle policy. -- `-Id` parameter specifies the ID of the Lifecycle Policy add to the group. +- `-GroupLifecyclePolicyId` parameter specifies the ID of the Lifecycle Policy add to the group. - `-GroupId` parameter specifies the ID of the group add to the Lifecycle Policy. ## Parameters @@ -74,14 +74,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupLifecyclePolicyId Specifies the ID of the lifecycle policy object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraScopedRoleMembership.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraScopedRoleMembership.md index bfb05607c..6366a197c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraScopedRoleMembership.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Add-EntraScopedRoleMembership.md @@ -25,7 +25,7 @@ Assign a Microsoft Entra role with an administrative unit scope. ```powershell Add-EntraScopedRoleMembership - -ObjectId + -AdministrativeUnitId [-RoleObjectId ] [-RoleMemberInfo ] [] @@ -33,7 +33,7 @@ Add-EntraScopedRoleMembership ## Description -The `Add-EntraScopedRoleMembership` cmdlet adds a scoped role membership to an administrative unit. Specify `ObjectId` parameter to add a scoped role membership. +The `Add-EntraScopedRoleMembership` cmdlet adds a scoped role membership to an administrative unit. Specify `AdministrativeUnitId` parameter to add a scoped role membership. For delegated scenarios, the calling user needs at least the Privileged Role Administrator Microsoft Entra role. @@ -49,7 +49,7 @@ $Unit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ' + -ServicePrincipalId -RefObjectId [] ``` @@ -43,7 +43,7 @@ Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy $ServicePrincipalId = (Get-EntraServicePrincipal -Top 1).ObjectId $OwnerId = (Get-EntraUser -Top 1).ObjectId $Params = @{ - ObjectId = $ServicePrincipalId + ServicePrincipalId = $ServicePrincipalId RefObjectId = $OwnerId } Add-EntraServicePrincipalOwner @Params @@ -51,19 +51,19 @@ Add-EntraServicePrincipalOwner @Params This example demonstrates how to add an owner to a service principal. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. - `-RefObjectId` parameter specifies the user object ID. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnit.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnit.md index 7c08304db..4ed6d3f3c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnit.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnit.md @@ -38,7 +38,7 @@ Get-EntraAdministrativeUnit ```powershell Get-EntraAdministrativeUnit - -ObjectId + -AdministrativeUnitId [-All] [-Property ] [] @@ -46,7 +46,7 @@ Get-EntraAdministrativeUnit ## Description -The `Get-EntraAdministrativeUnit` cmdlet gets a Microsoft Entra ID administrative unit. Specify `ObjectID` parameter to get a specific administrative unit. +The `Get-EntraAdministrativeUnit` cmdlet gets a Microsoft Entra ID administrative unit. Specify `AdministrativeUnitId` parameter to get a specific administrative unit. ## Examples @@ -92,7 +92,7 @@ This command gets all the administrative units. ```powershell Connect-Entra -Scopes 'AdministrativeUnit.Read.All' -Get-EntraAdministrativeUnit -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraAdministrativeUnit -AdministrativeUnitId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -103,7 +103,7 @@ DeletedDateTime Id Description Disp This example returns the details of the specified administrative unit. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ### Example 4: Get administrative units filter by display name @@ -170,14 +170,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnitMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnitMember.md index 2ebecd5c9..2c53b4d71 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnitMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAdministrativeUnitMember.md @@ -27,7 +27,7 @@ Gets a member of an administrative unit. ```powershell Get-EntraAdministrativeUnitMember - -ObjectId + -AdministrativeUnitId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraAdministrativeUnitMember ## Description -The `Get-EntraAdministrativeUnitMember` cmdlet gets a member of a Microsoft Entra ID administrative unit. Specify `ObjectId` parameters to retrieve an administrative unit member. +The `Get-EntraAdministrativeUnitMember` cmdlet gets a member of a Microsoft Entra ID administrative unit. Specify `AdministrativeUnitId` parameters to retrieve an administrative unit member. In delegated scenarios with work or school accounts, the signed-in user must either be a member user or be assigned a supported Microsoft Entra role, or a custom role with the necessary permissions. The following least privileged roles are supported for this operation: @@ -46,12 +46,12 @@ In delegated scenarios with work or school accounts, the signed-in user must eit ## Examples -### Example 1: Get an administrative unit member by ObjectId +### Example 1: Get an administrative unit member by AdministrativeUnitId ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" -Get-EntraAdministrativeUnitMember -ObjectId $AdministrativeUnit.ObjectId +Get-EntraAdministrativeUnitMember -AdministrativeUnitId $AdministrativeUnit.Id ``` ```Output @@ -64,16 +64,16 @@ eeeeeeee-4444-5555-6666-ffffffffffff ffffffff-5555-6666-7777-aaaaaaaaaaaa ``` -This example returns the list of administrative unit members from specified administrative unit ObjectId. +This example returns the list of administrative unit members from specified administrative unit AdministrativeUnitId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. -### Example 2: Get all administrative unit members by ObjectId +### Example 2: Get all administrative unit members by AdministrativeUnitId ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" -Get-EntraAdministrativeUnitMember -ObjectId $AdministrativeUnit.ObjectId -All +Get-EntraAdministrativeUnitMember -AdministrativeUnitId $AdministrativeUnit.Id -All ``` ```Output @@ -86,16 +86,16 @@ eeeeeeee-4444-5555-6666-ffffffffffff ffffffff-5555-6666-7777-aaaaaaaaaaaa ``` -This example returns the list of all administrative unit members from specified administrative unit ObjectId. +This example returns the list of all administrative unit members from specified administrative unit AdministrativeUnitId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. -### Example 3: Get top three administrative unit members by ObjectId +### Example 3: Get top three administrative unit members by AdministrativeUnitId ```powershell Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" -Get-EntraAdministrativeUnitMember -ObjectId $AdministrativeUnit.ObjectId -Top 3 +Get-EntraAdministrativeUnitMember -AdministrativeUnitId $AdministrativeUnit.Id -Top 3 ``` ```Output @@ -106,20 +106,20 @@ cccccccc-2222-3333-4444-dddddddddddd dddddddd-3333-4444-5555-eeeeeeeeeeee ``` -This example returns top three administrative unit members from specified administrative unit ObjectId. +This example returns top three administrative unit members from specified administrative unit AdministrativeUnitId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplication.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplication.md index a84a3d8e4..3c7cb40f7 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplication.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplication.md @@ -49,7 +49,7 @@ Get-EntraApplication ```powershell Get-EntraApplication - -ObjectId + -ApplicationId [-Property ] [-All] [] @@ -61,11 +61,11 @@ The `Get-EntraApplication` cmdlet gets a Microsoft Entra ID application. ## Examples -### Example 1: Get an application by ObjectId +### Example 1: Get an application by ApplicationId ```powershell Connect-Entra -Scopes 'Application.Read.All' -Get-EntraApplication -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraApplication -ApplicationId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -193,14 +193,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationExtensionProperty.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationExtensionProperty.md index 5af944c7c..63bce77e9 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationExtensionProperty.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationExtensionProperty.md @@ -26,7 +26,7 @@ Gets application extension properties. ```powershell Get-EntraApplicationExtensionProperty - -ObjectId + -ApplicationId [-Property ] [] ``` @@ -42,7 +42,7 @@ The `Get-EntraApplicationExtensionProperty` cmdlet gets application extension pr ```powershell Connect-Entra -Scopes 'Application.Read.All' $Application = Get-EntraApplication -SearchString '' -Get-EntraApplicationExtensionProperty -ObjectId $Application.ObjectId +Get-EntraApplicationExtensionProperty -ApplicationId $Application.Id ``` ```Output @@ -53,18 +53,18 @@ DeletedDateTime Id AppDisplayName DataType IsM This command gets the extension properties for the specified application in Microsoft Entra ID. You cane use the command `Get-EntraApplication` to get application Id. -- `-ObjectId` parameter specifies the the unique identifier of a application. +- `-ApplicationId` parameter specifies the the unique identifier of a application. ## Parameters -### -ObjectId +### -ApplicationId Specifies the unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationLogo.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationLogo.md index e8f599244..741be683c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationLogo.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationLogo.md @@ -27,7 +27,7 @@ Retrieve the logo of an application. ```powershell Get-EntraApplicationLogo - -ObjectId + -ApplicationId [-FileName ] [-View ] [-FilePath ] @@ -36,7 +36,7 @@ Get-EntraApplicationLogo ## Description -The `Get-EntraApplicationLogo` cmdlet retrieves the logo that is set for an application. Specify the `ObjectId` parameter to get a specific application logo for an application. +The `Get-EntraApplicationLogo` cmdlet retrieves the logo that is set for an application. Specify the `ApplicationId` parameter to get a specific application logo for an application. ## Examples @@ -44,7 +44,7 @@ The `Get-EntraApplicationLogo` cmdlet retrieves the logo that is set for an appl ```powershell Connect-Entra -Scopes 'Application.Read.All' -Get-EntraApplicationLogo -ObjectId 'bbbbbbbb-1111-1111-1111-cccccccccccc' -FilePath 'D:\outfile1.jpg' +Get-EntraApplicationLogo -ApplicationId 'bbbbbbbb-1111-1111-1111-cccccccccccc' -FilePath 'D:\outfile1.jpg' ``` This example shows how to retrieve the application logo for an application that is specified through the Object ID parameter. @@ -83,14 +83,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId -The ObjectID of the application for which the logo is to be retrieved. +The ApplicationId of the application for which the logo is to be retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationOwner.md index 17c4b4743..4b79b9de8 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationOwner.md @@ -27,7 +27,7 @@ Gets the owner of an application. ```powershell Get-EntraApplicationOwner - -ObjectId + -ApplicationId [-All] [-Top ] [-Property ] @@ -45,7 +45,7 @@ The `Get-EntraApplicationOwner` cmdlet get an owner of an Microsoft Entra ID app ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraApplication -SearchString '' -Get-EntraApplicationOwner -ObjectId $Application.ObjectId +Get-EntraApplicationOwner -ApplicationId $Application.ObjectId ``` ```Output @@ -59,7 +59,7 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example demonstrates how to get the owners of an application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. ### Example 2: Get the details about the owner of an application @@ -94,7 +94,7 @@ This example demonstrates how to get the owners of an application in Microsoft E ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraApplication -SearchString '' -Get-EntraApplicationOwner -ObjectId $Application.ObjectId -All +Get-EntraApplicationOwner -ApplicationId $Application.ObjectId -All ``` ```Output @@ -108,14 +108,14 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example demonstrates how to get the all owners of a specified application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. ### Example 4: Get top two owners of an application ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraApplication -SearchString '' -Get-EntraApplicationOwner -ObjectId $Application.ObjectId -Top 2 +Get-EntraApplicationOwner -ApplicationId $Application.ObjectId -Top 2 ``` ```Output @@ -127,7 +127,7 @@ cccccccc-2222-3333-4444-dddddddddddd This example demonstrates how to get the two owners of a specified application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. ## Parameters @@ -147,14 +147,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationPasswordCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationPasswordCredential.md index 7db5647d7..f14f78835 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationPasswordCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationPasswordCredential.md @@ -26,14 +26,14 @@ Gets the password credential for an application. ```powershell Get-EntraApplicationPasswordCredential - -ObjectId + -ApplicationId [-Property ] [] ``` ## Description -The `Get-EntraApplicationPasswordCredential` cmdlet receives the password credentials for a Microsoft Entra ID application. Specify `ObjectId` parameter to cmdlet receives the password credentials. +The `Get-EntraApplicationPasswordCredential` cmdlet receives the password credentials for a Microsoft Entra ID application. Specify `ApplicationId` parameter to cmdlet receives the password credentials. ## Examples @@ -42,7 +42,7 @@ The `Get-EntraApplicationPasswordCredential` cmdlet receives the password creden ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraApplicationPasswordCredential -ObjectId $application.ObjectId +Get-EntraApplicationPasswordCredential -ApplicationId $application.ObjectId ``` ```Output @@ -53,18 +53,18 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This example shows how to retrieve the password credential for specified application. -- `-ObjectId` specifies the ID of an application object in Microsoft Entra ID. +- `-ApplicationId` specifies the ID of an application object in Microsoft Entra ID. ## Parameters -### -ObjectId +### -ApplicationId -The objectID of the application for which to get the password credential. Use `Get-EntraApplication` for more details. +The ApplicationId of the application for which to get the password credential. Use `Get-EntraApplication` for more details. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationServiceEndpoint.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationServiceEndpoint.md index 6bc41ecf5..69df671ca 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationServiceEndpoint.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraApplicationServiceEndpoint.md @@ -26,7 +26,7 @@ Retrieve the service endpoint of an application. ```powershell Get-EntraApplicationServiceEndpoint - -ObjectId + -ApplicationId [-All] [-Top ] [-Property ] @@ -48,36 +48,36 @@ Other services can use the information stored in the ServiceEndpoint entity to f ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraApplicationServiceEndpoint -ObjectId $application.ObjectId +Get-EntraApplicationServiceEndpoint -ApplicationId $application.ObjectId ``` This example demonstrates how to retrieve service endpoint of the application that is specified through the Object ID parameter. -`-ObjectId` parameter specifies the ID of an application object in Microsoft Entra ID. +`-ApplicationId` parameter specifies the ID of an application object in Microsoft Entra ID. ### Example 2: Get all service endpoints ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraApplicationServiceEndpoint -ObjectId $application.ObjectId -All +Get-EntraApplicationServiceEndpoint -ApplicationId $application.ObjectId -All ``` This example demonstrates how to retrieve all service endpoints of a specified application. -`-ObjectId` parameter specifies the ID of an application object in Microsoft Entra ID. +`-ApplicationId` parameter specifies the ID of an application object in Microsoft Entra ID. ### Example 3: Get top five service endpoints ```powershell Connect-Entra -Scopes 'Application.Read.All' $application = Get-EntraApplication -Filter "DisplayName eq 'Contoso Helpdesk Application'" -Get-EntraApplicationServiceEndpoint -ObjectId $application.ObjectId -Top 5 +Get-EntraApplicationServiceEndpoint -ApplicationId $application.ObjectId -Top 5 ``` This example demonstrates how to retrieve five service endpoints of a specified application. -`-ObjectId` parameter specifies the ID of an application object in Microsoft Entra ID. +`-ApplicationId` parameter specifies the ID of an application object in Microsoft Entra ID. ## Parameters @@ -97,14 +97,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the object ID of the application for which the service endpoint is retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAttributeSet.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAttributeSet.md index 77b9fa05d..268a74a1c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAttributeSet.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAttributeSet.md @@ -34,7 +34,7 @@ Get-EntraAttributeSet ```powershell Get-EntraAttributeSet - -Id + -AttributeSetId [] ``` @@ -73,7 +73,7 @@ This example returns all attribute sets. ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' -Get-EntraAttributeSet -Id 'Testing' +Get-EntraAttributeSet -AttributeSetId 'Testing' ``` ```Output @@ -84,11 +84,11 @@ Testing Attributes for engineering team 10 This example demonstrates how to retrieve an attribute set by Id. -- `Id` parameter specifies the unique identifier for the attribute set within a tenant. +- `AttributeSetId` parameter specifies the unique identifier for the attribute set within a tenant. ## Parameters -### -Id +### -AttributeSetId Unique identifier for the attribute set within a tenant. @@ -97,7 +97,7 @@ This identifier can be up to 32 characters long and may include Unicode characte ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md index 409b8604e..910a7e820 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md @@ -26,6 +26,7 @@ Get audit logs of sign-ins. ```powershell Get-EntraAuditSignInLog + [-SignInId] [-All] [-Top ] [-Filter ] @@ -116,6 +117,22 @@ This example demonstrates how to retrieve failed sign-ins for a user. ## Parameters +### -SignInId + +Specifies unique ID of the Audit Log. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: Id + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -All List all pages. diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContact.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContact.md index 747db4b4c..fb0bcb0cb 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContact.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContact.md @@ -39,7 +39,7 @@ Get-EntraContact ```powershell Get-EntraContact - -ObjectId + -OrgContactId [-All] [-Property ] [] @@ -73,7 +73,7 @@ This example retrieves all contact objects in the directory. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' -Get-EntraContact -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraContact -OrgContactId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -84,7 +84,7 @@ Contoso Contact aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb contact@contoso.com This example retrieves specified contact in the directory. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ### Example 3: Retrieve all contacts objects in the directory @@ -173,14 +173,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactDirectReport.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactDirectReport.md index 8156c820a..5ba96a392 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactDirectReport.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactDirectReport.md @@ -27,7 +27,7 @@ Get the direct reports for a contact. ```powershell Get-EntraContactDirectReport - -ObjectId + -OrgContactId [-All] [-Top ] [-Property ] @@ -45,38 +45,38 @@ The `Get-EntraContactDirectReport` cmdlet gets the direct reports for a contact. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Top 1 -Get-EntraContactDirectReport -ObjectId $Contact.ObjectId +Get-EntraContactDirectReport -OrgContactId $Contact.ObjectId ``` This example shows how to retrieve direct reports for an organizational contact. You can use the command `Get-EntraBetaContact` to get organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ### Example 2: Get all direct reports of a contact ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Top 1 -Get-EntraContactDirectReport -ObjectId $Contact.ObjectId -All +Get-EntraContactDirectReport -OrgContactId $Contact.ObjectId -All ``` This example shows how to retrieve all direct reports for an organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ### Example 3: Get top two direct reports of a contact ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraBetaContact -Top 1 -Get-EntraContactDirectReport -ObjectId $Contact.ObjectId -Top 2 +Get-EntraContactDirectReport -OrgContactId $Contact.ObjectId -Top 2 ``` This example shows how to retrieve top two direct reports for an organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ## Parameters @@ -96,14 +96,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactManager.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactManager.md index 8e07f9393..9aba15604 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactManager.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactManager.md @@ -26,7 +26,7 @@ Gets the manager of a contact. ```powershell Get-EntraContactManager - -ObjectId + -OrgContactId [-Property ] [] ``` @@ -42,23 +42,23 @@ The `Get-EntraContactManager` cmdlet gets the manager of a contact in Microsoft ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraContact -Top 1 -Get-EntraContactManager -ObjectId $Contact.ObjectId +Get-EntraContactManager -OrgContactId $Contact.ObjectId ``` The example demonstrates how to retrieve the manager of a contact. You can use the command `Get-EntraContact` to get organizational contact. -- `-ObjectId` parameter specifies the contact Id. +- `-OrgContactId` parameter specifies the contact Id. ## Parameters -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: OrgContactId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactMembership.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactMembership.md index eba9f4740..e09631eec 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactMembership.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContactMembership.md @@ -26,7 +26,7 @@ Get a contact membership. ```powershell Get-EntraContactMembership - -ObjectId + -OrgContactId [-All] [-Top ] [-Property ] @@ -46,7 +46,7 @@ This command is useful to administrators who need to understand which groups, ro ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'" -Get-EntraContactMembership -ObjectId $Contact.ObjectId +Get-EntraContactMembership -OrgContactId $Contact.ObjectId ``` ```Output @@ -64,7 +64,7 @@ This command gets all the memberships for specified contact. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'" -Get-EntraContactMembership -ObjectId $Contact.ObjectId -All +Get-EntraContactMembership -OrgContactId $Contact.ObjectId -All ``` ```Output @@ -82,7 +82,7 @@ This command gets all the memberships for specified contact. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'" -Get-EntraContactMembership -ObjectId $Contact.ObjectId -Top 2 +Get-EntraContactMembership -OrgContactId $Contact.ObjectId -Top 2 ``` ```Output @@ -112,14 +112,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -OrgContactId Specifies the ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContract.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContract.md index d308eb8c4..c65dae7c2 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContract.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraContract.md @@ -39,7 +39,7 @@ Get-EntraContract ```powershell Get-EntraContract - -ObjectId + -ContractId [-All] [-Property ] [] @@ -77,7 +77,7 @@ It isn't automatically updated if the customer tenant's display name changes. - `objectType` - a string that identifies the object type. The value is always `Contract`. -- `ObjectId` - the unique identifier for the partnership. +- `ContractId` - the unique identifier for the partnership. ## Examples @@ -134,14 +134,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ContractId Specifies the ID of a contract. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedDirectoryObject.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedDirectoryObject.md index 9ca990791..099bb9947 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedDirectoryObject.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedDirectoryObject.md @@ -26,7 +26,7 @@ Retrieves a soft deleted directory object from the directory. ```powershell Get-EntraDeletedDirectoryObject - -Id + -DirectoryObjectId [-Property ] [] ``` @@ -43,7 +43,7 @@ Office 365 Groups). ```powershell Connect-Entra -Scopes 'AdministrativeUnit.Read.All', 'Application.Read.All','Group.Read.All','User.Read.All' -Get-EntraDeletedDirectoryObject -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraDeletedDirectoryObject -DirectoryObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -54,7 +54,7 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 2/2/2024 5:33:56 AM This example shows how to retrieve the deleted directory object from the directory. -- `-Id` parameter specifies the Id of the directory object to retrieve. +- `-DirectoryObjectId` parameter specifies the Id of the directory object to retrieve. ### Example 2: Retrieve a deleted directory object with more details. @@ -75,14 +75,14 @@ This example shows how to retrieve the deleted directory object details from the ## Parameters -### -Id +### -DirectoryObjectId The Id of the directory object to retrieve. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedGroup.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedGroup.md index e9e008fae..f85a85737 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedGroup.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedGroup.md @@ -49,7 +49,7 @@ Get-EntraDeletedGroup ```powershell Get-EntraDeletedGroup - -Id + -GroupId [-All] [-Property ] [] @@ -158,11 +158,11 @@ test21 aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb test21 desc1 {Unifi This cmdlet retrieves deleted groups in the directory, having the specified display name. -### Example 6: Get deleted group by Id +### Example 6: Get deleted group by GroupId ```powershell Connect-Entra -Scopes 'Group.Read.All' -Get-EntraDeletedGroup -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraDeletedGroup -GroupId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -171,9 +171,9 @@ DisplayName Id MailNickname Description GroupT test21 aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb test21 desc1 {Unified, DynamicMembership} ``` -This cmdlet retrieves the deleted group specified by Id. +This cmdlet retrieves the deleted group specified by GroupId. -- `-Id` parameter specifies the deleted group ID. +- `-GroupId` parameter specifies the deleted group GroupId. ## Parameters @@ -210,14 +210,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -Id +### -GroupId -The Id of the deleted group to be retrieved. +The GroupId of the deleted group to be retrieved. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDevice.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDevice.md index 0a829474b..5b08479e7 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDevice.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDevice.md @@ -49,7 +49,7 @@ Get-EntraDevice ```powershell Get-EntraDevice - -ObjectId + -DeviceId [-All] [-Property ] [] @@ -57,7 +57,7 @@ Get-EntraDevice ## Description -The `Get-EntraDevice` cmdlet gets a device from Microsoft Entra ID. Specify the `ObjectId` parameter to get a specific device. +The `Get-EntraDevice` cmdlet gets a device from Microsoft Entra ID. Specify the `DeviceId` parameter to get a specific device. ## Examples @@ -65,7 +65,7 @@ The `Get-EntraDevice` cmdlet gets a device from Microsoft Entra ID. Specify the ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraDevice -ObjectId 'bbbbbbbb-1111-2222-3333-cccccccccccc' +Get-EntraDevice -DeviceId 'bbbbbbbb-1111-2222-3333-cccccccccccc' ``` ```Output @@ -188,14 +188,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -DeviceId Specifies the ID of a device in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredOwner.md index 3b541878f..1149f5438 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredOwner.md @@ -27,7 +27,7 @@ Gets the registered owner of a device. ```powershell Get-EntraDeviceRegisteredOwner - -ObjectId + -DeviceId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraDeviceRegisteredOwner ## Description -The `Get-EntraDeviceRegisteredOwner` cmdlet gets the registered owner of a device in Microsoft Entra ID. Specify `ObjectId` parameter gets the registered owner of a device. +The `Get-EntraDeviceRegisteredOwner` cmdlet gets the registered owner of a device in Microsoft Entra ID. Specify `DeviceId` parameter gets the registered owner of a device. ## Examples @@ -45,7 +45,7 @@ The `Get-EntraDeviceRegisteredOwner` cmdlet gets the registered owner of a devic ```powershell Connect-Entra -Scopes 'Device.Read.All' $DevId = (Get-EntraDevice -Top 1).ObjectId -Get-EntraDeviceRegisteredOwner -ObjectId $DevId +Get-EntraDeviceRegisteredOwner -DeviceId $DevId ``` ```Output @@ -56,13 +56,13 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb This example shows how to find the registered owner of a device.. -- `-ObjectId` parameter specifies the device's ID. +- `-DeviceId` parameter specifies the device's ID. ### Example 2: Retrieve the registered owner of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraDeviceRegisteredOwner -ObjectId 'bbbbbbbb-1111-2222-3333-cccccccccccc' +Get-EntraDeviceRegisteredOwner -DeviceId 'bbbbbbbb-1111-2222-3333-cccccccccccc' ``` ```Output @@ -74,13 +74,13 @@ cccccccc-2222-3333-4444-dddddddddddd This command gets the registered owner of a device. -- `-ObjectId` parameter specifies the device's ID +- `-DeviceId` parameter specifies the device's ID ### Example 3: Retrieve all the registered owners of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraDeviceRegisteredOwner -ObjectId 'bbbbbbbb-1111-2222-3333-cccccccccccc' -All +Get-EntraDeviceRegisteredOwner -DeviceId 'bbbbbbbb-1111-2222-3333-cccccccccccc' -All ``` ```Output @@ -92,13 +92,13 @@ cccccccc-2222-3333-4444-dddddddddddd This command retrieves all the registered owners of a device. -- `-ObjectId` parameter specifies the device's ID. +- `-DeviceId` parameter specifies the device's ID. ### Example 4: Retrieve top one registered owner of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraDeviceRegisteredOwner -ObjectId 'bbbbbbbb-1111-2222-3333-cccccccccccc' -Top 1 +Get-EntraDeviceRegisteredOwner -DeviceId 'bbbbbbbb-1111-2222-3333-cccccccccccc' -Top 1 ``` ```Output @@ -109,7 +109,7 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb This command retrieves all the registered owners of a device. -- `-ObjectId` parameter specifies the device's ID. +- `-DeviceId` parameter specifies the device's ID. ## Parameters @@ -129,14 +129,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -DeviceId Specifies the ID of an object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredUser.md index 4b3fa8945..810e5ec60 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeviceRegisteredUser.md @@ -27,7 +27,7 @@ Retrieve a list of users that are registered users of the device. ```powershell Get-EntraDeviceRegisteredUser - -ObjectId + -DeviceId [-All ] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraDeviceRegisteredUser ## Description -The `Get-EntraDeviceRegisteredUser` cmdlet gets a registered user for a Microsoft Entra ID device. Specify `ObjectId` parameter to get a registered user for a Microsoft Entra ID device. +The `Get-EntraDeviceRegisteredUser` cmdlet gets a registered user for a Microsoft Entra ID device. Specify `DeviceId` parameter to get a registered user for a Microsoft Entra ID device. ## Examples @@ -45,7 +45,7 @@ The `Get-EntraDeviceRegisteredUser` cmdlet gets a registered user for a Microsof ```powershell Connect-Entra -Scopes 'Device.Read.All' $DevId = (Get-EntraDevice -Top 1).ObjectId -Get-EntraDeviceRegisteredUser -ObjectId $DevId +Get-EntraDeviceRegisteredUser -DeviceId $DevId ``` ```Output @@ -63,7 +63,7 @@ This example demonstrates how to retrieve registered user for a specific Microso ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraDeviceRegisteredUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -All +Get-EntraDeviceRegisteredUser -DeviceId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -All ``` ```Output @@ -77,13 +77,13 @@ ffffffff-4444-5555-6666-gggggggggggg This example demonstrates how to retrieve all registered users for a specified device. -- `-ObjectId` parameter specifies an object ID of a device, which you want to retrieve. +- `-DeviceId` parameter specifies an object ID of a device, which you want to retrieve. ### Example 3: Get top two registered users of a device ```powershell Connect-Entra -Scopes 'Device.Read.All' -Get-EntraDeviceRegisteredUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Top 2 +Get-EntraDeviceRegisteredUser -DeviceId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Top 2 ``` ```Output @@ -95,7 +95,7 @@ cccccccc-2222-3333-4444-dddddddddddd This example demonstrates how to retrieve top two registered users for the specified device. -- `-ObjectId` parameter specifies an object ID of a device, which you want to retrieve. +- `-DeviceId` parameter specifies an object ID of a device, which you want to retrieve. ## Parameters @@ -115,14 +115,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -DeviceId Specifies an object ID of a device. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRole.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRole.md index e068e1e00..aac3e91b9 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRole.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRole.md @@ -37,7 +37,7 @@ Get-EntraDirectoryRole ```powershell Get-EntraDirectoryRole - -ObjectId + -DirectoryRoleId [-Property ] [] ``` @@ -52,7 +52,7 @@ The `Get-EntraDirectoryRole` cmdlet gets a directory role from Microsoft Entra I ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory' -Get-EntraDirectoryRole -ObjectId '019ea7a2-1613-47c9-81cb-20ba35b1ae48' +Get-EntraDirectoryRole -DirectoryRoleId '019ea7a2-1613-47c9-81cb-20ba35b1ae48' ``` ```Output @@ -134,14 +134,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -DirectoryRoleId Specifies the ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleAssignment.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleAssignment.md index 94fbb08da..7c86ba6f9 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleAssignment.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleAssignment.md @@ -48,7 +48,7 @@ Get-EntraDirectoryRoleAssignment ```powershell Get-EntraDirectoryRoleAssignment - -Id + -UnifiedRoleAssignmentId [-All] [-Property ] [] @@ -56,7 +56,7 @@ Get-EntraDirectoryRoleAssignment ## Description -The `Get-EntraDirectoryRoleAssignment` cmdlet gets information about role assignments in Microsoft Entra ID. To get a role assignment, specify the `Id` parameter. Specify the `SearchString` or `Filter` parameter to find a particular role assignment. +The `Get-EntraDirectoryRoleAssignment` cmdlet gets information about role assignments in Microsoft Entra ID. To get a role assignment, specify the `UnifiedRoleAssignmentId` parameter. Specify the `SearchString` or `Filter` parameter to find a particular role assignment. In delegated scenarios with work or school accounts, the signed-in user must have a supported Microsoft Entra role or a custom role with one of the following permissions: @@ -114,7 +114,7 @@ This command gets all the role assignments in Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory','EntitlementManagement.Read.All' -Get-EntraDirectoryRoleAssignment -Id '00001111-aaaa-2222-bbbb-3333cccc4444' +Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId '00001111-aaaa-2222-bbbb-3333cccc4444' ``` ```Output @@ -125,7 +125,7 @@ Id PrincipalId Ro This command gets the role assignments using specified roleAssignment Id. -- `Id` parameter specifies the roleAssignment object ID. +- `UnifiedRoleAssignmentId` parameter specifies the roleAssignment object ID. ### Example 4: Get role assignments filter by principalId @@ -180,14 +180,14 @@ This command gets top two role assignments. ## Parameters -### -Id +### -UnifiedRoleAssignmentId The unique identifier of a Microsoft Entra ID roleAssignment object. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleDefinition.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleDefinition.md index 4f207c541..7fcd4cd5a 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleDefinition.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleDefinition.md @@ -49,7 +49,7 @@ Get-EntraDirectoryRoleDefinition ```powershell Get-EntraDirectoryRoleDefinition - -Id + -UnifiedRoleDefinitionId [-All] [-Property ] [] @@ -57,7 +57,7 @@ Get-EntraDirectoryRoleDefinition ## Description -The `Get-EntraDirectoryRoleDefinition` cmdlet gets information about role definitions in Microsoft Entra ID. To get a role definition, specify the `Id` parameter. Specify the `SearchString` or `Filter` parameter to find particular role definition. +The `Get-EntraDirectoryRoleDefinition` cmdlet gets information about role definitions in Microsoft Entra ID. To get a role definition, specify the `UnifiedRoleDefinitionId` parameter. Specify the `SearchString` or `Filter` parameter to find particular role definition. In delegated scenarios with work or school accounts, the signed-in user must have a supported Microsoft Entra role or a custom role with one of the following permissions: @@ -89,11 +89,11 @@ Restricted Guest User 2af84b1e-32c8-42b7-82bc-daa8240402 This command returns all the role definitions present. -### Example 2: Get a role definition by ID +### Example 2: Get a role definition by UnifiedRoleDefinitionId ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory','EntitlementManagement.Read.All' -Get-EntraDirectoryRoleDefinition -Id '1a327991-10cb-4266-877a-998fb4df78ec' +Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId '1a327991-10cb-4266-877a-998fb4df78ec' ``` ```Output @@ -104,7 +104,7 @@ Restricted Guest User 2af84b1e-32c8-42b7-82bc-daa8240402 This command returns a specified role definition. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. ### Example 3: Filter role definitions by display name @@ -134,7 +134,7 @@ DisplayName Id TemplateId Restricted Guest User 00aa00aa-bb11-cc22-dd33-44ee44ee44ee 2af84b1e-32c8-42b7-82bc-daa82404023b Restricted role for guest users. Can read a limited set of directory information. True True ``` -This command return top two the role definitions in Microsoft Entra ID. +This command return top two the role definitions in Microsoft Entra DirectoryRoleId. ### Example 5: Filter role definitions by display name @@ -154,14 +154,14 @@ This command return all the role definitions containing the specified display na ## Parameters -### -Id +### -UnifiedRoleDefinitionId -Specifies the ID of the role definition. +Specifies the UnifiedRoleDefinitionId of the role definition. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleMember.md index eb44519bb..3238d3cb0 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDirectoryRoleMember.md @@ -27,14 +27,14 @@ Gets members of a directory role. ```powershell Get-EntraDirectoryRoleMember - -ObjectId + -DirectoryRoleId [-Property ] [] ``` ## Description -The `Get-EntraDirectoryRoleMember` cmdlet retrieves the members of a directory role in Microsoft Entra ID. To obtain the members of a specific directory role, specify the `ObjectId`. Use the `Get-EntraDirectoryRole` cmdlet to get the `ObjectId` value. +The `Get-EntraDirectoryRoleMember` cmdlet retrieves the members of a directory role in Microsoft Entra ID. To obtain the members of a specific directory role, specify the `DirectoryRoleId`. Use the `Get-EntraDirectoryRole` cmdlet to get the `DirectoryRoleId` value. ## Examples @@ -42,7 +42,7 @@ The `Get-EntraDirectoryRoleMember` cmdlet retrieves the members of a directory r ```powershell Connect-Entra -Scopes 'RoleManagement.Read.Directory' -Get-EntraDirectoryRoleMember -ObjectId '1d73e796-aac5-4b3a-b7e7-74a3d1926a85' +Get-EntraDirectoryRoleMember -DirectoryRoleId '1d73e796-aac5-4b3a-b7e7-74a3d1926a85' ``` ```Output @@ -53,18 +53,18 @@ bbbbbbbb-7777-8888-9999-cccccccccccc This example retrieves the members of the specified role. -- `-ObjectId` parameter specifies directory role ID. +- `-DirectoryRoleId` parameter specifies directory role ID. ## Parameters -### -ObjectId +### -DirectoryRoleId Specifies the ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroup.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroup.md index 23882b928..62d509e6c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroup.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroup.md @@ -49,7 +49,7 @@ Get-EntraGroup ```powershell Get-EntraGroup - -ObjectId + -GroupId [-All] [-Property ] [] @@ -80,11 +80,11 @@ SimpleGroup eeeeeeee-4444-5555-6666-ffffff This example demonstrates how to get all groups from Microsoft Entra ID. -### Example 2: Get a specific group by using an ObjectId +### Example 2: Get a specific group by using an GroupId ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroup -ObjectId 'pppppppp-4444-0000-8888-yyyyyyyyyyyy' +Get-EntraGroup -GroupId 'pppppppp-4444-0000-8888-yyyyyyyyyyyy' ``` ```Output @@ -226,14 +226,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -GroupId -The unique identifier of a group in Microsoft Entra ID. (ObjectId). +The unique identifier of a group in Microsoft Entra ID (GroupId) ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupAppRoleAssignment.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupAppRoleAssignment.md index 98e011c4b..724b696ce 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupAppRoleAssignment.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupAppRoleAssignment.md @@ -26,7 +26,7 @@ Gets a group application role assignment. ```powershell Get-EntraGroupAppRoleAssignment - -ObjectId + -GroupId [-All] [-Top ] [-Property ] @@ -35,7 +35,7 @@ Get-EntraGroupAppRoleAssignment ## Description -The `Get-EntraGroupAppRoleAssignment` cmdlet gets a group application role assignment in Microsoft Entra ID. Specify the `ObjectId` parameter to get a group application role assignment. +The `Get-EntraGroupAppRoleAssignment` cmdlet gets a group application role assignment in Microsoft Entra ID. Specify the `GroupId` parameter to get a group application role assignment. ## Examples @@ -44,7 +44,7 @@ The `Get-EntraGroupAppRoleAssignment` cmdlet gets a group application role assig ```powershell Connect-Entra -Scopes 'Directory.Read.All' $GroupId = (Get-EntraGroup -Top 1).ObjectId -Get-EntraGroupAppRoleAssignment -ObjectId $GroupId +Get-EntraGroupAppRoleAssignment -GroupId $GroupId ``` ```Output @@ -57,13 +57,13 @@ MSVrBV4APk--eAGnHqMKBDtEqPRvu8xLqWHDSXUhoTE M365 License Manager This example retrieves the application role assignments of a group. -- `-ObjectId` parameter specifies the ID of a group in Microsoft Entra ID. +- `-GroupId` parameter specifies the ID of a group in Microsoft Entra ID. ### Example 2: Retrieve all application role assignments of a group ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraGroupAppRoleAssignment -ObjectId 'ffffffffff-7777-9999-7777-vvvvvvvvvvv' -All +Get-EntraGroupAppRoleAssignment -GroupId 'ffffffffff-7777-9999-7777-vvvvvvvvvvv' -All ``` ```Output @@ -76,13 +76,13 @@ MSVrBV4APk--eAGnHqMKBDtEqPRvu8xLqWHDSXUhoTE M365 License Manager This example retrieves all application role assignments of the specified group. -- `-ObjectId` parameter specifies the ID of a group in Microsoft Entra ID. +- `-GroupId` parameter specifies the ID of a group in Microsoft Entra ID. ### Example 3: Retrieve top two application role assignments of a group ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraGroupAppRoleAssignment -ObjectId 'ffffffffff-7777-9999-7777-vvvvvvvvvvv' -Top 2 +Get-EntraGroupAppRoleAssignment -GroupId 'ffffffffff-7777-9999-7777-vvvvvvvvvvv' -Top 2 ``` ```Output @@ -94,7 +94,7 @@ MSVrBV4APk--eAGnHqMKBExhQK4StEFHidLvUymzo4I ProvisioningPowerBi This example retrieves top two application role assignments of the specified group. -- `-ObjectId` parameter specifies the ID of a group in Microsoft Entra ID. +- `-GroupId` parameter specifies the ID of a group in Microsoft Entra ID. ## Parameters @@ -114,15 +114,15 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: - +Aliases: ObjectId + Required: True Position: Named Default value: None diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupLifecyclePolicy.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupLifecyclePolicy.md index d895d907a..9df4ac2bb 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupLifecyclePolicy.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupLifecyclePolicy.md @@ -37,14 +37,14 @@ Get-EntraGroupLifecyclePolicy ```powershell Get-EntraGroupLifecyclePolicy - -Id + -GroupLifecyclePolicyId [-Property ] [] ``` ## Description -The `Get-EntraGroupLifecyclePolicy` command retrieves the properties and relationships of a groupLifecyclePolicies object in Microsoft Entra ID. Specify the `-Id` parameter to get the group lifecycle policy. +The `Get-EntraGroupLifecyclePolicy` command retrieves the properties and relationships of a groupLifecyclePolicies object in Microsoft Entra ID. Specify the `-GroupLifecyclePolicyId` parameter to get the group lifecycle policy. If you specify no parameters, this cmdlet gets all groupLifecyclePolicies. ## Examples @@ -68,7 +68,7 @@ This example demonstrates how to retrieve the properties and relationships of al ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraGroupLifecyclePolicy -Id '1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5' +Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId '1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5' ``` ```Output @@ -79,18 +79,18 @@ ffffffff-5555-6666-7777-aaaaaaaaaaaa example@contoso.com 200 This command is used to retrieve a specific Microsoft Group Lifecycle Policy. -- `-Id` parameter specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. +- `-GroupLifecyclePolicyId` parameter specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. ## Parameters -### -Id +### -GroupLifecyclePolicyId Specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupMember.md index 0f81deabe..bdd0673a0 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupMember.md @@ -25,7 +25,7 @@ Gets a member of a group. ```powershell Get-EntraGroupMember - -ObjectId + -GroupId [-All] [-Top ] [-Property ] @@ -34,7 +34,7 @@ Get-EntraGroupMember ## Description -The `Get-EntraGroupMember` cmdlet gets a member of a group in Microsoft Entra ID. Specify the `ObjectId` parameter to get a member of a group. +The `Get-EntraGroupMember` cmdlet gets a member of a group in Microsoft Entra ID. Specify the `GroupId` parameter to get a member of a group. In delegated scenarios, the signed-in user must have a supported Microsoft Entra role or a custom role with one of the following permissions: `microsoft.directory/groups/members/read`, `microsoft.directory/groups/members/limitedRead`, or `microsoft.directory/groups/hiddenMembers/read` (for hidden members). The following least privileged roles support this operation: @@ -59,7 +59,7 @@ To list members of a hidden group, the `Member.Read.Hidden` permission is also r ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupMember -ObjectId 'bbbbbbbb-1111-2222-3333-cccccccccccc' +Get-EntraGroupMember -GroupId 'bbbbbbbb-1111-2222-3333-cccccccccccc' ``` ```Output @@ -70,13 +70,13 @@ bbbbbbbb-7777-8888-9999-cccccccccccc This example demonstrates how to retrieve group member by ID. -- `-ObjectId` Specifies the ID of a group. +- `-GroupId` Specifies the ID of a group. ### Example 2: Get two group member ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupMember -ObjectId 'hhhhhhhh-8888-9999-8888-cccccccccccc' -Top 2 +Get-EntraGroupMember -GroupId 'hhhhhhhh-8888-9999-8888-cccccccccccc' -Top 2 ``` ```Output @@ -88,13 +88,13 @@ Id DeletedDateTime This example demonstrates how to retrieve top two groups from Microsoft Entra ID. -- `-ObjectId` specifies the ID of a group. +- `-GroupId` specifies the ID of a group. ### Example 3: Get all members within a group by group ID ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupMember -ObjectId 'tttttttt-0000-2222-0000-aaaaaaaaaaaa' -All +Get-EntraGroupMember -GroupId 'tttttttt-0000-2222-0000-aaaaaaaaaaaa' -All ``` ```Output @@ -109,13 +109,13 @@ cccccccc-8888-9999-0000-dddddddddddd This example retrieves all members within a group by group ID. -- `-ObjectId` specifies the ID of a group. +- `-GroupId` specifies the ID of a group. ### Example 4: Retrieve and Select Group Member Properties ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupMember -ObjectId 'tttttttt-0000-2222-0000-aaaaaaaaaaaa' | Select-Object DisplayName, '@odata.type' +Get-EntraGroupMember -GroupId 'tttttttt-0000-2222-0000-aaaaaaaaaaaa' | Select-Object DisplayName, '@odata.type' ``` ```Output @@ -127,9 +127,9 @@ test2 #microsoft.graph.servicePrincipal test3 #microsoft.graph.servicePrincipal ``` -This example retrieves the members of a specified group by its `ObjectId` and selects only the `DisplayName` and `@odata.type` properties for each member. +This example retrieves the members of a specified group by its `GroupId` and selects only the `DisplayName` and `@odata.type` properties for each member. -- `-ObjectId` specifies the ID of a group. +- `-GroupId` specifies the ID of a group. ## Parameters @@ -149,14 +149,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupOwner.md index 0e4db35dd..340e3463a 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupOwner.md @@ -27,7 +27,7 @@ Gets an owner of a group. ```powershell Get-EntraGroupOwner - -ObjectId + -GroupId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraGroupOwner ## Description -The `Get-EntraGroupOwner` cmdlet gets an owner of a group in Microsoft Entra ID. Specify `ObjectId` parameter gets an owner of a group. +The `Get-EntraGroupOwner` cmdlet gets an owner of a group in Microsoft Entra ID. Specify `GroupId` parameter gets an owner of a group. In delegated scenarios, the signed-in user must have a supported Microsoft Entra role or a custom role with the `microsoft.directory/groups/owners/read` permission. The following least privileged roles support this operation: @@ -52,7 +52,7 @@ In delegated scenarios, the signed-in user must have a supported Microsoft Entra ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupOwner -ObjectId 'vvvvvvvv-7777-9999-7777-jjjjjjjjjjjj' +Get-EntraGroupOwner -GroupId 'vvvvvvvv-7777-9999-7777-jjjjjjjjjjjj' ``` ```Output @@ -66,13 +66,13 @@ dddddddd-3333-4444-5555-eeeeeeeeeeee This example demonstrates how to retrieve the owner of a specific group. -- `-ObjectId` Parameter specifies the ID of a group. +- `-GroupId` Parameter specifies the ID of a group. ### Example 2: Gets all group owners ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupOwner -ObjectId 'zzzzzzzz-6666-8888-9999-pppppppppppp' -All +Get-EntraGroupOwner -GroupId 'zzzzzzzz-6666-8888-9999-pppppppppppp' -All ``` ```Output @@ -86,13 +86,13 @@ dddddddd-3333-4444-5555-eeeeeeeeeeee This example demonstrates how to retrieve the all owner of a specific group. -- `-ObjectId` Parameter specifies the ID of a group. +- `-GroupId` Parameter specifies the ID of a group. ### Example 3: Gets two group owners ```powershell Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupOwner -ObjectId 'vvvvvvvv-8888-9999-0000-jjjjjjjjjjjj' -Top 2 +Get-EntraGroupOwner -GroupId 'vvvvvvvv-8888-9999-0000-jjjjjjjjjjjj' -Top 2 ``` ```Output @@ -104,7 +104,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example demonstrates how to retrieve the top two owners of a specific group. -- `-ObjectId` parameter specifies the ID of a group. +- `-GroupId` parameter specifies the ID of a group. ## Parameters @@ -124,14 +124,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupPermissionGrant.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupPermissionGrant.md index 907ffdc31..61a2d722e 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupPermissionGrant.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraGroupPermissionGrant.md @@ -26,7 +26,7 @@ Retrieves a list of permission grants that have been consented for this group. ```powershell Get-EntraGroupPermissionGrant - -Id + -GroupId [-Property ] [] ``` @@ -40,8 +40,8 @@ Retrieves a list of permission grants that have been consented for this group. ### Example 1: List existing permission grants for the group ```powershell -Connect-Entra -Scopes 'GroupMember.Read.All' -Get-EntraGroupPermissionGrant -Id 'CcDdEeFfGgHhIiJjKkLlMmNnOoPpQq3' +Connect-Entra -Scopes 'GroupMember.Read.All' +Get-EntraGroupPermissionGrant -GroupId 'CcDdEeFfGgHhIiJjKkLlMmNnOoPpQq3' ``` ```Output @@ -57,14 +57,14 @@ This cmdlet list existing permission grants for the specified group. ## Parameters -### -Id +### -GroupId The unique identifier of group. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraIdentityProvider.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraIdentityProvider.md index eb83109bb..358563649 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraIdentityProvider.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraIdentityProvider.md @@ -36,7 +36,7 @@ Get-EntraIdentityProvider ```powershell Get-EntraIdentityProvider - -Id + -IdentityProviderBaseId [-Property ] [] ``` @@ -76,7 +76,7 @@ This example retrieves the list of all configured identity providers and their p ```powershell Connect-Entra -Scopes 'IdentityProvider.Read.All' -Get-EntraIdentityProvider -Id Google-OAUTH +Get-EntraIdentityProvider -IdentityProviderBaseId Google-OAUTH ``` ```Output @@ -87,18 +87,18 @@ Google-OAUTH GoogleName This example retrieves the properties for the specified identity provider. -- `-Id` parameter specifies the unique identifier of the identity provider. +- `-IdentityProviderBaseId` parameter specifies the unique identifier of the identity provider. ## Parameters -### -Id +### -IdentityProviderBaseId The unique identifier for an identity provider. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraLifecyclePolicyGroup.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraLifecyclePolicyGroup.md index 3cf5cac68..155549657 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraLifecyclePolicyGroup.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraLifecyclePolicyGroup.md @@ -26,14 +26,14 @@ Retrieves the lifecycle policy object to which a group belongs. ```powershell Get-EntraLifecyclePolicyGroup - -Id + -GroupId [-Property ] [] ``` ## Description -The `Get-EntraLifecyclePolicyGroup` retrieves the lifecycle policy object to which a group belongs. Specify the `-Id` parameter to get the lifecycle policy object to which a group belongs. +The `Get-EntraLifecyclePolicyGroup` retrieves the lifecycle policy object to which a group belongs. Specify the `-GroupId` parameter to get the lifecycle policy object to which a group belongs. ## Examples @@ -41,7 +41,7 @@ The `Get-EntraLifecyclePolicyGroup` retrieves the lifecycle policy object to whi ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraLifecyclePolicyGroup -Id 'bbbbbbbb-1111-2222-3333-cccccccccccc' +Get-EntraLifecyclePolicyGroup -GroupId 'bbbbbbbb-1111-2222-3333-cccccccccccc' ``` ```Output @@ -52,18 +52,18 @@ bbbbbbbb-1111-2222-3333-cccccccccccc admingroup@contoso.com 200 This example demonstrates how to retrieve lifecycle policy object by Id in Microsoft Entra ID. -- `-Id` - specifies the ID of a group. +- `-GroupId` - specifies the ID of a group. ## Parameters -### -Id +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraScopedRoleMembership.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraScopedRoleMembership.md index 00911b68d..57698577c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraScopedRoleMembership.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraScopedRoleMembership.md @@ -25,7 +25,7 @@ List Microsoft Entra role assignments with administrative unit scope. ```powershell Get-EntraScopedRoleMembership - -ObjectId + -AdministrativeUnitId [-ScopedRoleMembershipId ] [-Property ] [] @@ -43,7 +43,7 @@ The `Get-EntraScopedRoleMembership` cmdlet lists Microsoft Entra role assignment Connect-Entra -Scopes 'RoleManagement.Read.Directory' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId ScopedRoleMembershipId = 'dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc' } Get-EntraScopedRoleMembership @params @@ -57,7 +57,7 @@ dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc aaaaaaaa-bbbb-aaaa-bbbb-cccccccccccc bb This example gets scoped role administrator. You cane use the command `Get-EntraAdministrativeUnit` to get administrative unit Id. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `-ScopedRoleMembershipId` parameter specifies the scoped role membership Id. ### Example 2: List scoped administrators for administrative unit by ObjectId @@ -76,18 +76,18 @@ dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc aaaaaaaa-bbbb-aaaa-bbbb-cccccccccccc bb This example list scoped administrators with objectId. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md index 9a82a3802..3f6ed52f4 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md @@ -49,7 +49,7 @@ Get-EntraServicePrincipal ```powershell Get-EntraServicePrincipal - -ObjectId + -ServicePrincipalId [-All] [-Property ] [] @@ -78,11 +78,11 @@ dddddddd-3333-4444-5555-eeeeeeeeeeee 33334444-dddd-5555-eeee-6666ffff7777 Projec This example retrieves all service principals from the directory. -### Example 2: Retrieve a service principal by ObjectId +### Example 2: Retrieve a service principal by ServicePrincipalId ```powershell Connect-Entra -Scopes 'Application.Read.All' -Get-EntraServicePrincipal -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Get-EntraServicePrincipal -ServicePrincipalId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` ```Output @@ -93,7 +93,7 @@ M365 License Manager aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 0000111 This command retrieves specific service principal. -- `-ObjectId` Parameter specifies the ID of a service principal. +- `-ServicePrincipalId` Parameter specifies the ID of a service principal. ### Example 3: Retrieve all service principals from the directory @@ -286,14 +286,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignedTo.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignedTo.md index 41c616179..891274acd 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignedTo.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignedTo.md @@ -26,7 +26,7 @@ Gets app role assignments for this app or service, granted to users, groups and ```powershell Get-EntraServicePrincipalAppRoleAssignedTo - -ObjectId + -ServicePrincipalId [-All ] [-Top ] [-Property ] @@ -55,7 +55,7 @@ For delegated scenarios, the calling user needs at least one of the following Mi ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipalId = (Get-EntraServicePrincipal -Top 1).ObjectId - Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId $ServicePrincipalId + Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId $ServicePrincipalId ``` This example shows how to get app role assignments for an app or service, granted to users, groups and other service principals. @@ -68,7 +68,7 @@ This example shows how to get app role assignments for an app or service, grante ```powershell Connect-Entra -Scopes 'Application.Read.All' - Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId 00001111-aaaa-2222-bbbb-3333cccc4444 -All + Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId 00001111-aaaa-2222-bbbb-3333cccc4444 -All ``` ```output @@ -86,7 +86,7 @@ This command gets the all app role assignments for the service principal granted ### Example 3: Get five app role assignments ```powershell - Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId 00001111-aaaa-2222-bbbb-3333cccc4444 -Top 5 + Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId 00001111-aaaa-2222-bbbb-3333cccc4444 -Top 5 ``` ```Output @@ -119,14 +119,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignment.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignment.md index e7672455e..971849856 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignment.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalAppRoleAssignment.md @@ -26,7 +26,7 @@ Gets a service principal application role assignment. ```powershell Get-EntraServicePrincipalAppRoleAssignment - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -37,6 +37,16 @@ Get-EntraServicePrincipalAppRoleAssignment The `Get-EntraServicePrincipalAppRoleAssignment` cmdlet gets a role assignment for a service principal application in Microsoft Entra ID. +For delegated scenarios, the calling user needs at least one of the following Microsoft Entra roles. +- Directory Synchronization Accounts +- Directory Writer +- Hybrid Identity Administrator +- Identity Governance Administrator +- Privileged Role Administrator +- User Administrator +- Application Administrator +- Cloud Application Administrator + ## Examples ### Example 1: Retrieve the application role assignments for a service principal @@ -44,7 +54,7 @@ The `Get-EntraServicePrincipalAppRoleAssignment` cmdlet gets a role assignment f ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipalId = (Get-EntraServicePrincipal -Top 1).ObjectId - Get-EntraServicePrincipalAppRoleAssignment -ObjectId $ServicePrincipalId + Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId $ServicePrincipalId ``` ```Output @@ -63,7 +73,7 @@ This command gets application role assignments for specified service principal. ```powershell Connect-Entra -Scopes 'Application.Read.All' - Get-EntraServicePrincipalAppRoleAssignment -ObjectId '00001111-aaaa-2222-bbbb-3333cccc4444' -All + Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId '00001111-aaaa-2222-bbbb-3333cccc4444' -All ``` ```Output @@ -82,7 +92,7 @@ This command gets all application role assignments for specified service princip ```powershell Connect-Entra -Scopes 'Application.Read.All' - Get-EntraServicePrincipalAppRoleAssignment -ObjectId '00001111-aaaa-2222-bbbb-3333cccc4444' -Top 3 + Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId '00001111-aaaa-2222-bbbb-3333cccc4444' -Top 3 ``` ```Output @@ -113,14 +123,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalCreatedObject.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalCreatedObject.md index 4c9788f27..8a607194b 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalCreatedObject.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalCreatedObject.md @@ -25,7 +25,7 @@ Get objects created by a service principal. ```powershell Get-EntraServicePrincipalCreatedObject - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -43,36 +43,36 @@ The `Get-EntraServicePrincipalCreatedObject` cmdlet gets an object created by a ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalCreatedObject -ObjectId $ServicePrincipal.ObjectId +Get-EntraServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId ``` This example gets objects created by the service principal identified by $ServicePrincipalId. You can use the command `Get-EntraServicePrincipal` to get service principal ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 2: Retrieve the all objects created by a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalCreatedObject -ObjectId $ServicePrincipal.ObjectId -All +Get-EntraServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` This example demonstrates how to get the all object created by a specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 3: Retrieve the top two objects created by a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalCreatedObject -ObjectId $ServicePrincipal.ObjectId -Top 2 +Get-EntraServicePrincipalCreatedObject -ServicePrincipalId $ServicePrincipal.ObjectId -Top 2 ``` This example demonstrates how to get the top two object created by a specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ## Parameters @@ -92,14 +92,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalKeyCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalKeyCredential.md index 85ee76686..4e4a3529c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalKeyCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalKeyCredential.md @@ -26,7 +26,7 @@ Get key credentials for a service principal. ```powershell Get-EntraServicePrincipalKeyCredential - -ObjectId + -ServicePrincipalId [] ``` @@ -41,7 +41,7 @@ The `Get-EntraServicePrincipalKeyCredential` cmdlet gets the key credentials for ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalKeyCredential -ObjectId $ServicePrincipal.ObjectId +Get-EntraServicePrincipalKeyCredential -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -52,18 +52,18 @@ CustomKeyIdentifier DisplayName EndDateTime Key KeyId This example retrieves the key credentials for specified service principal in Microsoft Entra ID. You can use the command `Get-EntraServicePrincipal` to get a service principal object Id. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of the application for which to get the password credential. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalMembership.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalMembership.md index 4eafe52e4..4fcb1f99c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalMembership.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalMembership.md @@ -26,7 +26,7 @@ Get a service principal membership. ```powershell Get-EntraServicePrincipalMembership - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -44,7 +44,7 @@ The `Get-EntraServicePrincipalMembership` cmdlet gets the memberships of a servi ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalMembership -ObjectId $ServicePrincipal.ObjectId +Get-EntraServicePrincipalMembership -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -55,14 +55,14 @@ Id DeletedDateTime This cmdlet retrieves a specified service principal memberships in Microsoft Entra ID. You can use the command `Get-EntraServicePrincipal` to get service principal ID. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 2: Retrieve all memberships of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalMembership -ObjectId $ServicePrincipal.ObjectId -All +Get-EntraServicePrincipalMembership -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` ```Output @@ -75,14 +75,14 @@ Id DeletedDateTime This command gets all memberships of a specified service principal. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ### Example 3: Retrieve top two memberships of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalMembership -ObjectId $ServicePrincipal.ObjectId -Top 2 +Get-EntraServicePrincipalMembership -ServicePrincipalId $ServicePrincipal.ObjectId -Top 2 ``` ```Output @@ -95,7 +95,7 @@ Id DeletedDateTime This command gets top two memberships of a specified service principal. -- `-ObjectId` parameter specifies the service principal ID. +- `-ServicePrincipalId` parameter specifies the service principal ID. ## Parameters @@ -115,14 +115,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.md index 0c1c1d42c..aaa8e79db 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.md @@ -26,7 +26,7 @@ Gets an oAuth2PermissionGrant object. ```powershell Get-EntraServicePrincipalOAuth2PermissionGrant --ObjectId +-ServicePrincipalId [-All] [-Top ] [-Property ] @@ -44,7 +44,7 @@ The `Get-EntraServicePrincipalOAuth2PermissionGrant` cmdlet gets an oAuth2Permis ```powershell Connect-Entra -Scopes 'Directory.Read.All' ServicePrincipalId = (Get-EntraServicePrincipal -Top 1).ObjectId -Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId $ServicePrincipalId +Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId $ServicePrincipalId ``` ```output @@ -59,7 +59,7 @@ This example demonstrates how to get all oAuth2PermissionGrant object for a serv ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId '00001111-aaaa-2222-bbbb-3333cccc4444' -All +Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId '00001111-aaaa-2222-bbbb-3333cccc4444' -All ``` ```Output @@ -76,7 +76,7 @@ This example demonstrates how to get all oAuth2PermissionGrant object for a serv ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId '00001111-aaaa-2222-bbbb-3333cccc4444' -Top 2 +Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId '00001111-aaaa-2222-bbbb-3333cccc4444' -Top 2 ``` ```Output @@ -106,14 +106,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwnedObject.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwnedObject.md index 0b2167e3c..890f1d9a6 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwnedObject.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwnedObject.md @@ -28,7 +28,7 @@ Gets an object owned by a service principal. ```powershell Get-EntraServicePrincipalOwnedObject [-All] - -ObjectId + -ServicePrincipalId [-Top ] [-Property ] [] @@ -45,7 +45,7 @@ The `Get-EntraServicePrincipalOwnedObject` cmdlet retrieves an object owned by a ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalOwnedObject -ObjectId $ServicePrincipal.ObjectId +Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -56,14 +56,14 @@ bbbbbbbb-1111-2222-3333-cccccccccccc The command retrieves the owned objects of a service principal. -- `-ObjectId` Parameter specifies the ID of a service principal. +- `-ServicePrincipalId` Parameter specifies the ID of a service principal. ### Example 2: Retrieve the all owned objects of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipalId = (Get-EntraServicePrincipal -Filter "DisplayName eq ''").ObjectId -Get-EntraServicePrincipalOwnedObject -ObjectId $ServicePrincipalId -All +Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipalId -All ``` ```Output @@ -75,14 +75,14 @@ cccccccc-2222-3333-4444-dddddddddddd This example retrieves an object owned by a service principal in Microsoft Entra ID. You can use the command `Get-EntraServicePrincipal` to get service principal Id. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ### Example 2: Retrieve all owned objects of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalOwnedObject -ObjectId $ServicePrincipal.ObjectId -All +Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId -All ``` ```Output @@ -94,14 +94,14 @@ cccccccc-2222-3333-4444-dddddddddddd The command receives the all owned objects of a service principal. -- `-ObjectId` Parameter specifies the ID of a service principal. +- `-ServicePrincipalId` Parameter specifies the ID of a service principal. ### Example 3: Retrieve top one owned object of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalOwnedObject -ObjectId $ServicePrincipal.ObjectId -Top 1 +Get-EntraServicePrincipalOwnedObject -ServicePrincipalId $ServicePrincipal.ObjectId -Top 1 ``` ```Output @@ -112,7 +112,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example retrieves the top one owned object of a specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ## Parameters @@ -132,14 +132,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwner.md index 63b5a49dd..10562863a 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalOwner.md @@ -26,7 +26,7 @@ Get the owner of a service principal. ```powershell Get-EntraServicePrincipalOwner - -ObjectId + -ServicePrincipalId [-All] [-Top ] [-Property ] @@ -44,7 +44,7 @@ The `Get-EntraServicePrincipalOwner` cmdlet gets the owners of a service princip ```powershell Connect-Entra -Scopes 'Application.Read.All' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalOwner -ObjectId $servicePrincipal.ObjectId +Get-EntraServicePrincipalOwner -ServicePrincipalId $servicePrincipal.ObjectId ``` ```Output @@ -57,14 +57,14 @@ cccccccc-2222-3333-4444-dddddddddddd This example gets the owners of a specified service principal. You can use the comand `Get-EntraServicePrincipal` to get service principal object Id. -- `-ObjectId` parameter specifies the unique identifier of a service principal. +- `-ServicePrincipalId` parameter specifies the unique identifier of a service principal. ### Example 2: Retrieve all the owners of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalOwner -ObjectId $servicePrincipal.ObjectId -All +Get-EntraServicePrincipalOwner -ServicePrincipalId $servicePrincipal.ObjectId -All ``` ```Output @@ -77,14 +77,14 @@ cccccccc-2222-3333-4444-dddddddddddd This command gets all the owners of a service principal. You can use the comand `Get-EntraServicePrincipal` to get service principal object Id. -- `-ObjectId` parameter specifies the unique identifier of a service principal. +- `-ServicePrincipalId` parameter specifies the unique identifier of a service principal. ### Example 3: Retrieve top two owners of a service principal ```powershell Connect-Entra -Scopes 'Application.Read.All' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalOwner -ObjectId $servicePrincipal.ObjectId -Top 2 +Get-EntraServicePrincipalOwner -ServicePrincipalId $servicePrincipal.ObjectId -Top 2 ``` ```Output @@ -96,7 +96,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This command gets top two owners of a service principal. You can use the comand `Get-EntraServicePrincipal` to get service principal object Id. -- `-ObjectId` parameter specifies the unique identifier of a service principal. +- `-ServicePrincipalId` parameter specifies the unique identifier of a service principal. ### Example 4: Retrieve service principal owner details @@ -104,13 +104,13 @@ This command gets top two owners of a service principal. You can use the comand Connect-Entra -Scopes 'Application.Read.All' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" # Get the owners of the service principal -$owners = Get-EntraServicePrincipalOwner -ObjectId $servicePrincipal.ObjectId -All +$owners = Get-EntraServicePrincipalOwner -ServicePrincipalId $servicePrincipal.ObjectId -All $result = @() # Loop through each owner and get their UserPrincipalName and DisplayName foreach ($owner in $owners) { $userId = $owner.Id - $user = Get-EntraUser -ObjectId $userId + $user = Get-EntraUser -UserId $userId $userDetails = [PSCustomObject]@{ Id = $owner.Id UserPrincipalName = $user.UserPrincipalName @@ -150,14 +150,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalPasswordCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalPasswordCredential.md index 68447c93b..a841d551c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalPasswordCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipalPasswordCredential.md @@ -26,7 +26,7 @@ Get credentials for a service principal. ```powershell Get-EntraServicePrincipalPasswordCredential - -ObjectId + -ServicePrincipalId [] ``` @@ -41,7 +41,7 @@ The `Get-EntraServicePrincipalPasswordCredential` cmdlet gets the password crede ```powershell Connect-Entra -Scopes 'Application.Read.All' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Get-EntraServicePrincipalPasswordCredential -ObjectId $ServicePrincipal.ObjectId +Get-EntraServicePrincipalPasswordCredential -ServicePrincipalId $ServicePrincipal.ObjectId ``` ```Output @@ -54,18 +54,18 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This example retrieves the password credentials for specified service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the object ID of a service principal. You can use the command `Get-EntraServicePrincipal` to get a service principal Id. +- `-ServicePrincipalId` parameter specifies the object ID of a service principal. You can use the command `Get-EntraServicePrincipal` to get a service principal Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of the service principal for which to get password credentials. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md index 98cc125dd..6bbe6ed23 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md @@ -35,7 +35,7 @@ Get-EntraSubscribedSku ```powershell Get-EntraSubscribedSku - -ObjectId + -SubscribedSkuId [-Property ] [] ``` @@ -63,11 +63,11 @@ cccc2222-dd33-4444-55ee-666666ffffff 2222cccc-33dd-eeee-ff44-aaaaaa555555 M365x9 This example demonstrates how to retrieve subscribed SKUs to Microsoft services. -### Example 2: Get subscribed SKUs by ObjectId +### Example 2: Get subscribed SKUs by SubscribedSkuId ```powershell Connect-Entra -Scopes 'Organization.Read.All' -Get-EntraSubscribedSku -ObjectId 'abcdefgh-1111-2222-bbbb-cccc33333333_dddddddd-4444-5555-eeee-666666666666' +Get-EntraSubscribedSku -SubscribedSkuId 'abcdefgh-1111-2222-bbbb-cccc33333333_dddddddd-4444-5555-eeee-666666666666' ``` ```Output @@ -78,7 +78,7 @@ aaaa0000-bb11-2222-33cc-444444dddddd 0000aaaa-11bb-cccc-dd22-eeeeee333333 M365x9 This example demonstrates how to retrieve specified subscribed SKUs to Microsoft services. -- `-ObjectId` parameter specifies the ID of the SKU (Stock Keeping Unit). +- `-SubscribedSkuId` parameter specifies the ID of the SKU (Stock Keeping Unit). ### Example 3: Retrieve all users assigned a specific license @@ -126,7 +126,7 @@ foreach ($User in $SelectedUsers) { try { # Check if the group display name is already in the hashtable if (-not $GroupDisplayNames.ContainsKey($AssignedByGroup)) { - $Group = Get-EntraGroup -ObjectId $AssignedByGroup + $Group = Get-EntraGroup -GroupId $AssignedByGroup $GroupDisplayNames[$AssignedByGroup] = $Group.DisplayName } @@ -162,14 +162,14 @@ This example shows a list of users, their licenses, and the source of the licens ## Parameters -### -ObjectId +### -SubscribedSkuId The object ID of the SKU (Stock Keeping Unit). ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index 443eb9ec2..b463aa703 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -49,7 +49,7 @@ Get-EntraUser ```powershell Get-EntraUser - -ObjectId + -UserId [-All] [-Property ] [] @@ -82,7 +82,7 @@ This example demonstrates how to get top three users from Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUser -ObjectId 'SawyerM@contoso.com' +Get-EntraUser -UserId 'SawyerM@contoso.com' ``` ```Output @@ -93,7 +93,7 @@ Sawyer Miller bbbbbbbb-1111-2222-3333-cccccccccccc sawyerm@tenant.com sawyerm@te This command gets the specified user. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. ### Example 3: Search among retrieved users @@ -145,7 +145,7 @@ In this example, we retrieve all users whose MailNickname starts with Ada. ```powershell Connect-Entra -Scopes 'User.Read.All','AuditLog.Read.All' -Get-EntraUser -ObjectId 'SawyerM@contoso.com' -Property 'SignInActivity' | Select-Object -ExpandProperty 'SignInActivity' +Get-EntraUser -UserId 'SawyerM@contoso.com' -Property 'SignInActivity' | Select-Object -ExpandProperty 'SignInActivity' ``` ```Output @@ -343,14 +343,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID (as a User Principal Name (UPN) or ObjectId) of a user in Microsoft Entra ID. +Specifies the ID (as a User Principal Name (UPN) or UserId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: GetById -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserCreatedObject.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserCreatedObject.md index c764c6b47..56eb9c60b 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserCreatedObject.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserCreatedObject.md @@ -26,7 +26,7 @@ Get objects created by the user. ```powershell Get-EntraUserCreatedObject - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -43,7 +43,7 @@ The `Get-EntraUserCreatedObject` cmdlet gets objects created by a user in Micros ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraUserCreatedObject -ObjectId 'SawyerM@contoso.com' +Get-EntraUserCreatedObject -UserId 'SawyerM@contoso.com' ``` ```Output @@ -57,13 +57,13 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example retrieves an object created by the specified user. -- `-ObjectId` parameter specifies the object Id of a user(as a UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the object Id of a user(as a UserPrincipalName or UserId). ### Example 2: Get all user-created objects ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraUserCreatedObject -ObjectId 'SawyerM@contoso.com' -All +Get-EntraUserCreatedObject -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -77,13 +77,13 @@ eeeeeeee-4444-5555-6666-ffffffffffff This example retrieves all objects created by the specified user. -- `-ObjectId` parameter specifies the object Id of a user(as a UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the object Id of a user(as a UserPrincipalName or UserId). ### Example 3: Get a top one user-created object ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraUserCreatedObject -ObjectId 'SawyerM@contoso.com' -Top 1 +Get-EntraUserCreatedObject -UserId 'SawyerM@contoso.com' -Top 1 ``` ```Output @@ -94,7 +94,7 @@ bbbbbbbb-1111-2222-3333-cccccccccccc This example retrieves top one object created by the specified user. -- `-ObjectId` parameter specifies the object Id of a user(as a UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the object Id of a user(as a UserPrincipalName or UserId). ## Parameters @@ -114,14 +114,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID (as a UserPrincipalName or ObjectId) of a user in Microsoft Entra ID. +Specifies the ID (as a UserPrincipalName or UserId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserDirectReport.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserDirectReport.md index 580cd2fb8..0a4ea05e0 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserDirectReport.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserDirectReport.md @@ -27,7 +27,7 @@ Get the user's direct reports. ```powershell Get-EntraUserDirectReport - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraUserDirectReport ## Description -The `Get-EntraUserDirectReport` cmdlet gets the direct reports for a user in Microsoft Entra ID. Specify `ObjectId` parameter gets the direct reports for a user. +The `Get-EntraUserDirectReport` cmdlet gets the direct reports for a user in Microsoft Entra ID. Specify `UserId` parameter gets the direct reports for a user. ## Examples @@ -44,7 +44,7 @@ The `Get-EntraUserDirectReport` cmdlet gets the direct reports for a user in Mic ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraUserDirectReport -ObjectId 'SawyerM@contoso.com' +Get-EntraUserDirectReport -UserId 'SawyerM@contoso.com' ``` ```Output @@ -58,13 +58,13 @@ dddddddd-3333-4444-5555-eeeeeeeeeeee This example demonstrates how to retrieve direct reports for a user in Microsoft Entra ID. -- `-ObjectId` Parameter specifies the ID of a user (UserPrincipalName or ObjectId). +- `-UserId` Parameter specifies the ID of a user (UserPrincipalName or UserId). ### Example 2: Get all direct reports ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraUserDirectReport -ObjectId 'SawyerM@contoso.com' -All +Get-EntraUserDirectReport -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -76,13 +76,13 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb This example demonstrates how to retrieve all direct reports for a user in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a user (UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the ID of a user (UserPrincipalName or UserId). ### Example 3: Get a top two direct reports ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraUserDirectReport -ObjectId 'SawyerM@contoso.com' -Top 2 +Get-EntraUserDirectReport -UserId 'SawyerM@contoso.com' -Top 2 ``` ```Output @@ -94,7 +94,7 @@ aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb This example demonstrates how to retrieve top five direct reports for a user in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a user (UserPrincipalName or ObjectId). +- `-UserId` parameter specifies the ID of a user (UserPrincipalName or UserId). ## Parameters @@ -114,14 +114,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user's UserPrincipalName or ObjectId in Microsoft Entra ID. +Specifies the ID of a user's UserPrincipalName or UserId in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserExtension.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserExtension.md index 6a9d5ebba..96b66cd87 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserExtension.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserExtension.md @@ -26,7 +26,7 @@ Gets a user extension. ```powershell Get-EntraUserExtension - -ObjectId + -UserId [-Property ] [] ``` @@ -42,29 +42,32 @@ The Get-EntraUserExtension cmdlet gets a user extension in Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'User.Read' $UserId = (Get-EntraUser -ObjectId 'SawyerM@contoso.com').ObjectId -Get-EntraUserExtension -ObjectId $UserId +Get-EntraUserExtension -UserId $UserId ``` ```Output -Id --- -com.contoso.roamingSettings +onPremisesDistinguishedName : +@odata.context : https://graph.microsoft.com/v1.0/$metadata#users(identities,onPremisesDistinguishedName,employeeId,createdDateTime)/$entity +createdDateTime : 18/07/2024 05:13:40 +employeeId : +identities : {@{signInType=userPrincipalName; issuerAssignedId=SawyerM@contoso.com; issuer=SawyerM@contoso.com}} +userIdentities : {@{signInType=userPrincipalName; issuerAssignedId=SawyerM@contoso.com; issuer=SawyerM@contoso.com}} ``` This example shows how to retrieve the extension attributes for a specified user. You can use the command `Get-EntraUser` to get user object Id. -- `-ObjectId` parameter specifies the user object Id. +- `-UserId` parameter specifies the user object Id. ## Parameters -### -ObjectId +### -UserId Specifies the ID of an object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserLicenseDetail.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserLicenseDetail.md index cd8b1c77d..6dbad4066 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserLicenseDetail.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserLicenseDetail.md @@ -26,7 +26,7 @@ Retrieves license details for a user. ```powershell Get-EntraUserLicenseDetail - -ObjectId + -UserId [-Property ] [] ``` @@ -41,7 +41,7 @@ This cmdlet retrieves license details for a user. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserLicenseDetail -ObjectId 'SawyerM@contoso.com' +Get-EntraUserLicenseDetail -UserId 'SawyerM@contoso.com' ``` ```Output @@ -56,14 +56,14 @@ This example demonstrates how to retrieve license details for a user from Micros ## Parameters -### -ObjectId +### -UserId The object ID of the user for which the license details are retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md index 660358aa1..a72d6f6dd 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md @@ -27,7 +27,7 @@ Gets the manager of a user. ```powershell Get-EntraUserManager - -ObjectId + -UserId [-Property ] [] ``` @@ -35,7 +35,7 @@ Get-EntraUserManager ## Description The `Get-EntraUserManager` cmdlet gets the manager of a user in Microsoft Entra ID. Specify -`ObjectId` parameter to get the specific manager of user. +`UserId` parameter to get the specific manager of user. ## Examples @@ -43,7 +43,7 @@ The `Get-EntraUserManager` cmdlet gets the manager of a user in Microsoft Entra ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserManager -ObjectId 'SawyerM@contoso.com' +Get-EntraUserManager -UserId 'SawyerM@contoso.com' ``` ```Output @@ -62,7 +62,7 @@ displayName : Sawyer Miller This example demonstrates how to retrieve the manager of a specific user. -- `-ObjectId` Parameter specifies ObjectID or User Principal Name of User. +- `-UserId` Parameter specifies UserId or User Principal Name of User. ### Example 2: Retrieve users without managers @@ -93,14 +93,14 @@ This example demonstrates how to retrieve users without managers. ## Parameters -### -ObjectId +### -UserId -The unique identifier of a user in Microsoft Entra ID (User Principal Name or ObjectId). +The unique identifier of a user in Microsoft Entra ID (User Principal Name or UserId). ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md index 49a7811e2..0f685737a 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md @@ -26,7 +26,7 @@ Get user memberships. ```powershell Get-EntraUserMembership - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -43,7 +43,7 @@ The `Get-EntraUserMembership` cmdlet gets user memberships in Microsoft Entra ID ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraUserMembership -ObjectId 'SawyerM@contoso.com' +Get-EntraUserMembership -UserId 'SawyerM@contoso.com' ``` ```Output @@ -90,7 +90,7 @@ This example demonstrates how to retrieve user memberships in Microsoft Entra ID ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraUserMembership -ObjectId 'SawyerM@contoso.com' -All +Get-EntraUserMembership -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -110,7 +110,7 @@ This example demonstrates how to retrieve users all memberships in Microsoft Ent ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraUserMembership -ObjectId 'SawyerM@contoso.com' -Top 3 +Get-EntraUserMembership -UserId 'SawyerM@contoso.com' -Top 3 ``` ```Output @@ -157,14 +157,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOAuth2PermissionGrant.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOAuth2PermissionGrant.md index 5e7c9e911..b69676b2e 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOAuth2PermissionGrant.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOAuth2PermissionGrant.md @@ -26,7 +26,7 @@ Gets an oAuth2PermissionGrant object. ```powershell Get-EntraUserOAuth2PermissionGrant - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -35,7 +35,7 @@ Get-EntraUserOAuth2PermissionGrant ## Description -The `Get-EntraUserOAuth2PermissionGrant` cmdlet gets an oAuth2PermissionGrant object for the specified user in Microsoft Entra ID. Specify `ObjectId` parameter to retrieve an oAuth2PermissionGrant object. +The `Get-EntraUserOAuth2PermissionGrant` cmdlet gets an oAuth2PermissionGrant object for the specified user in Microsoft Entra ID. Specify `UserId` parameter to retrieve an oAuth2PermissionGrant object. In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation. @@ -55,7 +55,7 @@ In delegated scenarios with work or school accounts, the signed-in user must be ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraUserOAuth2PermissionGrant -ObjectId 'SawyerM@contoso.com' +Get-EntraUserOAuth2PermissionGrant -UserId 'SawyerM@contoso.com' ``` ```Output @@ -65,13 +65,13 @@ HXFXwKLgoUC4rwbZbCDIdffW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 00001111-aaaa-2 9uBzRwC0s0CFCDQN6O4Ik_fW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 11112222-bbbb-3333-cccc-4444dddd5555 Principal 13-01-2024 08:0... ``` -This example retrieves the OAuth2 permission grants for a user using the ObjectId parameter. Use the `Get-EntraBetaUser` cmdlet to obtain the `ObjectId` value. +This example retrieves the OAuth2 permission grants for a user using the ObjectId parameter. Use the `Get-EntraUser` cmdlet to obtain the `UserId` value. ### Example 2: Retrieve the OAuth2 permission grants for a user using object ID parameter ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraUserOAuth2PermissionGrant -ObjectId 'SawyerM@contoso.com' +Get-EntraUserOAuth2PermissionGrant -UserId 'SawyerM@contoso.com' ``` ```Output @@ -83,13 +83,13 @@ HXFXwKLgoUC4rwbZbCDIdffW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 00001111-aaaa-2 This example retrieves the OAuth2 permission grants for a user using object ID parameter. -- `-ObjectId` parameter specifies the user ID. +- `-UserId` parameter specifies the user ID. ### Example 3: Retrieve the OAuth2 permission grants for a user using All parameter ```powershell Connect-Entra -Scopes 'Directory.Read.All' -Get-EntraUserOAuth2PermissionGrant -ObjectId 'SawyerM@contoso.com' -All +Get-EntraUserOAuth2PermissionGrant -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -118,7 +118,7 @@ HXFXwKLgoUC4rwbZbCDIdffW8XpadQNIoHik9aQxrVHR6StBYBRhQI7tzKID_LIV 00001111-aaaa-2 This Example Retrieve top one the OAuth2 permission grant in Microsoft Entra ID. -- `-ObjectId` parameter specifies the user ID. +- `-UserId` parameter specifies the user ID. ## Parameters @@ -138,14 +138,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId Specifies the ID (as a User Principal Name or ObjectId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedDevice.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedDevice.md index 309cb4c2a..b6f4ade3c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedDevice.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedDevice.md @@ -27,7 +27,7 @@ Get registered devices owned by a user. ```powershell Get-EntraUserOwnedDevice - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -44,7 +44,7 @@ The `Get-EntraUserOwnedDevice` cmdlet gets registered devices owned by the speci ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserOwnedDevice -ObjectId 'SawyerM@contoso.com' +Get-EntraUserOwnedDevice -UserId 'SawyerM@contoso.com' ``` ```Output @@ -60,7 +60,7 @@ This command gets the registered devices owned by the specified user. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserOwnedDevice -ObjectId 'SawyerM@contoso.com' -All +Get-EntraUserOwnedDevice -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -76,7 +76,7 @@ This command gets all the registered devices owned by the specified user. ```powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserOwnedDevice -ObjectId 'SawyerM@contoso.com' -Top 1 +Get-EntraUserOwnedDevice -UserId 'SawyerM@contoso.com' -Top 1 ``` ```Output @@ -105,14 +105,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a User Principal Name or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedObject.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedObject.md index 6561f974c..cc4f9de59 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedObject.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserOwnedObject.md @@ -27,7 +27,7 @@ Get objects owned by a user. ```powershell Get-EntraUserOwnedObject - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -36,7 +36,7 @@ Get-EntraUserOwnedObject ## Description -The `Get-EntraUserOwnedObject` cmdlet gets objects owned by a user in Microsoft Entra ID. Specify `ObjectId` parameter to get objects owned by user. +The `Get-EntraUserOwnedObject` cmdlet gets objects owned by a user in Microsoft Entra ID. Specify `UserId` parameter to get objects owned by user. ## Examples @@ -44,7 +44,7 @@ The `Get-EntraUserOwnedObject` cmdlet gets objects owned by a user in Microsoft ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraUserOwnedObject -ObjectId 'SawyerM@contoso.com' +Get-EntraUserOwnedObject -UserId 'SawyerM@contoso.com' ``` ```Output @@ -60,7 +60,7 @@ hhhhhhhh-5555-6666-7777-iiiiiiiiiiii This example retrieves objects owned by the specified user. -- `-ObjectId` Parameter specifies the ID of a user as a UserPrincipalName or ObjectId. +- `-UserId` Parameter specifies the ID of a user as a UserPrincipalName or UserId. ### Example 2: Get objects owned by a user with additional details @@ -92,7 +92,7 @@ This example retrieves objects owned by the specified user with more lookup deta ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraUserOwnedObject -ObjectId 'SawyerM@contoso.com' -All +Get-EntraUserOwnedObject -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -108,13 +108,13 @@ hhhhhhhh-5555-6666-7777-iiiiiiiiiiii This example retrieves all the objects owned by the specified user. -- `-ObjectId` parameter specifies the ID of a user as a UserPrincipalName or ObjectId. +- `-UserId` parameter specifies the ID of a user as a UserPrincipalName or UserId. ### Example 4: Get top three objects owned by a user ```powershell Connect-Entra -Scopes 'User.Read' -Get-EntraUserOwnedObject -ObjectId 'SawyerM@contoso.com' -Top 3 +Get-EntraUserOwnedObject -UserId 'SawyerM@contoso.com' -Top 3 ``` ```Output @@ -127,7 +127,7 @@ cccccccc-2222-3333-4444-dddddddddddd This example retrieves the top three objects owned by the specified user. -- `-ObjectId` parameter specifies the ID of a user as a UserPrincipalName or ObjectId. +- `-UserId` parameter specifies the ID of a user as a UserPrincipalName or UserId. ## Parameters @@ -147,14 +147,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a User Principal Name or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserRegisteredDevice.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserRegisteredDevice.md index 348f572e0..c58d964a6 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserRegisteredDevice.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserRegisteredDevice.md @@ -26,7 +26,7 @@ Get devices registered by a user. ```powershell Get-EntraUserRegisteredDevice - -ObjectId + -UserId [-All] [-Top ] [-Property ] @@ -43,7 +43,7 @@ The `Get-EntraUserRegisteredDevice` cmdlet gets devices registered by a user in ```Powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserRegisteredDevice -ObjectId 'SawyerM@contoso.com' +Get-EntraUserRegisteredDevice -UserId 'SawyerM@contoso.com' ``` ```Output @@ -59,7 +59,7 @@ This command gets the devices that are registered to the specified user. ```Powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserRegisteredDevice -ObjectId 'SawyerM@contoso.com' -All +Get-EntraUserRegisteredDevice -UserId 'SawyerM@contoso.com' -All ``` ```Output @@ -75,7 +75,7 @@ This command gets all the devices that are registered to the specified user. ```Powershell Connect-Entra -Scopes 'User.Read.All' -Get-EntraUserRegisteredDevice -ObjectId 'SawyerM@contoso.com' -Top 1 +Get-EntraUserRegisteredDevice -UserId 'SawyerM@contoso.com' -Top 1 ``` ```Output @@ -104,14 +104,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -UserId -Specifies the ID of a user (as a User Principal Name or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a User Principal Name or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserThumbnailPhoto.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserThumbnailPhoto.md index 469d969f7..3514e4f4a 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserThumbnailPhoto.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserThumbnailPhoto.md @@ -26,7 +26,7 @@ Retrieve the thumbnail photo of a user. ```powershell Get-EntraUserThumbnailPhoto - -ObjectId + -UserId [-Property ] [] ``` @@ -41,7 +41,7 @@ Retrieve the thumbnail photo of a user. ```powershell Connect-Entra -Scopes 'User.Read','User.Read.All' -Get-EntraUserThumbnailPhoto -ObjectId 'SawyerM@contoso.com' +Get-EntraUserThumbnailPhoto -UserId 'SawyerM@contoso.com' ``` ```Output @@ -50,20 +50,20 @@ Id Height Width default 292 278 ``` -This example shows how to retrieve the thumbnail photo of a user that is specified through the value of the ObejctId parameter. +This example shows how to retrieve the thumbnail photo of a user that is specified through the value of the UserId parameter. -- `-ObjectId` parameter specifies the user for which the thumbnail photo is retrieved. +- `-UserId` parameter specifies the user for which the thumbnail photo is retrieved. ## Parameters -### -ObjectId +### -UserId The object ID of the user for which the thumbnail photo is retrieved. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationExtensionProperty.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationExtensionProperty.md index f8821fbf3..f82004aca 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationExtensionProperty.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationExtensionProperty.md @@ -27,7 +27,7 @@ Creates an application extension property. ```powershell New-EntraApplicationExtensionProperty - -ObjectId + -ApplicationId -Name [-DataType ] [-TargetObjects ] @@ -46,7 +46,7 @@ The `New-EntraApplicationExtensionProperty` cmdlet creates an application extens Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId Name = 'NewAttribute' } @@ -61,7 +61,7 @@ DeletedDateTime Id AppDisplayName DataType Is This command creates an application extension property of the string type for the specified object. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-Name` parameter specifies the name of the extension property. ### Example 2: Create an extension property with data type parameter @@ -70,7 +70,7 @@ This command creates an application extension property of the string type for th Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId Name = 'NewAttribute' DataType = 'Boolean' } @@ -86,7 +86,7 @@ DeletedDateTime Id AppDisplayName DataType Is This command creates an application extension property of the specified data type for the specified object. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-Name` parameter specifies the name of the extension property. - `-DataType` parameter specifies the data type of the value the extension property can hold. @@ -98,7 +98,7 @@ $Application = Get-EntraApplication -SearchString '' $targets = New-Object System.Collections.Generic.List[System.String] $targets.Add('User') $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId Name = 'NewAttribute' TargetObjects = $targets } @@ -114,7 +114,7 @@ DeletedDateTime Id AppDisplayName DataType Is The example shows how to create an application extension property with the specified target objects for the specified object. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-Name` parameter specifies the name of the extension property. - `-TargetObjects` parameter specifies the Microsoft Graph resources that use the extension property. All values must be in PascalCase. @@ -159,14 +159,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies a unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationKeyCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationKeyCredential.md index 9c591ba6a..1eeb592e5 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationKeyCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationKeyCredential.md @@ -27,7 +27,7 @@ Creates a key credential for an application. ```powershell New-EntraApplicationKeyCredential - -ObjectId + -ApplicationId [-CustomKeyIdentifier ] [-Type ] [-Usage ] @@ -54,7 +54,7 @@ Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy $AppId = (Get-EntraApplication -Top 1).Objectid $params = @{ - ObjectId = $AppId + ApplicationId = $AppId CustomKeyIdentifier = 'EntraPowerShellKey' StartDate = '2024-03-21T14:14:14Z' Type = 'Symmetric' @@ -77,7 +77,7 @@ Value : {49, 50, 51} This example shows how to create an application key credential. -- `-ObjectId` Specifies a unique ID of an application +- `-ApplicationId` Specifies a unique ID of an application - `-CustomKeyIdentifier` Specifies a custom key ID. - `-StartDate` Specifies the time when the key becomes valid as a DateTime object. - `-Type` Specifies the type of the key. @@ -100,7 +100,7 @@ $base64Thumbprint = [System.Convert]::ToBase64String($bin) $keyid = [System.Guid]::NewGuid().ToString() $params = @{ - ObjectId = '22223333-cccc-4444-dddd-5555eeee6666' + ApplicationId = '22223333-cccc-4444-dddd-5555eeee6666' CustomKeyIdentifier = $base64Thumbprint Type = 'AsymmetricX509Cert' Usage = 'Verify' @@ -114,7 +114,7 @@ New-EntraApplicationKeyCredential @params This example shows how to create an application key credential. -- `-ObjectId` Specifies a unique ID of an application +- `-ApplicationId` Specifies a unique ID of an application - `-CustomKeyIdentifier` Specifies a custom key ID. - `-StartDate` Specifies the time when the key becomes valid as a DateTime object. - `-EndDate` Specifies the time when the key becomes invalid as a DateTime object. @@ -156,14 +156,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies a unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationPasswordCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationPasswordCredential.md index 975180c11..669aabe30 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationPasswordCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraApplicationPasswordCredential.md @@ -27,7 +27,7 @@ Creates a password credential for an application. ```powershell New-EntraApplicationPasswordCredential - -ObjectId + -ApplicationId [-CustomKeyIdentifier ] [-StartDate ] [-EndDate ] @@ -45,7 +45,7 @@ The `New-EntraApplicationPasswordCredential` cmdlet creates a password credentia ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "displayName eq ''" -New-EntraApplicationPasswordCredential -ObjectId $application.Id +New-EntraApplicationPasswordCredential -ApplicationId $application.Id ``` ```Output @@ -56,7 +56,7 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. ### Example 2: Create a password credential using CustomKeyIdentifier parameter @@ -64,7 +64,7 @@ This command creates new password credential for specified application. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "displayName eq ''" $params = @{ - ObjectId = $application.Id + ApplicationId = $application.Id CustomKeyIdentifier = '' } @@ -79,7 +79,7 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. - `-CustomKeyIdentifier` Speicifies unique binary identifier. ### Example 3: Create a password credential using StartDate parameter @@ -88,7 +88,7 @@ This command creates new password credential for specified application. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "displayName eq ''" $params = @{ - ObjectId = $application.Id + ApplicationId = $application.Id StartDate = (Get-Date).AddYears(0) CustomKeyIdentifier = '' } @@ -104,7 +104,7 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. - `-StartDate` Speicifies the date and time at which the password becomes valid. ### Example 4: Create a password credential using EndDate parameter @@ -113,7 +113,7 @@ This command creates new password credential for specified application. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "displayName eq ''" $params = @{ - ObjectId = $application.Id + ApplicationId = $application.Id EndDate = (Get-Date).AddYears(2) CustomKeyIdentifier = '' } @@ -129,19 +129,19 @@ CustomKeyIdentifier DisplayName EndDateTime Hint KeyId This command creates new password credential for specified application. -- `-ObjectId` Specifies the ID of a user. +- `-ApplicationId` Specifies the ID of an application. - `-EndDate` Speicifies The date and time at which the password expires. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraAttributeSet.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraAttributeSet.md index 49b2d2435..34d42b229 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraAttributeSet.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraAttributeSet.md @@ -26,7 +26,7 @@ Adds a new attribute set. ```powershell New-EntraAttributeSet - [-Id ] + [-AttributeSetId ] [-Description ] [-MaxAttributesPerSet ] [] @@ -45,7 +45,7 @@ In delegated scenarios with work or school accounts, the signed-in user must be ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' $params = @{ - Id = 'Testing' + AttributeSetId = 'NewCustomAttributeSet' Description = 'Attributes for engineering team' MaxAttributesPerSet = 10 } @@ -83,14 +83,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -AttributeSetId Name of the attribute set. Unique identifier for the attribute set within a tenant, up to 32 Unicode characters. It can't contain spaces or special characters, is case sensitive, and can't be changed later. Required. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: False Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraGroupAppRoleAssignment.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraGroupAppRoleAssignment.md index 874046c61..d323d6f0f 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraGroupAppRoleAssignment.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraGroupAppRoleAssignment.md @@ -27,9 +27,9 @@ Assign a group of users to an application role. ```powershell New-EntraGroupAppRoleAssignment - -ObjectId - -PrincipalId - -Id + -GroupId + -PrincipalId + -AppRoleId -ResourceId [] ``` @@ -47,7 +47,7 @@ Connect-Entra -Scopes 'AppRoleAssignment.ReadWrite.All' $appname = 'Box' $spo = Get-EntraServicePrincipal -Filter "Displayname eq '$appname'" $group = Get-EntraGroup -SearchString 'Contoso Team' -New-EntraGroupAppRoleAssignment -ObjectId $group.ObjectId -PrincipalId $group.ObjectId -ResourceId $spo.ObjectId -Id $spo.Approles[1].id +New-EntraGroupAppRoleAssignment -GroupId $group.ObjectId -PrincipalId $group.ObjectId -ResourceId $spo.ObjectId -AppRoleId $spo.Approles[1].id ``` ```Output @@ -59,21 +59,24 @@ DeletedDateTime Id AppRoleId This example demonstrates how to assign a group of users to an application role in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a group to which you're assigning the app role. -- `-PrincipalId` parameter specifies the ID of a group to which you're assigning the app role. -- `-ResourceId` parameter specifies the ID of a resource service Principal, which has defined the app role. -- `-Id` parameter specifies the ID of a appRole (defined on the resource service principal) to assign to the group. +- `GroupId`: The ID of the group to which you're assigning the app role. + +- `PrincipalId`: The ID of the group to which you're assigning the app role. + +- `ResourceId`: The ID of the resource service Principal, which has defined the app role. + +- `AppRoleId`: The ID of the appRole (defined on the resource service principal) to assign to the group. ## Parameters -### -Id +### -AppRoleId Specifies the ID of the app role (defined on the resource service principal) to assign. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named @@ -82,14 +85,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraServicePrincipalPasswordCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraServicePrincipalPasswordCredential.md index 6bd727064..4b36dca9c 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraServicePrincipalPasswordCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/New-EntraServicePrincipalPasswordCredential.md @@ -27,7 +27,7 @@ Creates a password credential for a service principal. ```powershell New-EntraServicePrincipalPasswordCredential - -ObjectId + -ServicePrincipalId [-EndDate ] [-StartDate ] [] @@ -45,7 +45,7 @@ The `New-EntraServicePrincipalPasswordCredential` cmdlet creates a password cred Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" $Params = @{ - ObjectId = $ServicePrincipal.ObjectId + ServicePrincipalId = $ServicePrincipal.ObjectId StartDate = '2024-04-21T14:14:14Z' } New-EntraServicePrincipalPasswordCredential @Params @@ -67,7 +67,7 @@ EndDate : 08-08-2026 10:30:00 This example demonstrates how to create a password credential with StartDate for a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-StarteDate` parameter specifies the date and time at which the password becomes valid. ### Example 2: Create a password credential with EndtDate @@ -76,7 +76,7 @@ This example demonstrates how to create a password credential with StartDate for Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" $Params = @{ - ObjectId = $ServicePrincipal.ObjectId + ServicePrincipalId = $ServicePrincipal.ObjectId EndDate = '2030-03-21T14:14:14Z' } New-EntraServicePrincipalPasswordCredential @Params @@ -98,7 +98,7 @@ EndDate : 08-08-2026 10:30:00 This example demonstrates how to create a password credential with EndDate for a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-EndDate` parameter specifies the date and time at which the password expires represented using ISO 8601 format and is always in UTC time. ## Parameters @@ -119,14 +119,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of the service principal. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnit.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnit.md index 6659339b0..667a07b71 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnit.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnit.md @@ -26,13 +26,13 @@ Removes an administrative unit. ```powershell Remove-EntraAdministrativeUnit - -ObjectId + -AdministrativeUnitId [] ``` ## Description -The `Remove-EntraAdministrativeUnit` cmdlet removes an administrative unit from Microsoft Entra ID. Specify `ObjectId` parameter to delete an administrative unit. +The `Remove-EntraAdministrativeUnit` cmdlet removes an administrative unit from Microsoft Entra ID. Specify `AdministrativeUnitId` parameter to delete an administrative unit. To delete an administrative unit, the calling principal must have at least the Privileged Role Administrator role in Microsoft Entra. @@ -48,18 +48,18 @@ Remove-EntraAdministrativeUnit -ObjectId $AdministrativeUnit.ObjectId This command removes the specified administrative unit from Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnitMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnitMember.md index b925dc3a6..f0c10bc69 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnitMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraAdministrativeUnitMember.md @@ -25,14 +25,14 @@ Removes an administrative unit member. ```powershell Remove-EntraAdministrativeUnitMember - -ObjectId + -AdministrativeUnitId -MemberId [] ``` ## Description -The `Remove-EntraAdministrativeUnitMember` cmdlet removes an administrative unit member in Microsoft Entra ID. Specify `ObjectId` and `MemberId` to remove an administrative unit member. +The `Remove-EntraAdministrativeUnitMember` cmdlet removes an administrative unit member in Microsoft Entra ID. Specify `AdministrativeUnitId` and `MemberId` to remove an administrative unit member. To remove a member from an administrative unit, the calling principal must have at least the Privileged Role Administrator role in Microsoft Entra. @@ -44,7 +44,7 @@ To remove a member from an administrative unit, the calling principal must have Connect-Entra -Scopes 'AdministrativeUnit.Read.All' $AdministrativeUnit = Get-EntraBetaAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId MemberId = 'eeeeeeee-4444-5555-6666-ffffffffffff' } Remove-EntraAdministrativeUnitMember @params @@ -52,7 +52,7 @@ Remove-EntraAdministrativeUnitMember @params This command removes a specified member (user or group) from a specified administrative unit. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `-MemberId` parameter specifies the ID of the administrative unit member. ## Parameters @@ -73,14 +73,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplication.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplication.md index 0d5d84841..974b7a659 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplication.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplication.md @@ -25,13 +25,13 @@ Deletes an application object. ```powershell Remove-EntraApplication - -ObjectId + -ApplicationId [] ``` ## Description -The `Remove-EntraApplication` cmdlet deletes an application object identified by ObjectId. Specify the `ObjectId` parameter to delete an application object. +The `Remove-EntraApplication` cmdlet deletes an application object identified by ApplicationId. Specify the `ApplicationId` parameter to delete an application object. ## Examples @@ -40,21 +40,21 @@ The `Remove-EntraApplication` cmdlet deletes an application object identified by ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' $Application = Get-EntraApplication -SearchString '' -Remove-EntraApplication -ObjectId $Application.ObjectId +Remove-EntraApplication -ApplicationId $Application.ObjectId ``` This example demonstrates how to delete an application object. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationExtensionProperty.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationExtensionProperty.md index 31a96e6fd..109fe85fc 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationExtensionProperty.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationExtensionProperty.md @@ -27,7 +27,7 @@ Removes an application extension property. ```powershell Remove-EntraApplicationExtensionProperty -ExtensionPropertyId - -ObjectId + -ApplicationId [] ``` @@ -43,7 +43,7 @@ The `Remove-EntraApplicationExtensionProperty` cmdlet removes an application ext Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $Application = Get-EntraApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId ExtensionPropertyId = 'cccc2222-dd33-4444-55ee-666666ffffff' } @@ -52,7 +52,7 @@ Remove-EntraApplicationExtensionProperty @params This example removes the extension property that has the specified ID from an application in Microsoft Entra ID. -- `-ObjectId` parameter specifies the unique identifier of an application. +- `-ApplicationId` parameter specifies the unique identifier of an application. - `-ExtensionPropertyId` parameter specifies the unique identifier of the extension property to remove. ## Parameters @@ -73,14 +73,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationKeyCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationKeyCredential.md index 6b84a9663..0e79038fc 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationKeyCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationKeyCredential.md @@ -26,7 +26,7 @@ Removes a key credential from an application. ```powershell Remove-EntraApplicationKeyCredential - -ObjectId + -ApplicationId -KeyId [] ``` @@ -45,7 +45,7 @@ An application can use this command along with `New-EntraApplicationKeyCredentia Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "displayName eq ''" $params = @{ - ObjectId = $application.Id + ApplicationId = $application.Id KeyId = 'aaaaaaaa-0b0b-1c1c-2d2d-333333333333' } @@ -54,7 +54,7 @@ Remove-EntraApplicationKeyCredential @params This command removes the specified key credential from the specified application. -- `-ObjectId` Specifies the ID of an application. +- `-ApplicationId` Specifies the ID of an application. - `-KeyId` Specifies a custom key ID. Use `Get-EntraApplicationKeyCredential` to get the keyId details. ## Parameters @@ -75,14 +75,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies a unique ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationOwner.md index 08dc43de7..474f34044 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationOwner.md @@ -27,7 +27,7 @@ Removes an owner from an application. ```powershell Remove-EntraApplicationOwner -OwnerId - -ObjectId + -ApplicationId [] ``` @@ -43,7 +43,7 @@ The `Remove-EntraApplicationOwner` cmdlet removes an owner from an application i Connect-Entra -Scopes 'Application.ReadWrite.All' $Application = Get-EntraApplication -SearchString '' $params = @{ - ObjectId = $Application.ObjectId + ApplicationId = $Application.ObjectId OwnerId = 'bbbbbbbb-1111-2222-3333-cccccccccccc' } @@ -52,19 +52,19 @@ Remove-EntraApplicationOwner @params This example removes the specified owner from the specified application. You can use the command `Get-EntraApplication` to get application Id. -- `-ObjectId` parameter specifies the the unique identifier of a application. +- `-ApplicationId` parameter specifies the the unique identifier of a application. - `-OwnerId` parameter specifies the ID of the owner. ## Parameters -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationPasswordCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationPasswordCredential.md index 9b69c3995..f64e20627 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationPasswordCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraApplicationPasswordCredential.md @@ -26,7 +26,7 @@ Removes a password credential from an application. ```powershell Remove-EntraApplicationPasswordCredential - -ObjectId + -ApplicationId -KeyId [] ``` @@ -42,13 +42,13 @@ The `Remove-EntraApplicationPasswordCredential` cmdlet removes a password creden ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "displayName eq 'Contoso Helpdesk App'" -$KeyIDs = Get-EntraApplicationPasswordCredential -ObjectId $application.Id -Remove-EntraApplicationPasswordCredential -ObjectId $application.Id -KeyId $KeyIds[0].KeyId +$KeyIDs = Get-EntraApplicationPasswordCredential -ApplicationId $application.Id +Remove-EntraApplicationPasswordCredential -ApplicationId $application.Id -KeyId $KeyIds[0].KeyId ``` This example demonstrates how to remove the password credential for an application. -- `ObjectId` Specifies the ID of the application. Use `Get-EntraApplication` to get application ObjectId value. +- `ApplicationId` Specifies the ID of the application. Use `Get-EntraApplication` to get application ObjectId value. - `KeyId` Specifies the ID of the password credential. Use `Get-EntraApplicationPasswordCredential` to retrieve a specific credential details. ## Parameters @@ -69,14 +69,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of the application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraContact.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraContact.md index 6cbd22961..44d5764c5 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraContact.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraContact.md @@ -26,7 +26,7 @@ Removes a contact. ```powershell Remove-EntraContact - -ObjectId + -OrgContactId [] ``` @@ -41,21 +41,21 @@ The `Remove-EntraContact` removes a contact from Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'OrgContact.Read.All' $Contact = Get-EntraContact -Filter "DisplayName eq 'Contoso Contact'" -Remove-EntraContact -ObjectId $Contact.ObjectId +Remove-EntraContact -OrgContactId $Contact.ObjectId ``` The example shows how to remove a contact. ## Parameters -### -ObjectId +### -OrgContactId Specifies the object ID of a contact in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeletedDirectoryObject.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeletedDirectoryObject.md index 8027629db..477009401 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeletedDirectoryObject.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeletedDirectoryObject.md @@ -27,7 +27,7 @@ Permanently delete a previously deleted directory object. ```powershell Remove-EntraDeletedDirectoryObject - -Id + -DirectoryObjectId [] ``` @@ -50,23 +50,23 @@ For delegated scenarios, the calling user needs to have at least one of the foll ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Group.ReadWrite.All','Application.ReadWrite.All','User.ReadWrite.All' -Remove-EntraDeletedDirectoryObject -Id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' +Remove-EntraDeletedDirectoryObject -DirectoryObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' ``` -This example demonstrates how to permanently delete a previously deleted directory object by Id. +This example demonstrates how to permanently delete a previously deleted directory object by DirectoryObjectId. -- `-Id` parameter specifies the Id of the directory object that is permanently deleted. +- `-DirectoryObjectId` parameter specifies the Id of the directory object that is permanently deleted. ## Parameters -### -Id +### -DirectoryObjectId -The Id of the directory object that is permanently deleted. +The DirectoryObjectId of the directory object that is permanently deleted. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDevice.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDevice.md index fdd9641d5..ea66e8884 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDevice.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDevice.md @@ -26,7 +26,7 @@ Deletes a device. ```powershell Remove-EntraDevice - -ObjectId + -DeviceId [] ``` @@ -43,21 +43,21 @@ The calling user must be in one of the following Microsoft Entra roles: Intune A ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' $Device = Get-EntraDevice -Filter "DisplayName eq 'Woodgrove Desktop'" -Remove-EntraDevice -ObjectId $Device.ObjectId +Remove-EntraDevice -DeviceId $Device.ObjectId ``` This command removes the specified device. ## Parameters -### -ObjectId +### -DeviceId Specifies the object ID of a device in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredOwner.md index 99d0e0cdf..531f2187e 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredOwner.md @@ -27,7 +27,7 @@ Removes the registered owner of a device. ```powershell Remove-EntraDeviceRegisteredOwner -OwnerId - -ObjectId + -DeviceId [] ``` @@ -42,22 +42,22 @@ The `Remove-EntraDeviceRegisteredOwner` cmdlet removes the registered owner of a ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All' $Device = Get-EntraDevice -Top 1 -$Owner = Get-EntraDeviceRegisteredOwner -ObjectId $Device.ObjectId -Remove-EntraDeviceRegisteredOwner -ObjectId $Device.ObjectId -OwnerId $Owner.ObjectId +$Owner = Get-EntraDeviceRegisteredOwner -DeviceId $Device.ObjectId +Remove-EntraDeviceRegisteredOwner -DeviceId $Device.ObjectId -OwnerId $Owner.ObjectId ``` This examples shows how to remove the owner of a device. ## Parameters -### -ObjectId +### -DeviceId Specifies an object ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredUser.md index 90f16fbec..c608af39f 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDeviceRegisteredUser.md @@ -26,7 +26,7 @@ Removes a registered user from a device. ```powershell Remove-EntraDeviceRegisteredUser - -ObjectId + -DeviceId -UserId [] ``` @@ -42,22 +42,22 @@ The `Remove-EntraDeviceRegisteredUser` cmdlet removes a registered user from a M ```Powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All' $Device = Get-EntraDevice -Top 1 -$User = Get-EntraDeviceRegisteredUser -ObjectId $Device.ObjectId -Remove-EntraDeviceRegisteredUser -ObjectId $Device.ObjectId -OwnerId $Owner.ObjectId +$User = Get-EntraDeviceRegisteredUser -DeviceId $Device.ObjectId +Remove-EntraDeviceRegisteredUser -DeviceId $Device.ObjectId -UserId $User.ObjectId ``` This example shows how to remove the registered user from device. ## Parameters -### -ObjectId +### -DeviceId Specifies the ID of an object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleAssignment.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleAssignment.md index cb54592f6..356342876 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleAssignment.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleAssignment.md @@ -26,7 +26,7 @@ Delete a Microsoft Entra ID roleAssignment. ```powershell Remove-EntraDirectoryRoleAssignment - -Id + -UnifiedRoleAssignmentId [] ``` @@ -40,7 +40,7 @@ The `Remove-EntraDirectoryRoleAssignment` cmdlet removes a role assignment from ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory','EntitlementManagement.ReadWrite.All' -Remove-EntraDirectoryRoleAssignment -Id 'Y1vFBcN4i0e3ngdNDocmngJAWGnAbFVAnJQyBBLv1lM-1' +Remove-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId Y1vFBcN4i0e3ngdNDocmngJAWGnAbFVAnJQyBBLv1lM-1 ``` This example removes the specified role assignment from Microsoft Entra ID. @@ -49,14 +49,14 @@ This example removes the specified role assignment from Microsoft Entra ID. ## Parameters -### -Id +### -UnifiedRoleAssignmentId The unique identifier of an object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: 0 diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleDefinition.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleDefinition.md index c92a9e2ce..cd0fcae68 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleDefinition.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleDefinition.md @@ -27,7 +27,7 @@ Delete a Microsoft Entra ID Directory roleDefinition object. ```powershell Remove-EntraDirectoryRoleDefinition - -Id + -UnifiedRoleDefinitionId [] ``` @@ -43,24 +43,23 @@ You can't delete built-in roles. This feature requires a Microsoft Entra ID P1 o ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' -$DirectoryRoleDefinition = Get-EntraDirectoryRoleDefinition -Filter "DisplayName eq 'Guest Inviter'" -Remove-EntraDirectoryRoleDefinition -Id $DirectoryRoleDefinition.ObjectId +Remove-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1 ``` This example demonstrates how to remove the specified role definition from Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. ## Parameters -### -Id +### -UnifiedRoleDefinitionId The unique identifier of an object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: 0 diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleMember.md index e2ef513a2..7d0f7f9ff 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraDirectoryRoleMember.md @@ -26,8 +26,8 @@ Removes a member of a directory role. ```powershell Remove-EntraDirectoryRoleMember - -ObjectId - -MemberId + -DirectoryRoleId + -MemberId [] ``` @@ -42,7 +42,7 @@ The `Remove-EntraDirectoryRoleMember` cmdlet removes a member from a directory r ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $params = @{ - ObjectId = 'aaaabbbb-0000-cccc-1111-dddd2222eeee' + DirectoryRoleId = 'aaaabbbb-0000-cccc-1111-dddd2222eeee' MemberId = '11bb11bb-cc22-dd33-ee44-55ff55ff55ff' } @@ -51,8 +51,9 @@ Remove-EntraDirectoryRoleMember @params This example removes the specified member from the specified role. -- `-ObjectId` parameter specifies the object ID of the directory role. -- `-MemberId` parameter specifies the object ID of the role member to removed. +- `-DirectoryRoleId` - specifies the unique identifier (ObjectId) of the directory role from which the member will be removed. + +- `-MemberId` - specifies the unique identifier (MemberId) of the member (user, group, or service principal) that is to be removed from the specified directory role. ## Parameters @@ -72,14 +73,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -DirectoryRoleId Specifies the object ID of a directory role in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroup.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroup.md index 225fa54a1..e1d0aef90 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroup.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroup.md @@ -25,13 +25,13 @@ Removes a group. ```powershell Remove-EntraGroup - -ObjectId + -GroupId [] ``` ## Description -The `Remove-EntraGroup` cmdlet removes a group from Microsoft Entra ID. Specify the `ObjectId` parameter removes a group. +The `Remove-EntraGroup` cmdlet removes a group from Microsoft Entra ID. Specify the `GroupId` parameter removes a group. Unified Group can be restored withing 30 days after deletion using the `Restore-EntraBetaDeletedDirectoryObject` cmdlet. Security groups can't be restored after deletion. @@ -49,23 +49,23 @@ The following conditions apply for apps to delete role-assignable groups: ```powershell Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -Remove-EntraGroup -ObjectId $group.Id +Remove-EntraGroup -GroupId $group.Id ``` This example demonstrates how to remove a group in Microsoft Entra ID. -- `ObjectId` parameter specifies the group ID . +- `GroupId` parameter specifies the group ID . ## Parameters -### -ObjectId +### -GroupId Specifies the object ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupAppRoleAssignment.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupAppRoleAssignment.md index 3e5dab8e6..8066aa68b 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupAppRoleAssignment.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupAppRoleAssignment.md @@ -25,9 +25,9 @@ Delete a group application role assignment. ```powershell Remove-EntraGroupAppRoleAssignment - -AppRoleAssignmentId - -ObjectId - [] + -AppRoleAssignmentId + -GroupId +[] ``` ## Description @@ -41,17 +41,12 @@ The `Remove-EntraGroupAppRoleAssignment` cmdlet removes a group application role ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -$params = @{ - ObjectId = $group.ObjectId - AppRoleAssignmentId = 'CcDdEeFfGgHhIiJjKkLlMmNnOoPpQq3' -} -Remove-EntraGroupAppRoleAssignment @params +Remove-EntraGroupAppRoleAssignment -GroupId $group.Id -AppRoleAssignmentId 'CcDdEeFfGgHhIiJjKkLlMmNnOoPpQq3' ``` This example demonstrates how to remove the specified group application role assignment. - -- `-ObjectId` parameter specifies the object ID of a group. -- `-AppRoleAssignmentId` parameter specifies the object ID of a group application role assignment. +GroupId - Specifies the object ID of a group. +AppRoleAssignmentId - Specifies the object ID of the group application role assignment. ## Parameters @@ -71,14 +66,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the object ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupLifecyclePolicy.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupLifecyclePolicy.md index 5f4c13211..b4fc2d8ce 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupLifecyclePolicy.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupLifecyclePolicy.md @@ -27,7 +27,7 @@ Deletes a groupLifecyclePolicies object ```powershell Remove-EntraGroupLifecyclePolicy - -Id + -GroupLifecyclePolicyId [] ``` @@ -41,21 +41,21 @@ The `Remove-EntraGroupLifecyclePolicy` command deletes a groupLifecyclePolicies ```powershell Connect-Entra -Scopes 'Directory.ReadWrite.All' -Remove-EntraGroupLifecyclePolicy -Id '1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5' +Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId '1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5' ``` This example demonstrates how to delete the groupLifecyclePolicies object that has the specified ID. You can use `Get-EntraGroupLifecyclePolicy` to get Id details. ## Parameters -### -Id +### -GroupLifecyclePolicyId Specifies the ID of the groupLifecyclePolicies object that this cmdlet removes. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupMember.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupMember.md index 339cfe5b1..690d5fac8 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupMember.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupMember.md @@ -26,7 +26,7 @@ Removes a member from a group. ```powershell Remove-EntraGroupMember - -ObjectId + -GroupId -MemberId [] ``` @@ -42,15 +42,14 @@ The `Remove-EntraGroupMember` cmdlet removes a member from a group in Microsoft ```powershell Connect-Entra -Scopes 'GroupMember.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -$params = @{ - ObjectId = $group.ObjectId - MemberId = 'zzzzzzzz-6666-8888-9999-pppppppppppp' -} - -Remove-EntraGroupMember @params +Remove-EntraGroupMember -GroupId $group.Id -MemberId 'zzzzzzzz-6666-8888-9999-pppppppppppp' ``` -This example demonstrates how to remove a member from a group in Microsoft Entra ID. +This command removes the specified member from the specified group. + +GroupId - Specifies the object ID of a group in Microsoft Entra ID. + +MemberId - Specifies the ID of the member to remove. ## Parameters @@ -70,14 +69,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -GroupId Specifies the object ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupOwner.md index 8eab50ba3..8d3a14308 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraGroupOwner.md @@ -26,13 +26,13 @@ Removes an owner from a group. ```powershell Remove-EntraGroupOwner -OwnerId - -ObjectId + -GroupId [] ``` ## Description -The `Remove-EntraGroupOwner` cmdlet removes an owner from a group in Microsoft Entra ID. Specify the `ObjectId` and `OwnerId` parameters to remove an owner from a group. +The `Remove-EntraGroupOwner` cmdlet removes an owner from a group in Microsoft Entra ID. Specify the `GroupId` and `OwnerId` parameters to remove an owner from a group. ## Examples @@ -41,30 +41,25 @@ The `Remove-EntraGroupOwner` cmdlet removes an owner from a group in Microsoft E ```powershell Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" -$params = @{ - ObjectId = $group.ObjectId - OwnerId = 'xxxxxxxx-8888-5555-9999-bbbbbbbbbbbb' -} - -Remove-EntraGroupOwner @params +Remove-EntraGroupOwner -GroupId $group.Id -OwnerId 'xxxxxxxx-8888-5555-9999-bbbbbbbbbbbb' ``` This example demonstrates how to remove an owner from a group in Microsoft Entra ID. -- `ObjectId` specifies the ID of a group in Microsoft Entra ID. +GroupId - Specifies the ID of a group in Microsoft Entra ID. - `OwnerId` specifies the ID of an owner. ## Parameters -### -ObjectId +### -GroupId Specifies the ID of a group in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraIdentityProvider.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraIdentityProvider.md index 52579e066..4581d7d88 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraIdentityProvider.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraIdentityProvider.md @@ -26,7 +26,7 @@ This cmdlet is used to delete an identity provider in the directory. ```powershell Remove-EntraIdentityProvider - -Id + -IdentityProviderBaseId [] ``` @@ -44,23 +44,23 @@ The work or school account needs to belong to at least the External Identity Pro ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' -Remove-EntraIdentityProvider -Id 'LinkedIn-OAUTH' +Remove-EntraIdentityProvider -IdentityProviderBaseId 'LinkedIn-OAUTH' ``` This command demonstrates how to remove the specified identity provider. -- `-Id` parameter specifies the unique identifier of the identity provider. +- `-IdentityProviderBaseId` parameter specifies the unique identifier of the identity provider. ## Parameters -### -Id +### -IdentityProviderBaseId The unique identifier for an identity provider. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraLifecyclePolicyGroup.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraLifecyclePolicyGroup.md index be1231965..3f1916664 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraLifecyclePolicyGroup.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraLifecyclePolicyGroup.md @@ -28,7 +28,7 @@ Removes a group from a lifecycle policy. ```powershell Remove-EntraLifecyclePolicyGroup -GroupId - -Id + -GroupLifecyclePolicyId [] ``` @@ -45,7 +45,7 @@ Connect-Entra -Scopes 'Directory.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'Office365 group'" $policy = Get-EntraLifecyclePolicyGroup -Id $group.ObjectId $params = @{ - Id = $policy.Id + GroupLifecyclePolicyId = $policy.Id GroupId = $group.ObjectId } Remove-EntraLifecyclePolicyGroup @params @@ -59,7 +59,7 @@ True This example demonstrates how to remove a group from a lifecycle policy in Microsoft Entra ID with specified Id and groupId. -- `-Id` parameter specifies the lifecycle policy object ID. +- `-GroupLifecyclePolicyId` parameter specifies the lifecycle policy object ID. - `-GroupId` parameter specifies the ID of Office365 group. ## Parameters @@ -80,14 +80,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupLifecyclePolicyId Specifies the ID of the lifecycle policy object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraScopedRoleMembership.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraScopedRoleMembership.md index f33bff875..c4677b7e8 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraScopedRoleMembership.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraScopedRoleMembership.md @@ -27,14 +27,14 @@ Removes a scoped role membership. ```powershell Remove-EntraScopedRoleMembership - -ObjectId + -AdministrativeUnitId -ScopedRoleMembershipId [] ``` ## Description -The `Remove-EntraScopedRoleMembership` cmdlet removes a scoped role membership from Microsoft Entra ID. Specify `ObjectId` and `ScopedRoleMembershipId` parameter to remove a scoped role membership. +The `Remove-EntraScopedRoleMembership` cmdlet removes a scoped role membership from Microsoft Entra ID. Specify `AdministrativeUnitId` and `ScopedRoleMembershipId` parameter to remove a scoped role membership. ## Examples @@ -44,7 +44,7 @@ The `Remove-EntraScopedRoleMembership` cmdlet removes a scoped role membership f Connect-Entra -Scopes 'RoleManagement.Read.Directory' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.AdministrativeUnitId ScopedRoleMembershipId = 'dddddddddddd-bbbb-aaaa-bbbb-cccccccccccc' } Remove-EntraScopedRoleMembership @params @@ -52,19 +52,19 @@ Remove-EntraScopedRoleMembership @params This cmdlet removes a specific scoped role membership from Microsoft Entra ID. You can use the command `Get-EntraAdministrativeUnit` to get administrative unit Id. -- `-ObjectId` parameter specifies the ID of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the ID of an administrative unit. - `-ScopedRoleMembershipId` parameter specifies the ID of the scoped role membership to remove. To obtain the details of a scoped role membership, you can use the `Get-EntraScopedRoleMembership` command. ## Parameters -### -ObjectId +### -AdministrativeUnitId Specifies the ID of an administrative unit object. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipal.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipal.md index f5c7ea6c2..be2e2d827 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipal.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipal.md @@ -27,7 +27,7 @@ Removes a service principal. ```powershell Remove-EntraServicePrincipal - -ObjectId + -ServicePrincipalId [] ``` @@ -42,23 +42,23 @@ The `Remove-EntraServicePrincipal` cmdlet removes a service principal in Microso ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -Remove-EntraServicePrincipal -ObjectId $servicePrincipal.ObjectId +Remove-EntraServicePrincipal -ServicePrincipalId $servicePrincipal.ObjectId ``` This example demonstrates how to remove a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalAppRoleAssignment.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalAppRoleAssignment.md index 0a205738f..1b82b8dd3 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalAppRoleAssignment.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalAppRoleAssignment.md @@ -27,8 +27,8 @@ Removes a service principal application role assignment. ```powershell Remove-EntraServicePrincipalAppRoleAssignment - -AppRoleAssignmentId - -ObjectId + -AppRoleAssignmentId + -ServicePrincipalId [] ``` @@ -56,18 +56,12 @@ For delegated scenarios, the calling user needs at least one of the following Mi ```powershell Connect-Entra -Scopes 'AppRoleAssignment.ReadWrite.All' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -$params = @{ - ObjectId = $servicePrincipal.ObjectId - AppRoleAssignmentId = '2bbbbbb2-3cc3-4dd4-5ee5-6ffffffffff6' -} - -Remove-EntraServicePrincipalAppRoleAssignment @params +Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId $servicePrincipal.Id -AppRoleAssignmentId '2bbbbbb2-3cc3-4dd4-5ee5-6ffffffffff6' ``` This example demonstrates how to remove a service principal application role assignment in Microsoft Entra ID. -- `-ObjectId` - specifies the unique identifier (Object ID) of the service principal or user from which you want to remove an app role assignment. - +- `-ServicePrincipalId` - specifies the unique identifier (Object ID) of the service principal or user from which you want to remove an app role assignment. - `-AppRoleAssignmentId` - specifies the unique identifier (ID) of the app role assignment that you want to remove. The value `2bbbbbb2-3cc3-4dd4-5ee5-6ffffffffff6` represents the ID of the specific app role assignment to be removed. ## Parameters @@ -88,14 +82,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalKeyCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalKeyCredential.md index 9e0e60ad0..4aeee9df7 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalKeyCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalKeyCredential.md @@ -26,7 +26,7 @@ Removes a key credential from a service principal. ```powershell Remove-EntraServicePrincipalKeyCredential - -ObjectId + -ServicePrincipalId -KeyId [] ``` @@ -43,8 +43,8 @@ The Remove-EntraServicePrincipalKeyCredential cmdlet removes a key credential fr Connect-Entra -Scopes 'Application.ReadWrite.All' #Delegated Permission Connect-Entra -Scopes 'Application.ReadWrite.OwnedBy' #Application Permission $SPObjectID = (Get-EntraServicePrincipal -SearchString 'Entra Multi-Factor Auth Client').ObjectID -Get-EntraServicePrincipalKeyCredential -ObjectId $SPObjectID -Remove-EntraServicePrincipalKeyCredential -ObjectID $SPObjectID -KeyId +Get-EntraServicePrincipalKeyCredential -ServicePrincipalId $SPObjectID +Remove-EntraServicePrincipalKeyCredential -ServicePrincipalId $SPObjectID -KeyId ``` This example demonstrates how to remove a key credential from a service principal in Microsoft Entra ID. @@ -71,14 +71,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalOwner.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalOwner.md index 9a6ece57b..6bc57c180 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalOwner.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalOwner.md @@ -27,7 +27,7 @@ Removes an owner from a service principal. ```powershell Remove-EntraServicePrincipalOwner -OwnerId - -ObjectId + -ServicePrincipalId [] ``` @@ -42,10 +42,10 @@ The `Remove-EntraServicePrincipalOwner` cmdlet removes an owner from a service p ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" -$owner = Get-EntraUser -ObjectId 'SawyerM@contoso.com' +$owner = Get-EntraUser -UserId 'SawyerM@contoso.com' $params= @{ - ObjectId = $servicePrincipal.Id + ServicePrincipalId = $servicePrincipal.Id OwnerId = $owner.Id } Remove-EntraServicePrincipalOwner @params @@ -53,19 +53,19 @@ Remove-EntraServicePrincipalOwner @params This example demonstrates how to remove an owner from a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the service principal Id. +- `-ServicePrincipalId` parameter specifies the service principal Id. - `-OwnerId` parameter specifies the service principal owner Id. ## Parameters -### -ObjectId +### -ServicePrincipalId Specifies the ID of a service principal. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalPasswordCredential.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalPasswordCredential.md index 02defd606..6706517f4 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalPasswordCredential.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraServicePrincipalPasswordCredential.md @@ -25,7 +25,7 @@ Removes a password credential from a service principal. ```powershell Remove-EntraServicePrincipalPasswordCredential - -ObjectId + -ServicePrincipalId -KeyId [] ``` @@ -42,15 +42,15 @@ The `Remove-EntraServicePrincipalPasswordCredential` cmdlet removes a password c Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $ServicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq ''" $Params = @{ - ObjectId = $ServicePrincipal.ObjectId - KeyId = 'bbbbbbbb-1c1c-2d2d-3e3e-444444444444' + ServicePrincipalId = $ServicePrincipal.ObjectId + KeyId = 'aaaaaaaa-0b0b-1c1c-2d2d-333333333333' } Remove-EntraServicePrincipalPasswordCredential @Params ``` This example demonstrates how to remove a password credential from a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ObjectId of a specified Service Principal Password Credential. +- `-ServicePrincipalId` parameter specifies the ServicePrincipalId of a specified Service Principal Password Credential. - `-KeyId` parameter specifies the unique identifier of a Password Credential. ## Parameters @@ -71,14 +71,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUser.md index 484849664..43290dbaa 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUser.md @@ -26,13 +26,13 @@ Removes a user. ```powershell Remove-EntraUser - -ObjectId + -UserId [] ``` ## Description -The Remove-EntraUser cmdlet removes a user in Microsoft Entra ID. Specify the `ObjectId` parameter to remove the specified user in Microsoft Entra ID. +The `Remove-EntraUser` cmdlet removes a user in Microsoft Entra ID. Specify the `UserId` parameter to remove the specified user in Microsoft Entra ID. The calling user must be assigned at least one of the following Microsoft Entra roles: @@ -46,21 +46,21 @@ The calling user must be assigned at least one of the following Microsoft Entra ```powershell Connect-Entra -Scopes 'User.ReadWrite.All' -Remove-EntraUser -ObjectId 'SawyerM@Contoso.com' +Remove-EntraUser -UserId 'SawyerM@Contoso.com' ``` This command removes the specified user in Microsoft Entra ID. ## Parameters -### -ObjectId +### -UserId -Specifies the ID of a user (as a UPN or ObjectId) in Microsoft Entra ID. +Specifies the ID of a user (as a UPN or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUserManager.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUserManager.md index cd8055b06..3c4d6d988 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUserManager.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Remove-EntraUserManager.md @@ -26,13 +26,12 @@ Removes a user's manager. ```powershell Remove-EntraUserManager - -ObjectId - [] + -UserId ``` ## Description -The `Remove-EntraUserManager` cmdlet removes a user's manager in Microsoft Entra ID. Specify the `ObjectId` parameter to remove the manager for a user in Microsoft Entra ID. +The `Remove-EntraUserManager` cmdlet removes a user's manager in Microsoft Entra ID. Specify the `UserId` parameter to remove the manager for a user in Microsoft Entra ID. ## Examples @@ -40,8 +39,8 @@ The `Remove-EntraUserManager` cmdlet removes a user's manager in Microsoft Entra ```powershell Connect-Entra -Scopes 'User.ReadWrite.All' -$User = Get-EntraUser -ObjectId 'SawyerM@Contoso.com' -Remove-EntraUserManager -ObjectId $User.ObjectId +$User = Get-EntraUser -UserId 'SawyerM@Contoso.com' +Remove-EntraUserManager -UserId $User.ObjectId ``` This example shows how to remove a user's manager. @@ -50,14 +49,14 @@ You can use `Get-EntraUser` command to get the user's details. ## Parameters -### -ObjectId +### -UserId Specifies the ID of a user (as a User Principle Name or ObjectId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Revoke-EntraUserAllRefreshToken.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Revoke-EntraUserAllRefreshToken.md index 5ae2a38e9..c6dfb4904 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Revoke-EntraUserAllRefreshToken.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Revoke-EntraUserAllRefreshToken.md @@ -24,7 +24,7 @@ Invalidates the refresh tokens issued to applications for a user. ```powershell Revoke-EntraUserAllRefreshToken - -ObjectId + -UserId [] ``` @@ -44,7 +44,7 @@ This operation is usually performed by the user or an administrator if the user' ```powershell Connect-Entra -Scopes 'User.RevokeSessions.All' -Revoke-EntraUserAllRefreshToken -ObjectId 'SawyerM@contoso.com' +Revoke-EntraUserAllRefreshToken -UserId 'SawyerM@contoso.com' ``` ```Output @@ -55,18 +55,18 @@ True This example demonstrates how to revoke the tokens for the specified user. -- `-ObjectId` parameter specifies the unique identifier of a user. +- `-UserId` parameter specifies the unique identifier of a user. ## Parameters -### -ObjectId +### -UserId Specifies the unique ID of a user. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAdministrativeUnit.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAdministrativeUnit.md index 834fb8e15..08ce3f467 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAdministrativeUnit.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAdministrativeUnit.md @@ -26,7 +26,7 @@ Updates an administrative unit. ```powershell Set-EntraAdministrativeUnit - -ObjectId + -AdministrativeUnitId [-Description ] [-DisplayName ] [] @@ -34,7 +34,7 @@ Set-EntraAdministrativeUnit ## Description -The `Set-EntraAdministrativeUnit` cmdlet updates an administrative unit in Microsoft Entra ID. Specify `Id` parameter to update a specific administrative unit. +The `Set-EntraAdministrativeUnit` cmdlet updates an administrative unit in Microsoft Entra ID. Specify `AdministrativeUnitId` parameter to update a specific administrative unit. In delegated scenarios, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with the `microsoft.directory/administrativeUnits/allProperties/allTasks` permission. @@ -48,7 +48,7 @@ The Privileged Role Administrator is the least privileged role required for this Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId DisplayName = 'UpdatedAU' } Set-EntraAdministrativeUnit @params @@ -56,7 +56,7 @@ Set-EntraAdministrativeUnit @params This Command update DisplayName of specific administrative unit. -- `-ObjectId` parameter specifies the Id of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the Id of an administrative unit. - `-DisplayName` parameter specifies the display name for the administrative unit. ### Example 2: Update Description @@ -65,7 +65,7 @@ This Command update DisplayName of specific administrative unit. Connect-Entra -Scopes 'AdministrativeUnit.ReadWrite.All' $AdministrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq ''" $params = @{ - ObjectId = $AdministrativeUnit.ObjectId + AdministrativeUnitId = $AdministrativeUnit.ObjectId Description = 'Updated AU Description' } Set-EntraAdministrativeUnit @params @@ -73,7 +73,7 @@ Set-EntraAdministrativeUnit @params This example shows how to update the description of a specific administrative unit. -- `-ObjectId` parameter specifies the Id of an administrative unit. +- `-AdministrativeUnitId` parameter specifies the Id of an administrative unit. - `-Description` parameter specifies the description for the administrative unit. ## Parameters @@ -110,14 +110,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -AdministrativeUnitId Specifies the Id of an administrative unit in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplication.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplication.md index 5f25ef3cd..90e396791 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplication.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplication.md @@ -27,7 +27,7 @@ Updates the properties of an application object. ```powershell Set-EntraApplication - -ObjectId + -ApplicationId [-PasswordCredentials ] [-TokenEncryptionKeyId ] [-SignInAudience ] @@ -61,7 +61,7 @@ Updates the properties of an application object. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId DisplayName = 'New Demo Application' } Set-EntraApplication @params @@ -75,7 +75,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId IdentifierUris = 'https://mynewapp.contoso.com' } Set-EntraApplication @params @@ -89,7 +89,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId GroupMembershipClaims = 'SecurityGroup' } Set-EntraApplication @params @@ -103,7 +103,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId IsDeviceOnlyAuthSupported = $false } Set-EntraApplication @params @@ -117,7 +117,7 @@ This command updates an application in Microsoft Entra ID. Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $application = Get-EntraApplication -Filter "DisplayName eq 'Original Demo Application'" $params = @{ - ObjectId = $application.ObjectId + ApplicationId = $application.ObjectId Tags = 'mytag' } Set-EntraApplication @params @@ -281,14 +281,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId Specifies the ID of an application in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplicationLogo.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplicationLogo.md index 0e9f0bc8c..a16ecb356 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplicationLogo.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraApplicationLogo.md @@ -28,7 +28,7 @@ Sets the logo for an Application ```powershell Set-EntraApplicationLogo - -ObjectId + -ApplicationId -FilePath [] ``` @@ -37,7 +37,7 @@ Set-EntraApplicationLogo ```powershell Set-EntraApplicationLogo - -ObjectId + -ApplicationId [] ``` @@ -45,7 +45,7 @@ Set-EntraApplicationLogo ```powershell Set-EntraApplicationLogo - -ObjectId + -ApplicationId [] ``` @@ -55,7 +55,7 @@ The `Set-EntraApplicationLogo` cmdlet is used to set the logo for an application ## Examples -### Example 1: Sets the application logo for the application specified by the ObjectID parameter +### Example 1: Sets the application logo for the application specified by the ApplicationId parameter ```powershell Connect-Entra -Scopes 'Application.ReadWrite.All' @@ -67,7 +67,7 @@ $params = @{ Set-EntraApplicationLogo @params ``` -This cmdlet sets the application logo for the application specified by the `-ObjectId` parameter to the image specified with the `-FilePath` parameter. +This cmdlet sets the application logo for the application specified by the `-ApplicationId` parameter to the image specified with the `-FilePath` parameter. ## Parameters @@ -75,7 +75,7 @@ This cmdlet sets the application logo for the application specified by the `-Obj The file path of the file that is to be uploaded as the application logo. -```yaml +```yamlset-EntraApplicationLogo Type: System.String Parameter Sets: File Aliases: @@ -87,14 +87,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -ApplicationId -The ObjectID of the Application for which the logo is set. +The ApplicationId of the Application for which the logo is set. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: False Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAttributeSet.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAttributeSet.md index 15c557b7e..3e5f38487 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAttributeSet.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraAttributeSet.md @@ -26,19 +26,21 @@ Updates an existing attribute set. ```powershell Set-EntraAttributeSet - -Id + -AttributeSetId [-Description ] [-MaxAttributesPerSet ] [] ``` -## Description +## DESCRIPTION -Updates a Microsoft Entra ID attribute set object identified by ID. Specify `Id` parameter to update an attribute set. +The `Set-EntraAttributeSet` cmdlet updates a Microsoft Entra ID attribute set object specified by its ID. Specify `AttributeSetId` parameter to Update a Microsoft Entra ID attribute set object. -You can only update the `description` and `maxAttributesPerSet` properties. +In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. + +Note: Only the Attribute Definition Administrator role is supported for this operation. Ensure the signed-in user is assigned this role. -In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with the necessary permissions. The Attribute Definition Administrator is the only privileged role supported for this operation. +You can only update the `description` and `maxAttributesPerSet` properties. ## Examples @@ -47,31 +49,31 @@ In delegated scenarios with work or school accounts, the signed-in user must be ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' $params = @{ - Id = 'Engineering' - Description = 'Attributes for engineering team' + AttributeSetId = 'Engineering' + Description = 'Attributes for cloud engineering team' } Set-EntraAttributeSet @params ``` This example update an attribute set. -- `Id` parameter specifies the name of the attribute set. You can `Get-EntraAttributeSet` to get more details. -- `Description` parameter specifies the description for the attribute set. +- `-AttributeSetId` parameter specifies the name of the attribute set. You can `Get-EntraAttributeSet` to get more details. +- `-Description` parameter specifies the description for the attribute set. ### Example 2: Update an attribute set using MaxAttributesPerSet ```powershell Connect-Entra -Scopes 'CustomSecAttributeDefinition.ReadWrite.All' $params = @{ - Id = 'Engineering' - MaxAttributesPerSet = 10 + AttributeSetId = 'Engineering' + MaxAttributesPerSet = 10 } Set-EntraAttributeSet @params ``` This example update an attribute set using MaxAttributesPerSet. -- `-Id` parameter specifies the name of the attribute set. You can `Get-EntraAttributeSet` to get more details. +- `-AttributeSetId` parameter specifies the name of the attribute set. You can `Get-EntraAttributeSet` to get more details. - `-MaxAttributesPerSet` parameter specifies the maximum number of custom security attributes. ## Parameters @@ -92,14 +94,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -AttributeSetId Name of the attribute set. Unique identifier for the attribute set within a tenant. This identifier can be up to 32 characters long and may include Unicode characters. It cannot contain spaces or special characters, and it cannot be changed later. The identifier is case insensitive. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDevice.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDevice.md index 4e1298991..bb7f28d89 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDevice.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDevice.md @@ -26,7 +26,7 @@ Updates a device. ```powershell Set-EntraDevice - -ObjectId + -DeviceObjectId [-DevicePhysicalIds ] [-DeviceOSType ] [-DeviceTrustType ] @@ -57,7 +57,7 @@ The calling user must have at least the Intune Administrator role in Microsoft E ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' -Set-EntraDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DisplayName 'My OS/2 computer' +Set-EntraDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DisplayName 'My OS/2 computer' ``` This example shows how to update a display name of a specified. @@ -69,7 +69,7 @@ Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' $NewId= New-Object Microsoft.Open.AzureAD.Model.AlternativeSecurityId $NewId.Key =[System.Text.Encoding]::UTF8.GetBytes('test') $NewId.type = 2 -Set-EntraDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AlternativeSecurityIds $NewId +Set-EntraDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AlternativeSecurityIds $NewId ``` This example shows how to update an alternative security ID of a specified device. @@ -78,7 +78,7 @@ This example shows how to update an alternative security ID of a specified devic ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' -Set-EntraDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AccountEnabled $true +Set-EntraDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -AccountEnabled $true ``` This example shows how to update an account enabled of a specified device. @@ -87,7 +87,7 @@ This example shows how to update an account enabled of a specified device. ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' -Set-EntraDevice -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DeviceOSType Windows +Set-EntraDevice -DeviceObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DeviceOSType Windows ``` This example shows how to update an OS type of a specified device. @@ -98,7 +98,7 @@ This example shows how to update an OS type of a specified device. Connect-Entra -Scopes 'Directory.AccessAsUser.All','Device.ReadWrite.All' $params = @{ - ObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + DeviceObjectId = 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' DeviceMetadata = 'Testdevice' DeviceObjectVersion = 4 DevicePhysicalIds = '[GID]:g:1234567890123456' @@ -320,14 +320,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -DeviceObjectId Specifies the object ID of a device in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDirectoryRoleDefinition.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDirectoryRoleDefinition.md index 286ac17e2..096b18904 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDirectoryRoleDefinition.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraDirectoryRoleDefinition.md @@ -29,7 +29,7 @@ Set-EntraDirectoryRoleDefinition [-TemplateId ] [-DisplayName ] [-RolePermissions ] --Id +-UnifiedRoleDefinitionId [-Description ] [-Version ] [-IsEnabled ] @@ -48,16 +48,12 @@ Updates a Microsoft Entra roleDefinition object identified by ID. You can't upda ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $roleDefinition = Get-EntraDirectoryRoleDefinition -Filter "DisplayName eq ''" -$params = @{ - Id = $roleDefinition.ObjectId - DisplayName = 'UpdatedDisplayName' -} -Set-EntraDirectoryRoleDefinition @params +Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId $roleDefinition.Id -DisplayName 'UpdatedDisplayName' ``` This example updates the specified role definition in Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. - `-DisplayName` parameter specifies the display name for the role definition. ### Example 2: Update an roleDefinition with Description @@ -65,16 +61,12 @@ This example updates the specified role definition in Microsoft Entra ID. ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $roleDefinition = Get-EntraDirectoryRoleDefinition -Filter "DisplayName eq ''" -$params = @{ - Id = $roleDefinition.ObjectId - Description = 'MYROLEUPDATE1S' -} -Set-EntraDirectoryRoleDefinition @params +Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId $roleDefinition.Id -Description 'MYROLEUPDATE1S' ``` This example updates the Description of specified role definition in Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. - `-Description` parameter specifies the description for the role definition. ### Example 3: Update an roleDefinition with IsEnabled @@ -82,16 +74,12 @@ This example updates the Description of specified role definition in Microsoft E ```powershell Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory' $roleDefinition = Get-EntraDirectoryRoleDefinition -Filter "DisplayName eq ''" -$params = @{ - Id = $roleDefinition.ObjectId - IsEnabled = $true -} -Set-EntraDirectoryRoleDefinition @params +Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId $roleDefinition.Id -IsEnabled $true ``` This example updates the IsEnabled of specified role definition in Microsoft Entra ID. -- `-Id` parameter specifies the roleDefinition object ID. +- `-UnifiedRoleDefinitionId` parameter specifies the roleDefinition object ID. - `-IsEnabled` parameter specifies whether the role definition is enabled. ### Example 4: Update an roleDefinition @@ -102,7 +90,7 @@ $roleDefinition = Get-EntraDirectoryRoleDefinition -Filter "DisplayName eq ' + -GroupId [-DisplayName ] [-GroupTypes ] [-SecurityEnabled ] @@ -40,7 +40,7 @@ Set-EntraGroup ## Description -The `Set-EntraGroup` cmdlet sets the properties for an existing Microsoft Entra ID group. Specify the `Id` parameter to set the properties for an existing Microsoft Entra ID group. +The `Set-EntraGroup` cmdlet sets the properties for an existing Microsoft Entra ID group. Specify the `GroupId` parameter to set the properties for an existing Microsoft Entra ID group. ## Examples @@ -50,7 +50,7 @@ The `Set-EntraGroup` cmdlet sets the properties for an existing Microsoft Entra Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId DisplayName = 'UPDATE HelpDesk Team Leaders' } Set-EntraGroup @params @@ -64,7 +64,7 @@ This command updates the display name of a specified group in Microsoft Entra ID Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId Description = 'This is my new group' } Set-EntraGroup @params @@ -78,7 +78,7 @@ This example demonstrates how to update a group description. Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId MailNickName = 'newnickname' } Set-EntraGroup @params @@ -92,7 +92,7 @@ This command updates the mail nickname of a specified group in Microsoft Entra I Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId SecurityEnabled = $true } Set-EntraGroup @params @@ -106,7 +106,7 @@ This command updates the security enabled of a specified group in Microsoft Entr Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId MailEnabled = $false } Set-EntraGroup @params @@ -120,7 +120,7 @@ This example demonstrates how to update a group main enabled. Connect-Entra -Scopes 'Group.ReadWrite.All' $group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'" $params = @{ - Id = $group.ObjectId + GroupId = $group.ObjectId Visibility = 'Private' GroupTypes = 'DynamicMembership' IsAssignableToRole = $true @@ -181,14 +181,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupId Specifies the object ID of a group. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraGroupLifecyclePolicy.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraGroupLifecyclePolicy.md index dfb3462b9..ba9413e5e 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraGroupLifecyclePolicy.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraGroupLifecyclePolicy.md @@ -25,7 +25,7 @@ Updates a specific group Lifecycle Policy in Microsoft Entra ID. ```powershell Set-EntraGroupLifecyclePolicy - -Id + -GroupLifecyclePolicyId [-AlternateNotificationEmails ] [-GroupLifetimeInDays ] [-ManagedGroupTypes ] @@ -44,7 +44,7 @@ The `Set-EntraGroupLifecyclePolicy` command updates a specific group Lifecycle P Connect-Entra -Scopes 'Directory.ReadWrite.All' $policy = Get-EntraGroupLifecyclePolicy | Select-Object -First 1 $params = @{ - Id = $policy.Id + GroupLifecyclePolicyId = $policy.Id GroupLifetimeInDays = 200 AlternateNotificationEmails = 'example@contoso.com' ManagedGroupTypes = 'All' @@ -60,7 +60,7 @@ ffffffff-5555-6666-7777-aaaaaaaaaaaa example@contoso.com 200 This example updates the specified groupLifecyclePolicy in Microsoft Entra ID. -- `-Id` parameter specifies the ID of the Lifecycle Policy to be modified. +- `-GroupLifecyclePolicyId` parameter specifies the ID of the Lifecycle Policy to be modified. - `-GroupLifetimeInDays` parameter specifies the lifetime of the groups in the policy to 200 days. The GroupLifetimeInDays represents the number of days before a group expires and needs to be renewed. Once renewed, the group expiration is extended by the number of days defined. - `-AlternateNotificationEmails` parameter specifies the email address that receives notifications about the policy. Multiple email address can be defined by separating email address with a semicolon. - `-ManagedGroupTypes` parameter specifies which office 365 groups the policy applies to. Possible values are `All`, `Selected`, or `None`. @@ -101,14 +101,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id +### -GroupLifecyclePolicyId Specifies the ID of a groupLifecyclePolicies object in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraIdentityProvider.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraIdentityProvider.md index facdf7069..f4e054073 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraIdentityProvider.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraIdentityProvider.md @@ -27,7 +27,7 @@ Update the properties of an existing identity provider configured in the directo ```powershell Set-EntraIdentityProvider - -Id + -IdentityProviderBaseId [-Type ] [-ClientSecret ] [-ClientId ] @@ -48,7 +48,7 @@ The type of the identity provider can't be modified. ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' $params = @{ - Id = 'Google-OAuth' + IdentityProviderBaseId = 'Google-OAuth' ClientId = 'NewClientID' } Set-EntraIdentityProvider @params @@ -64,7 +64,7 @@ This example updates the client ID for the specified identity provider. ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' $params = @{ - Id = 'Google-OAuth' + IdentityProviderBaseId = 'Google-OAuth' ClientSecret = 'NewClientSecret' } Set-EntraIdentityProvider @params @@ -80,7 +80,7 @@ This example updates the client secret for the specified identity provider. ```powershell Connect-Entra -Scopes 'IdentityProvider.ReadWrite.All' $params = @{ - Id = 'Google-OAuth' + IdentityProviderBaseId = 'Google-OAuth' Name = 'NewGoogleName' } Set-EntraIdentityProvider @params @@ -125,14 +125,13 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Id - +### -IdentityProviderBaseId The unique identifier for an identity provider. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: Id Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraServicePrincipal.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraServicePrincipal.md index ebc34703c..3a6529577 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraServicePrincipal.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraServicePrincipal.md @@ -25,7 +25,7 @@ Updates a service principal. ```powershell Set-EntraServicePrincipal - -ObjectId + -ServicePrincipalId [-KeyCredentials ] [-Homepage ] [-AppId ] @@ -55,7 +55,7 @@ The `Set-EntraServicePrincipal` cmdlet updates a service principal in Microsoft Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId AccountEnabled = $False } Set-EntraServicePrincipal @params @@ -63,7 +63,7 @@ Set-EntraServicePrincipal @params This example demonstrates how to update `AccountEnabled` of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-AccountEnabled` parameter specifies indicates whether the account is enabled. ### Example 2: Update AppId and Homepage of a service principal @@ -72,7 +72,7 @@ This example demonstrates how to update `AccountEnabled` of a service principal Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId AppId = '22223333-cccc-4444-dddd-5555eeee6666' Homepage = 'https://*.e-days.com/SSO/SAML2/SP/AssertionConsumer.aspx?metadata=e-days|ISV9.2|primary|z' } @@ -81,7 +81,7 @@ Set-EntraServicePrincipal @params This example demonstrates how to update `AppId` and Homepage of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-AppId` parameter specifies the application ID. - `-Homepage` parameter specifies the home page or landing page of the application. @@ -91,7 +91,7 @@ This example demonstrates how to update `AppId` and Homepage of a service princi Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId AlternativeNames = 'Service Principal Demo' DisplayName = 'NewName' } @@ -100,7 +100,7 @@ Set-EntraServicePrincipal @params This example demonstrates how to update AlternativeNames and DisplayName of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. ### Example 4: Update LogoutUrl and ReplyUrls of a service principal @@ -108,7 +108,7 @@ This example demonstrates how to update AlternativeNames and DisplayName of a se Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId LogoutUrl = 'https://securescore.office.com/SignOut' ReplyUrls = 'https://admin.contoso.com' } @@ -117,7 +117,7 @@ Set-EntraServicePrincipal @params This example demonstrates how to update LogoutUrl and ReplyUrls of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-LogoutUrl` parameter specifies the sign out URL. - `-ReplyUrls` parameter specifies the URLs that user tokens are sent to for sign in with the associated application. @@ -127,7 +127,7 @@ This example demonstrates how to update LogoutUrl and ReplyUrls of a service pri Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId ServicePrincipalType = 'Application' AppRoleAssignmentRequired = $True } @@ -136,7 +136,7 @@ Set-EntraServicePrincipal @params This example demonstrates how to update `ServicePrincipalType` and `AppRoleAssignmentRequired` of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-ServicePrincipalType` parameter specifies the service principal type. - `-AppRoleAssignmentRequired` parameter specifies indicates whether an application role assignment is required. @@ -153,7 +153,7 @@ $creds.Type = 'Symmetric' $creds.Usage = 'Sign' $creds.Value = [System.Text.Encoding]::UTF8.GetBytes('A') $creds.EndDate = Get-Date -Year 2025 -Month 12 -Day 20 -Set-EntraServicePrincipal -ObjectId $servicePrincipal.ObjectId -KeyCredentials $creds +Set-EntraServicePrincipal -ServicePrincipalId $servicePrincipal.ObjectId -KeyCredentials $creds ``` This example demonstrates how to update KeyCredentials of a service principal in Microsoft Entra ID. @@ -166,7 +166,7 @@ Use the `New-EntraServicePrincipalPasswordCredential` and `Remove-EntraServicePr Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy' $servicePrincipal = Get-EntraServicePrincipal -Filter "DisplayName eq 'Entra PowerShell Service Principal'" $params = @{ - ObjectId = $servicePrincipal.ObjectId + ServicePrincipalId = $servicePrincipal.ObjectId PreferredSingleSignOnMode = 'saml' } Set-EntraServicePrincipal @params @@ -174,7 +174,7 @@ Set-EntraServicePrincipal @params This example demonstrates how to update `PreferredSingleSignOnMode` of a service principal in Microsoft Entra ID. -- `-ObjectId` parameter specifies the ID of a service principal. +- `-ServicePrincipalId` parameter specifies the ID of a service principal. - `-PreferredSingleSignOnMode` parameter specifies the single sign-on mode configured for this application. ## Parameters @@ -307,14 +307,14 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId +### -ServicePrincipalId Species the ID of a service principal in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUser.md index 760174419..5955988e3 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUser.md @@ -25,7 +25,7 @@ Updates a user. ```powershell Set-EntraUser - -ObjectId + -UserId [-PostalCode ] [-CompanyName ] [-GivenName ] @@ -60,7 +60,7 @@ Set-EntraUser ## Description -The `Set-EntraUser` cmdlet updates a user in Microsoft Entra ID. Specify the `ObjectId` parameter to update a user in Microsoft Entra ID. +The `Set-EntraUser` cmdlet updates a user in Microsoft Entra ID. Specify the `UserId` parameter to update a user in Microsoft Entra ID. ## Examples @@ -68,9 +68,9 @@ The `Set-EntraUser` cmdlet updates a user in Microsoft Entra ID. Specify the `Ob ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' -$user = Get-EntraUser -ObjectId 'SawyerM@contoso.com' +$user = Get-EntraUser -UserId 'SawyerM@contoso.com' $params = @{ - ObjectId = $user.ObjectId + UserId = $user.Id DisplayName = 'Updated user Name' } Set-EntraUser @params @@ -78,14 +78,14 @@ Set-EntraUser @params This example updates the specified user's Display name parameter. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. ### Example 2: Set the specified user's AccountEnabled parameter ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' $params = @{ - ObjectId = 'SawyerM@contoso.com' + UserId = 'SawyerM@contoso.com' AccountEnabled = $true } Set-EntraUser @params @@ -93,7 +93,7 @@ Set-EntraUser @params This example updates the specified user's AccountEnabled parameter. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-AccountEnabled` Specifies whether the account is enabled. ### Example 3: Set all but specified users as minors with parental consent @@ -101,12 +101,12 @@ This example updates the specified user's AccountEnabled parameter. ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' Get-EntraUser -All | Where-Object -FilterScript { $_.DisplayName -notmatch '(George|James|Education)' } | -ForEach-Object { Set-EntraUser -ObjectId $($_.ObjectId) -AgeGroup 'minor' -ConsentProvidedForMinor 'granted' } +ForEach-Object { Set-EntraUser -UserId $($_.ObjectId) -AgeGroup 'minor' -ConsentProvidedForMinor 'granted' } ``` This example updates the specified user's as minors with parental consent. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-ConsentProvidedForMinor` Sets whether consent has to obtained for minors. Allowed values: null, granted, denied, and notRequired. ### Example 4: Set the specified user's property @@ -114,7 +114,7 @@ This example updates the specified user's as minors with parental consent. ```powershell Connect-Entra -Scopes 'User.ReadWrite.All','Directory.AccessAsUser.All' $params = @{ - ObjectId = 'SawyerM@contoso.com' + UserId = 'SawyerM@contoso.com' City = 'Add city name' CompanyName = 'Microsoft' Country = 'Add country name' @@ -135,7 +135,7 @@ Set-EntraUser @params This example updates the specified user's property. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-UserType` classify user types in your directory, such as "Member" and "Guest." - `-PasswordPolicies` Specifies password policies for the user. - `-OtherMails` Specifies other email addresses for the user @@ -145,7 +145,7 @@ This example updates the specified user's property. ```powershell Connect-Entra -Scopes 'Directory.AccessAsUser.All' $params= @{ -ObjectId = 'SawyerM@contoso.com' +UserId = 'SawyerM@contoso.com' PasswordProfile = @{ Password= '*****' ForceChangePasswordNextLogin = $true @@ -157,7 +157,7 @@ Set-EntraUser @params This example updates the specified user's PasswordProfile parameter. -- `-ObjectId` Specifies the ID as a user principal name (UPN) or ObjectId. +- `-UserId` Specifies the ID as a user principal name (UPN) or UserId. - `-PasswordProfile` specifies the user's password profile. ## Parameters @@ -359,14 +359,13 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ObjectId - -Specifies the ID of a user (as a User Principle Name or ObjectId) in Microsoft Entra ID. +### -UserId +Specifies the ID of a user (as a UPN or UserId) in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserManager.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserManager.md index 12f2c2a09..4b64ccd4e 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserManager.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserManager.md @@ -25,14 +25,14 @@ Updates a user's manager. ```powershell Set-EntraUserManager - -ObjectId + -UserId -RefObjectId [] ``` ## Description -The `Set-EntraUserManager` cmdlet update the manager for a user in Microsoft Entra ID. Specify the `ObjectId` and `RefObjectId` parameters to update the manager for a user in Microsoft Entra ID. +The `Set-EntraUserManager` cmdlet update the manager for a user in Microsoft Entra ID. Specify the `UserId` and `RefObjectId` parameters to update the manager for a user in Microsoft Entra ID. ## Examples @@ -40,9 +40,9 @@ The `Set-EntraUserManager` cmdlet update the manager for a user in Microsoft Ent ```powershell Connect-Entra -Scopes 'User.ReadWrite.All' -$manager = Get-EntraUser -ObjectId 'Manager@contoso.com' +$manager = Get-EntraUser -UserId 'Manager@contoso.com' $params = @{ - ObjectId = 'SawyerM@contoso.com' + UserId = 'SawyerM@contoso.com' RefObjectId = $manager.ObjectId } Set-EntraUserManager @params @@ -52,14 +52,14 @@ This example demonstrates how to update the manager for the specified user. ## Parameters -### -ObjectId +### -UserId Specifies the ID (as a User Principle Name or ObjectId) of a user in Microsoft Entra ID. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: True Position: Named diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserThumbnailPhoto.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserThumbnailPhoto.md index 5f1c74f30..1ee55c9b0 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserThumbnailPhoto.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Set-EntraUserThumbnailPhoto.md @@ -28,7 +28,7 @@ Set the thumbnail photo for a user. ```powershell Set-EntraUserThumbnailPhoto - [-ObjectId ] + [-UserId ] -FilePath [] ``` @@ -38,7 +38,7 @@ Set-EntraUserThumbnailPhoto ```powershell Set-EntraUserThumbnailPhoto -FileStream - [-ObjectId ] + [-UserId ] [] ``` @@ -46,7 +46,7 @@ Set-EntraUserThumbnailPhoto ```powershell Set-EntraUserThumbnailPhoto - [-ObjectId ] + [-UserId ] -ImageByteArray [] ``` @@ -64,15 +64,15 @@ Updating any user's photo in the organization requires the User.ReadWrite.All pe ```powershell Connect-Entra -Scopes 'User.ReadWrite','User.ReadWrite.All' $params = @{ - ObjectId = 'SawyerM@contoso.com' + UserId = 'SawyerM@contoso.com' FilePath = 'D:\UserThumbnailPhoto.jpg' } Set-EntraUserThumbnailPhoto @params ``` -This example sets the thumbnail photo of the user specified with the ObjectId parameter to the image specified with the FilePath parameter. +This example sets the thumbnail photo of the user specified with the UserId parameter to the image specified with the FilePath parameter. -- `-ObjectId` parameter specifies the ID of a user in Microsoft Entra ID. +- `-UserId` parameter specifies the ID of a user in Microsoft Entra ID. - `-FilePath` parameter specifies the file path of the image to be uploaded as the user thumbnail photo. ## Parameters @@ -93,14 +93,14 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ObjectId +### -UserId The Object ID of the user for which the user thumbnail photo is set. ```yaml Type: System.String Parameter Sets: (All) -Aliases: +Aliases: ObjectId Required: False Position: Named diff --git a/src/CompatibilityAdapterBuilder.ps1 b/src/CompatibilityAdapterBuilder.ps1 index ca8ab2962..f3ad33864 100644 --- a/src/CompatibilityAdapterBuilder.ps1 +++ b/src/CompatibilityAdapterBuilder.ps1 @@ -24,6 +24,134 @@ class CompatibilityAdapterBuilder { hidden [hashtable] $HelperCmdletsToExport = @{} hidden [string] $BasePath = $null hidden [string] $LoadMessage + hidden [string[]] $cmdtoSkipNameconverssion = @( + 'Select-EntraGroupIdsGroupIsMemberOf', + 'Get-EntraUserAppRoleAssignment', + 'Get-EntraPermissionGrantConditionSet', + 'Remove-EntraUserAppRoleAssignment', + 'Set-EntraUserLicense', + 'Restore-EntraDeletedApplication', + 'Set-EntraUserPassword', + 'Remove-EntraAdministrativeUnit', + 'Remove-EntraAdministrativeUnitMember', + 'Select-EntraGroupIdsServicePrincipalIsMemberOf', + 'Get-EntraServicePrincipalDelegatedPermissionClassification', + 'Set-EntraServicePrincipal', + 'New-EntraConditionalAccessPolicy', + 'Reset-EntraLifeCycleGroup', + 'Get-EntraObjectByObjectId', + 'Remove-EntraPermissionGrantConditionSet', + 'Get-EntraPermissionGrantPolicy', + 'Remove-EntraOAuth2PermissionGrant', + 'New-EntraUserAppRoleAssignment', + 'Set-EntraPermissionGrantPolicy', + 'Remove-EntraScopedRoleMembership', + 'New-EntraPermissionGrantPolicy', + 'Remove-EntraApplicationPassword', + 'New-EntraNamedLocationPolicy', + 'New-EntraServiceAppRoleAssignment', + 'Select-EntraGroupIdsContactIsMemberOf', + 'Remove-EntraServicePrincipalDelegatedPermissionClassification', + 'Get-EntraServiceAppRoleAssignment', + 'Set-EntraConditionalAccessPolicy', + 'Remove-EntraPermissionGrantPolicy', + 'Set-EntraNamedLocationPolicy', + 'Set-EntraPermissionGrantConditionSet', + 'Remove-EntraDeletedApplication', + 'Select-EntraGroupIdsUserIsMemberOf', + 'Add-EntraBetaServicePrincipalPolicy', + 'Get-EntraApplicationKeyCredential', + 'Get-EntraPermissionGrantConditionSet', + 'Get-EntraPermissionGrantConditionSet', + 'New-EntraNamedLocationPolicy', + 'New-EntraServicePrincipalAppRoleAssignment', + 'Restore-EntraDeletedDirectoryObject', + 'Restore-EntraBetaDeletedDirectoryObject', + 'New-EntraBetaServicePrincipalAppRoleAssignment', + 'New-EntraBetaNamedLocationPolicy', + 'Get-EntraBetaPermissionGrantConditionSet', + 'Get-EntraBetaPermissionGrantConditionSet', + 'Get-EntraBetaApplicationKeyCredential', + 'Get-EntraBetaPrivilegedRoleDefinition', + 'Get-EntraBetaFeatureRolloutPolicy', + 'Set-EntraBetaPermissionGrantPolicy', + 'Remove-EntraBetaApplicationPassword', + 'Get-EntraBetaServicePrincipalPolicy', + 'Get-EntraBetaPrivilegedRoleAssignmentRequest', + 'New-EntraBetaApplicationPassword', + 'Set-EntraBetaPasswordSingleSignOnCredential', + 'Get-EntraBetaObjectSetting', + 'Add-EntraBetaApplicationPolicy', + 'Add-EntraBetaFeatureRolloutPolicyDirectoryObject', + 'Revoke-EntraBetaUserAllRefreshToken', + 'Get-EntraBetaPrivilegedRole', + 'Get-EntraBetaApplicationTemplate', + 'Select-EntraBetaGroupIdsContactIsMemberOf', + 'Set-EntraBetaCustomSecurityAttributeDefinitionAllowedValue', + 'Set-EntraBetaUserLicense', + 'Set-EntraBetaTrustFrameworkPolicy', + 'Remove-EntraBetaUserAppRoleAssignment', + 'Get-EntraBetaApplicationPolicy', + 'Get-EntraBetaPermissionGrantPolicy', + 'Select-EntraBetaGroupIdsGroupIsMemberOf', + 'New-EntraBetaUserAppRoleAssignment', + 'Get-EntraBetaTrustFrameworkPolicy', + 'Remove-EntraBetaObjectSetting', + 'Add-EntraBetacustomSecurityAttributeDefinitionAllowedValue', + 'Get-EntraBetaUserOAuth2PermissionGrant', + 'New-EntraBetaApplicationKey', + 'Get-EntraBetaPolicy', + 'Get-EntraBetaDirectorySetting', + 'New-EntraBetaServiceAppRoleAssignment', + 'Get-EntraBetaObjectByObjectId', + 'Remove-EntraBetaPasswordSingleSignOnCredential', + 'Set-EntraBetaPermissionGrantConditionSet', + 'Set-EntraBetaConditionalAccessPolicy', + 'Get-EntraBetaPolicyAppliedObject', + 'Remove-EntraBetaDeletedApplication', + 'Get-EntraBetaCustomSecurityAttributeDefinitionAllowedValue', + 'Get-EntraBetaUserAppRoleAssignment', + 'Get-EntraBetaDirectorySettingTemplate', + 'Remove-EntraBetaServicePrincipalPolicy', + 'Get-EntraBetaPermissionGrantConditionSet', + 'Set-EntraBetaObjectSetting', + 'Remove-EntraBetaFeatureRolloutPolicyDirectoryObject', + 'Get-EntraBetaAuthorizationPolicy', + 'Remove-EntraBetaPermissionGrantPolicy', + 'Set-EntraBetaDirectorySetting', + 'Set-EntraBetaAuthorizationPolicy', + 'Remove-EntraBetaDirectorySetting', + 'Remove-EntraBetaApplicationPolicy', + 'New-EntraBetaConditionalAccessPolicy', + 'Set-EntraBetaPrivilegedRoleAssignmentRequest', + 'Remove-EntraBetaTrustFrameworkPolicy', + 'New-EntraBetaPasswordSingleSignOnCredential', + 'Remove-EntraBetaPolicy', + 'Set-EntraBetaPolicy', + 'Set-EntraBetaCustomSecurityAttributeDefinition', + 'Get-EntraBetaPrivilegedResource', + 'Set-EntraBetaUserPassword', + 'New-EntraBetaApplicationFromApplicationTemplate', + 'Set-EntraBetaPrivilegedRoleSetting', + 'Remove-EntraBetaApplicationKey', + 'Get-EntraBetaPrivilegedRoleSetting', + 'Remove-EntraBetaOAuth2PermissionGrant', + 'Select-EntraBetaGroupIdsServicePrincipalIsMemberOf', + 'Get-EntraBetaServicePrincipalDelegatedPermissionClassification', + 'New-EntraBetaPrivilegedRoleAssignment', + 'Get-EntraBetaPasswordSingleSignOnCredential', + 'Set-EntraBetaFeatureRolloutPolicy', + 'New-EntraBetaPermissionGrantPolicy', + 'Remove-EntraBetaFeatureRolloutPolicy', + 'Get-EntraBetaCustomSecurityAttributeDefinition', + 'Remove-EntraBetaServicePrincipalDelegatedPermissionClassification', + 'Select-EntraBetaGroupIdsUserIsMemberOf', + 'Set-EntraBetaNamedLocationPolicy', + 'New-EntraBetaNamedLocationPolicy', + 'Restore-EntraBetaDeletedApplication', + 'Remove-EntraBetaPermissionGrantConditionSet' + + ) # Constructor that changes the output folder, load all the Required Modules and creates the output folder. CompatibilityAdapterBuilder() { @@ -589,7 +717,16 @@ Set-Variable -name MISSING_CMDS -value @('$($this.ModuleMap.MissingCommandsList $parameterDefinitions = $this.GetParametersDefinitions($Command) $ParamterTransformations = $this.GetParametersTransformations($Command) $OutputTransformations = $this.GetOutputTransformations($Command) - $function = @" + if (($this.cmdtoSkipNameconverssion -notcontains $Command.Generate) -and ($parameterDefinitions.Contains('$ObjectId') -or $parameterDefinitions.Contains('$Id'))) { + $function = @" +function $($Command.Generate) { +$($Command.CustomScript) +} + +"@ + } + else { + $function = @" function $($Command.Generate) { [CmdletBinding($($Command.DefaultParameterSet))] param ( @@ -599,7 +736,8 @@ $parameterDefinitions $($Command.CustomScript) } -"@ +"@ + } $codeBlock = [Scriptblock]::Create($function) return [CommandTranslation]::New($Command.Generate,$Command.Old,$codeBlock) } @@ -613,6 +751,7 @@ $($Command.CustomScript) "Get-EntraApplication", "Get-EntraDeletedApplication", "Get-EntraDeletedGroup", + "Get-EntraBetaDeletedGroup", "Get-EntraRoleAssignment", "Get-EntraContact", "Get-EntraRoleDefinition", @@ -680,21 +819,30 @@ $OutputTransformations return [CommandTranslation]::New($Command.Generate,$Command.Old,$codeBlock) } - hidden [string] GetParametersDefinitions([PSCustomObject] $Command) { + hidden [string] GetParametersDefinitions([PSCustomObject] $Command) { $commonParameterNames = @("ProgressAction","Verbose", "Debug","ErrorAction", "ErrorVariable", "WarningAction", "WarningVariable", "OutBuffer", "PipelineVariable", "OutVariable", "InformationAction", "InformationVariable","WhatIf","Confirm") $ignorePropertyParameter = @("Get-EntraBetaApplicationPolicy", "Get-EntraBetaApplicationSignInSummary","Get-EntraBetaPrivilegedRoleAssignment","Get-EntraBetaTrustFrameworkPolicy","Get-EntraBetaPolicy","Get-EntraBetaPolicyAppliedObject","Get-EntraBetaServicePrincipalPolicy","Get-EntraApplicationLogo","Get-EntraBetaApplicationLogo","Get-EntraApplicationKeyCredential","Get-EntraBetaApplicationKeyCredential","Get-EntraBetaServicePrincipalKeyCredential","Get-EntraBetaServicePrincipalPasswordCredential","Get-EntraServicePrincipalKeyCredential","Get-EntraServicePrincipalPasswordCredential") $params = $(Get-Command -Name $Command.Old).Parameters $paramsList = @() + $ParamAlias=$null foreach ($paramKey in $Command.Parameters.Keys) { if($commonParameterNames.Contains($paramKey)) { continue } + $targetParam = $Command.Parameters[$paramKey] $param = $params[$paramKey] $paramType = $param.ParameterType.ToString() $paramtypeToCreate = $param.ParameterType.ToString() if($param.Name -eq 'All'){ $paramType = "switch" } + + if( ($this.cmdtoSkipNameconverssion -notcontains $Command.Generate) -and (($param.Name -eq 'ObjectId' -or $param.Name -eq 'Id') -and $null -ne $targetParam.TargetName)){ + if ($targetParam.TargetName) { + $ParamAlias = $this.GetParameterAlias($param.Name) + $param.Name = $targetParam.TargetName + } + } if(($null -ne $this.TypePrefix) -and ($paramType -like "*$($this.TypePrefix)*")){ if($paramType -like "*List*"){ $paramType = "System.Collections.Generic.List``1[$($param.ParameterType.GenericTypeArguments.FullName)]" @@ -709,9 +857,11 @@ $OutputTransformations } } $paramBlock = @" + $ParamAlias $($this.GetParameterAttributes($Param))[$($paramType)] `$$($param.Name) "@ $paramsList += $paramBlock + $ParamAlias=$null } $addProperty = $true @@ -749,6 +899,10 @@ $OutputTransformations return $propertyParamBlock } + hidden [string] GetParameterAlias($param){ + return "[Alias('$param')]" + } + hidden [string] GetParameterAttributes($param){ $attributesString = "" @@ -805,7 +959,11 @@ $OutputTransformations $paramBlock = $this.GetParameterTransformationName($param.Name, $param.Name) } elseif([TransformationTypes]::Name -eq $param.ConversionType){ - $paramBlock = $this.GetParameterTransformationName($param.Name, $param.TargetName) + if(($this.cmdtoSkipNameconverssion -notcontains $Command.Generate) -and ($param.Name -eq 'ObjectId' -or $param.Name -eq 'Id') -and $null -ne $param.TargetName){ + $paramBlock = $this.GetParameterTransformationName($param.TargetName, $param.TargetName) + }else{ + $paramBlock = $this.GetParameterTransformationName($param.Name, $param.TargetName) + } } elseif([TransformationTypes]::Bool2Switch -eq $param.ConversionType){ $paramBlock = $this.GetParameterTransformationBoolean2Switch($param.Name, $param.TargetName) diff --git a/test/module/Entra/Add-EntraAdministrativeUnitMember.Tests.ps1 b/test/module/Entra/Add-EntraAdministrativeUnitMember.Tests.ps1 index aef06b5ed..df380af32 100644 --- a/test/module/Entra/Add-EntraAdministrativeUnitMember.Tests.ps1 +++ b/test/module/Entra/Add-EntraAdministrativeUnitMember.Tests.ps1 @@ -12,15 +12,20 @@ BeforeAll { } Describe "Add-EntraAdministrativeUnitMember tests"{ It "Should return empty object"{ - $result = Add-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraAdministrativeUnitMember -AdministrativeUnitId "f306a126-cf2e-439d-b20f-95ce4bcb7ffa" -RefObjectId "d6873b36-81d6-4c5e-bec0-9e3ca2c86846" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty"{ - { Add-EntraAdministrativeUnitMember -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should return empty object with ObjectId"{ + $result = Add-EntraAdministrativeUnitMember -ObjectId "f306a126-cf2e-439d-b20f-95ce4bcb7ffa" -RefObjectId "d6873b36-81d6-4c5e-bec0-9e3ca2c86846" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when AdministrativeUnitId is empty"{ + { Add-EntraAdministrativeUnitMember -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is null"{ - { Add-EntraAdministrativeUnitMember -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is null"{ + { Add-EntraAdministrativeUnitMember -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when RefObjectId is empty"{ { Add-EntraAdministrativeUnitMember -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId'*" @@ -31,9 +36,9 @@ Describe "Add-EntraAdministrativeUnitMember tests"{ It "Should fail when invalid paramter is passed"{ { Add-EntraAdministrativeUnitMember -Demo } | Should -Throw "A parameter cannot be found that matches parameter name 'Demo'*" } - It "Should contain 'User-Agent' header" { + It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraAdministrativeUnitMember" - Add-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraAdministrativeUnitMember" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue @@ -47,7 +52,7 @@ Describe "Add-EntraAdministrativeUnitMember tests"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Add-EntraAdministrativeUnitMember -AdministrativeUnitId "f306a126-cf2e-439d-b20f-95ce4bcb7ffa" -RefObjectId "d6873b36-81d6-4c5e-bec0-9e3ca2c86846" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraApplicationOwner.Tests.ps1 b/test/module/Entra/Add-EntraApplicationOwner.Tests.ps1 index 211bbff13..50c7b5f89 100644 --- a/test/module/Entra/Add-EntraApplicationOwner.Tests.ps1 +++ b/test/module/Entra/Add-EntraApplicationOwner.Tests.ps1 @@ -13,24 +13,24 @@ BeforeAll { Describe "Add-EntraApplicationOwner" { Context "Test for Add-EntraApplicationOwner" { It "Should return empty object"{ - $result = Add-EntraApplicationOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraApplicationOwner -ApplicationId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when parameters are empty" { - { Add-EntraApplicationOwner -ObjectId "" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter*" + { Add-EntraApplicationOwner -ApplicationId "" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter*" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { Mock -CommandName New-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraApplicationOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraApplicationOwner -ApplicationId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraApplicationOwner" - Add-EntraApplicationOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraApplicationOwner -ApplicationId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraApplicationOwner" Should -Invoke -CommandName New-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue @@ -44,7 +44,7 @@ Describe "Add-EntraApplicationOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraApplicationOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Add-EntraApplicationOwner -ApplicationId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraDeviceRegisteredOwner.Tests.ps1 b/test/module/Entra/Add-EntraDeviceRegisteredOwner.Tests.ps1 index d944bdbad..94e39f55a 100644 --- a/test/module/Entra/Add-EntraDeviceRegisteredOwner.Tests.ps1 +++ b/test/module/Entra/Add-EntraDeviceRegisteredOwner.Tests.ps1 @@ -13,34 +13,40 @@ BeforeAll { Describe "Add-EntraDeviceRegisteredOwner" { Context "Test for Add-EntraDeviceRegisteredOwner" { It "Should return empty object" { - $result = Add-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraDeviceRegisteredOwner -ObjectId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should execute successfully with Alias" { + $result = Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when DeviceId is empty" { + { Add-EntraDeviceRegisteredOwner -DeviceId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DeviceId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraDeviceRegisteredOwner -ObjectId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when DeviceId is invalid" { + { Add-EntraDeviceRegisteredOwner -DeviceId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } It "Should contain DeviceId in parameters when passed ObjectId to it" { Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "412be9d1-1460-4061-8eed-cca203fcb215" + $result = Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "412be9d1-1460-4061-8eed-cca203fcb215" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain BodyParameter in parameters when passed RefObjectId to it" { Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - Add-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -52,7 +58,7 @@ Describe "Add-EntraDeviceRegisteredOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDeviceRegisteredOwner" - Add-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDeviceRegisteredOwner" @@ -69,7 +75,7 @@ Describe "Add-EntraDeviceRegisteredOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - {Add-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + {Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraDeviceRegisteredUser.Tests.ps1 b/test/module/Entra/Add-EntraDeviceRegisteredUser.Tests.ps1 index 756a6761b..3b581ef33 100644 --- a/test/module/Entra/Add-EntraDeviceRegisteredUser.Tests.ps1 +++ b/test/module/Entra/Add-EntraDeviceRegisteredUser.Tests.ps1 @@ -13,34 +13,40 @@ BeforeAll { Describe "Add-EntraDeviceRegisteredUser" { Context "Test for Add-EntraDeviceRegisteredUser" { It "Should return empty object" { - $result = Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraDeviceRegisteredUser -ObjectId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when DeviceId is empty" { + { Add-EntraDeviceRegisteredUser -DeviceId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DeviceId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraDeviceRegisteredUser -ObjectId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when DeviceId is invalid" { + { Add-EntraDeviceRegisteredUser -DeviceId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } - It "Should contain DeviceId in parameters when passed ObjectId to it" { + It "Should execute successfully with Alias" { + $result = Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should contain DeviceId in parameters when passed DeviceId to it" { Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain BodyParameter in parameters when passed RefObjectId to it" { Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -52,7 +58,7 @@ Describe "Add-EntraDeviceRegisteredUser" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDeviceRegisteredUser" - Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDeviceRegisteredUser" @@ -69,7 +75,7 @@ Describe "Add-EntraDeviceRegisteredUser" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraDirectoryRoleMember.Tests.ps1 b/test/module/Entra/Add-EntraDirectoryRoleMember.Tests.ps1 index 1ed7cd0e7..cc0dde31d 100644 --- a/test/module/Entra/Add-EntraDirectoryRoleMember.Tests.ps1 +++ b/test/module/Entra/Add-EntraDirectoryRoleMember.Tests.ps1 @@ -13,34 +13,40 @@ BeforeAll { Describe "Add-EntraDirectoryRoleMember" { Context "Test for Add-EntraDirectoryRoleMember" { It "Should return empty object" { + $result = Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with alias" { $result = Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraDirectoryRoleMember -ObjectId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when DirectoryRoleId is empty" { + { Add-EntraDirectoryRoleMember -DirectoryRoleId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DirectoryRoleId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraDirectoryRoleMember -ObjectId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when DirectoryRoleId is invalid" { + { Add-EntraDirectoryRoleMember -DirectoryRoleId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'DirectoryRoleId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } It "Should contain DirectoryRoleId in parameters when passed ObjectId to it" { Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryRoleId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain OdataId in parameters when passed RefObjectId to it" { Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $value="https://graph.microsoft.com/v1.0/directoryObjects/" $params.OdataId | Should -Be $value"bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -48,7 +54,7 @@ Describe "Add-EntraDirectoryRoleMember" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDirectoryRoleMember" - Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDirectoryRoleMember" @@ -64,7 +70,7 @@ Describe "Add-EntraDirectoryRoleMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraGroupMember.Tests.ps1 b/test/module/Entra/Add-EntraGroupMember.Tests.ps1 index 5e5f3f705..2d4960058 100644 --- a/test/module/Entra/Add-EntraGroupMember.Tests.ps1 +++ b/test/module/Entra/Add-EntraGroupMember.Tests.ps1 @@ -13,32 +13,32 @@ BeforeAll { Describe "Add-EntraGroupMember" { Context "Test for Add-EntraGroupMember" { It "Should add an member to a group" { - $result = Add-EntraGroupMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgGroupMember -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraGroupMember -ObjectId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when GroupId is empty" { + { Add-EntraGroupMember -ObjectId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'GroupId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraGroupMember -ObjectId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Add-EntraGroupMember -GroupId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraGroupMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraGroupMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName New-MgGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraGroupMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaaaaaa-1111-2222-3333-cccccccccccc" } @@ -46,7 +46,7 @@ Describe "Add-EntraGroupMember" { It "Should contain DirectoryObjectId in parameters when passed RefObjectId to it" { Mock -CommandName New-MgGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraGroupMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } @@ -54,7 +54,7 @@ Describe "Add-EntraGroupMember" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraGroupMember" - Add-EntraGroupMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraGroupMember" @@ -70,7 +70,7 @@ Describe "Add-EntraGroupMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraGroupMember -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraGroupOwner.Tests.ps1 b/test/module/Entra/Add-EntraGroupOwner.Tests.ps1 index edd984555..92b037b01 100644 --- a/test/module/Entra/Add-EntraGroupOwner.Tests.ps1 +++ b/test/module/Entra/Add-EntraGroupOwner.Tests.ps1 @@ -13,39 +13,39 @@ BeforeAll { Describe "Add-EntraGroupOwner" { Context "Test for Add-EntraGroupOwner" { It "Should add an owner to a group" { - $result = Add-EntraGroupOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraGroupOwner -ObjectId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when GroupId is empty" { + { Add-EntraGroupOwner -GroupId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'GroupId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraGroupOwner -ObjectId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Add-EntraGroupOwner -GroupId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraGroupOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraGroupOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName New-MgGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraGroupOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaaaaaa-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraGroupOwner" - Add-EntraGroupOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraGroupOwner" Should -Invoke -CommandName New-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue @@ -59,7 +59,7 @@ Describe "Add-EntraGroupOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraGroupOwner -ObjectId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraLifecyclePolicyGroup.Tests.ps1 b/test/module/Entra/Add-EntraLifecyclePolicyGroup.Tests.ps1 index ed2bfc30d..fe01b7397 100644 --- a/test/module/Entra/Add-EntraLifecyclePolicyGroup.Tests.ps1 +++ b/test/module/Entra/Add-EntraLifecyclePolicyGroup.Tests.ps1 @@ -11,7 +11,7 @@ BeforeAll { return @( [PSCustomObject]@{ "Value" = "True" - "AdditionalProperties" = "{[@odata.context, https://graph.microsoft.com/v1.0/$metadata#Edm.Boolean]}" + "AdditionalProperties" = "{[@odata.context, https://graph.microsoft.com/v1.0/`$metadata#Edm.Boolean]}" "Parameters" = $args } ) @@ -23,28 +23,35 @@ BeforeAll { Describe "Add-EntraLifecyclePolicyGroup" { Context "Test for Add-EntraLifecyclePolicyGroup" { It "Should return created LifecyclePolicyGroup" { + $result = Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff + $result | Should -Not -BeNullOrEmpty" + $result.Value | should -Be "True" + + Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return created LifecyclePolicyGroup with alias" { $result = Add-EntraLifecyclePolicyGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff $result | Should -Not -BeNullOrEmpty" $result.Value | should -Be "True" Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is invalid" { - { Add-EntraLifecyclePolicyGroup -Id "" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string.*" + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string.*" } - It "Should fail when Id is empty" { - { Add-EntraLifecyclePolicyGroup -Id -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Missing an argument for parameter 'Id'.*" + It "Should fail when GroupLifecyclePolicyId is empty" { + { Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'.*" } It "Should fail when GroupId is invalid" { - { Add-EntraLifecyclePolicyGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string.*" + { Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string.*" } It "Should fail when GroupId is empty" { - { Add-EntraLifecyclePolicyGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'.*" + { Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'.*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraLifecyclePolicyGroup" - Add-EntraLifecyclePolicyGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" + Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraLifecyclePolicyGroup" @@ -60,7 +67,7 @@ Describe "Add-EntraLifecyclePolicyGroup" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraLifecyclePolicyGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Debug } | Should -Not -Throw + { Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraScopedRoleMembership.Tests.ps1 b/test/module/Entra/Add-EntraScopedRoleMembership.Tests.ps1 index 06de04aef..0a57839a9 100644 --- a/test/module/Entra/Add-EntraScopedRoleMembership.Tests.ps1 +++ b/test/module/Entra/Add-EntraScopedRoleMembership.Tests.ps1 @@ -33,16 +33,22 @@ BeforeAll{ } Describe "Tests for Add-EntraScopedRoleMembership"{ It "Result should not be empty"{ + $result = Add-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be @('NewDummyId') + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Result should not be empty with ObjectId"{ $result = Add-EntraScopedRoleMembership -ObjectId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('NewDummyId') Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Add-EntraScopedRoleMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is invalid" { + { Add-EntraScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is empty" { - { Add-EntraScopedRoleMembership -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Add-EntraScopedRoleMembership -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when RoleMemberInfo is invalid" { { Add-EntraScopedRoleMembership -RoleMemberInfo "" } | Should -Throw "Cannot process argument transformation on parameter 'RoleMemberInfo'*" @@ -55,12 +61,10 @@ Describe "Tests for Add-EntraScopedRoleMembership"{ } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraScopedRoleMembership" - Add-EntraScopedRoleMembership -ObjectId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraScopedRoleMembership" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { - $Headers.'User-Agent' | Should -Be $userAgentHeaderValue - $true - } + $result = Add-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember + $params = Get-Parameters -data $result.Parameters + $a= $params | ConvertTo-json | ConvertFrom-Json + $a.headers.'User-Agent' | Should -Be $userAgentHeaderValue } It "Should execute successfully without throwing an error " { # Disable confirmation prompts @@ -69,7 +73,7 @@ Describe "Tests for Add-EntraScopedRoleMembership"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraScopedRoleMembership -ObjectId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember -Debug } | Should -Not -Throw + { Add-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Add-EntraServicePrincipalOwner.Tests.ps1 b/test/module/Entra/Add-EntraServicePrincipalOwner.Tests.ps1 index 71d6ff2a4..1fb3b6e4c 100644 --- a/test/module/Entra/Add-EntraServicePrincipalOwner.Tests.ps1 +++ b/test/module/Entra/Add-EntraServicePrincipalOwner.Tests.ps1 @@ -13,32 +13,38 @@ BeforeAll { Describe "Add-EntraServicePrincipalOwner" { Context "Test for Add-EntraServicePrincipalOwner" { It "Should return empty object" { + $result = Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should update the parameter with Alias" { $result = Add-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraServicePrincipalOwner -ObjectId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when ServicePrincipalId is empty" { + { Add-EntraServicePrincipalOwner -ServicePrincipalId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraServicePrincipalOwner -ObjectId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ServicePrincipalId is invalid" { + { Add-EntraServicePrincipalOwner -ServicePrincipalId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { Mock -CommandName New-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Add-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } It "Should contain BodyParameter in parameters when passed RefObjectId to it" { - Add-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $value = @{"@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $BodyParameter.AdditionalProperties.'@odata.id' | Should -Be $value.'@odata.id' @@ -49,7 +55,7 @@ Describe "Add-EntraServicePrincipalOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraServicePrincipalOwner" - Add-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraServicePrincipalOwner" @@ -65,7 +71,7 @@ Describe "Add-EntraServicePrincipalOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraServicePrincipalOwner -ObjectId "0008861a-d455-4671-bd24-ce9b3bfce288" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Add-EntraServicePrincipalOwner -ServicePrincipalId "0008861a-d455-4671-bd24-ce9b3bfce288" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraAdministrativeUnit.Tests.ps1 b/test/module/Entra/Get-EntraAdministrativeUnit.Tests.ps1 index a792f54af..25bda7a35 100644 --- a/test/module/Entra/Get-EntraAdministrativeUnit.Tests.ps1 +++ b/test/module/Entra/Get-EntraAdministrativeUnit.Tests.ps1 @@ -25,15 +25,20 @@ BeforeAll{ } Describe "Tests for Get-EntraAdministrativeUnit"{ It "Result should not be empty"{ - $result = Get-EntraAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result = Get-EntraAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraAdministrativeUnit -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Result should not be empty objectid"{ + $result = Get-EntraAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when AdministrativeUnitId is empty" { + { Get-EntraAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is null" { - { Get-EntraAdministrativeUnit -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is null" { + { Get-EntraAdministrativeUnit -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when All has an argument" { { Get-EntraAdministrativeUnit -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" @@ -64,7 +69,7 @@ Describe "Tests for Get-EntraAdministrativeUnit"{ } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnit" - $result = Get-EntraAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result = Get-EntraAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnit" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { diff --git a/test/module/Entra/Get-EntraAdministrativeUnitMember.Tests.ps1 b/test/module/Entra/Get-EntraAdministrativeUnitMember.Tests.ps1 index d8e467484..d947363ac 100644 --- a/test/module/Entra/Get-EntraAdministrativeUnitMember.Tests.ps1 +++ b/test/module/Entra/Get-EntraAdministrativeUnitMember.Tests.ps1 @@ -25,15 +25,20 @@ BeforeAll{ } Describe "Tests for Get-EntraAdministrativeUnitMember"{ It "Result should not be empty"{ + $result = Get-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Result should not be empty objectId"{ $result = Get-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraAdministrativeUnitMember -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Get-EntraAdministrativeUnitMember -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is null" { - { Get-EntraAdministrativeUnitMember -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is null" { + { Get-EntraAdministrativeUnitMember -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when All has an argument" { { Get-EntraAdministrativeUnitMember -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" @@ -48,14 +53,14 @@ Describe "Tests for Get-EntraAdministrativeUnitMember"{ { Get-EntraAdministrativeUnitMember -xyz } | Should -Throw "A parameter cannot be found that matches parameter name 'xyz'*" } It "Should return top AdministrativeUnit" { - $result = @(Get-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top 1) + $result = @(Get-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top 1) $result | Should -Not -BeNullOrEmpty $result | Should -HaveCount 1 Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnitMember" - $result = Get-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result = Get-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnitMember" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -70,7 +75,7 @@ Describe "Tests for Get-EntraAdministrativeUnitMember"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top 1 -Debug } | Should -Not -Throw + { Get-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top 1 -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraApplication.Tests.ps1 b/test/module/Entra/Get-EntraApplication.Tests.ps1 index ca9a33b74..8bf55a00a 100644 --- a/test/module/Entra/Get-EntraApplication.Tests.ps1 +++ b/test/module/Entra/Get-EntraApplication.Tests.ps1 @@ -37,17 +37,17 @@ BeforeAll { Describe "Get-EntraApplication" { Context "Test for Get-EntraApplication" { It "Should return specific application" { - $result = Get-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Get-EntraApplication -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is invalid" { + { Get-EntraApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraApplication -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Get-EntraApplication -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should return all applications" { $result = Get-EntraApplication -All @@ -91,12 +91,12 @@ Describe "Get-EntraApplication" { Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Result should Contain ObjectId" { - $result = Get-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Result should Contain ApplicationId" { + $result = Get-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { - $result = Get-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { + $result = Get-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.ApplicationId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } @@ -141,5 +141,13 @@ Describe "Get-EntraApplication" { $DebugPreference = $originalDebugPreference } } + It "Should execute successfully with Alias" { + $result = Get-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Write-Verbose "Result : {$result}" -Verbose + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') + + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + } } } \ No newline at end of file diff --git a/test/module/Entra/Get-EntraApplicationExtensionProperty.Tests.ps1 b/test/module/Entra/Get-EntraApplicationExtensionProperty.Tests.ps1 index f9e7189c4..e66987f5b 100644 --- a/test/module/Entra/Get-EntraApplicationExtensionProperty.Tests.ps1 +++ b/test/module/Entra/Get-EntraApplicationExtensionProperty.Tests.ps1 @@ -25,39 +25,45 @@ BeforeAll { Describe "Get-EntraApplicationExtensionProperty" { Context "Test for Get-EntraApplicationExtensionProperty" { It "Should not return empty" { + $result = Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraApplicationExtensionProperty -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is empty" { + { Get-EntraApplicationExtensionProperty -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } - It "Result should Contain ObjectId" { - $result = Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" + It "Result should Contain ApplicationId" { + $result = Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" $result.ObjectId | should -Be "aaaaaaaa-1111-2222-3333-ccccccccccc" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { - $result = Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { + $result = Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" $params = Get-Parameters -data $result.Parameters $params.ApplicationId | Should -Be "aaaaaaaa-1111-2222-3333-ccccccccccc" } It "Property parameter should work" { - $result = Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Property Name + $result = Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Property Name $result | Should -Not -BeNullOrEmpty $result.Name | Should -Be 'extension_222_324_NewAttribute' Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should fail when Property is empty" { - { Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationExtensionProperty" - $result = Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" + $result = Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationExtensionProperty" Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -72,7 +78,7 @@ BeforeAll { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Debug } | Should -Not -Throw + { Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraApplicationLogo.Tests.ps1 b/test/module/Entra/Get-EntraApplicationLogo.Tests.ps1 index cd55842ef..093e9e754 100644 --- a/test/module/Entra/Get-EntraApplicationLogo.Tests.ps1 +++ b/test/module/Entra/Get-EntraApplicationLogo.Tests.ps1 @@ -22,37 +22,42 @@ BeforeAll { } Describe "Get-EntraApplicationLogo" { + It "Should return empty" { + $result = Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } It "Should return empty" { $result = Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should return empty when passed ileName parameter" { - $result = Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FileName "image" + $result = Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FileName "image" $result | Should -BeNullOrEmpty } It "Should fail when FileName is empty" { - { Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FileName } | Should -Throw "Missing an argument for parameter 'FileName'*" + { Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FileName } | Should -Throw "Missing an argument for parameter 'FileName'*" } It "Should return empty when passed ileName parameter" { - $result = Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -View $true + $result = Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -View $true $result | Should -BeNullOrEmpty } It "Should fail when View is invalid" { - { Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -View "cc" } | Should -Throw "Cannot process argument transformation on parameter 'View'*" + { Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -View "cc" } | Should -Throw "Cannot process argument transformation on parameter 'View'*" } It "Should fail when View is empty" { - { Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -View } | Should -Throw "Missing an argument for parameter 'View'*" + { Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -View } | Should -Throw "Missing an argument for parameter 'View'*" } - It "Should fail when ObjectId is empty" { - { Get-EntraApplicationLogo -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Get-EntraApplicationLogo -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { Get-EntraApplicationLogo -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { Get-EntraApplicationLogo -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationLogo" - Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" + Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationLogo" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue @@ -66,7 +71,7 @@ Describe "Get-EntraApplicationLogo" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" -Debug } | Should -Not -Throw + { Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraApplicationModule.Tests.ps1 b/test/module/Entra/Get-EntraApplicationModule.Tests.ps1 index f38ee7ef8..c6236d2ff 100644 --- a/test/module/Entra/Get-EntraApplicationModule.Tests.ps1 +++ b/test/module/Entra/Get-EntraApplicationModule.Tests.ps1 @@ -33,7 +33,7 @@ Describe "Get-EntraApplication" { It 'Should have Get parameterSet' { $GetAzureADApplication = Get-Command Get-EntraApplication $GetParameterSet = $GetAzureADApplication.ParameterSets | Where-Object Name -eq "GetById" - $GetParameterSet.Parameters.Name | Should -Contain ObjectId + $GetParameterSet.Parameters.Name | Should -Contain ApplicationId } It 'Should have GetViaIdentity parameterSet' { diff --git a/test/module/Entra/Get-EntraApplicationOwner.Tests.ps1 b/test/module/Entra/Get-EntraApplicationOwner.Tests.ps1 index ebde421cd..c0de5b74f 100644 --- a/test/module/Entra/Get-EntraApplicationOwner.Tests.ps1 +++ b/test/module/Entra/Get-EntraApplicationOwner.Tests.ps1 @@ -32,18 +32,18 @@ BeforeAll { Describe "Get-EntraApplicationOwner"{ Context "Test for Get-EntraApplicationOwner"{ It "Should return application owner" { - $result = Get-EntraApplicationOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraApplicationOwner -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" Write-Host $result $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb') Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraApplicationOwner -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is empty" { + { Get-EntraApplicationOwner -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } - It "Should fail when ObjectId is null" { - { Get-EntraApplicationOwner -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { Get-EntraApplicationOwner -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should fail when All has an argument" { { Get-EntraApplicationOwner -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" @@ -55,13 +55,13 @@ Describe "Get-EntraApplicationOwner"{ { Get-EntraApplicationOwner -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Property parameter should work" { - $result = Get-EntraApplicationOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraApplicationOwner -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationOwner" - $result = Get-EntraApplicationOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraApplicationOwner -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationOwner" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -76,7 +76,7 @@ Describe "Get-EntraApplicationOwner"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraApplicationOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraApplicationOwner -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraApplicationPasswordCredential.Tests.ps1 b/test/module/Entra/Get-EntraApplicationPasswordCredential.Tests.ps1 index 115c04eeb..126b30ab1 100644 --- a/test/module/Entra/Get-EntraApplicationPasswordCredential.Tests.ps1 +++ b/test/module/Entra/Get-EntraApplicationPasswordCredential.Tests.ps1 @@ -27,21 +27,21 @@ BeforeAll { Describe "Get-EntraApplicationPasswordCredential" { Context "Test for Get-EntraApplicationPasswordCredential" { It "Should not return empty" { - $result = Get-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraApplicationPasswordCredential -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Get-EntraApplicationPasswordCredential -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { Get-EntraApplicationPasswordCredential -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { Get-EntraApplicationPasswordCredential -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should fail when invalid parameter is passed" { { Get-EntraApplicationPasswordCredential -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'*" } It "Property parameter should work" { - $result = Get-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Test" @@ -49,12 +49,12 @@ BeforeAll { } It "Should fail when Property is empty" { - { Get-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationPasswordCredential" - $result = Get-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationPasswordCredential" Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -69,7 +69,7 @@ BeforeAll { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraAttributeSet.Tests.ps1 b/test/module/Entra/Get-EntraAttributeSet.Tests.ps1 index 7e076eb4e..69bf952e6 100644 --- a/test/module/Entra/Get-EntraAttributeSet.Tests.ps1 +++ b/test/module/Entra/Get-EntraAttributeSet.Tests.ps1 @@ -24,29 +24,36 @@ BeforeAll { Describe "Get-EntraAttributeSet" { Context "Test for Get-EntraAttributeSet" { It "Should return AttributeSets with any parameter" { - $result = Get-EntraAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should return specific AttributeSet" { + $result = Get-EntraAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific AttributeSet with alias" { $result = Get-EntraAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is invalid" { - { Get-EntraAttributeSet -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when AttributeSetId is invalid" { + { Get-EntraAttributeSet -AttributeSetId "" } | Should -Throw "Cannot bind argument to parameter 'AttributeSetId' because it is an empty string." } - It "Should fail when Id is empty" { - { Get-EntraAttributeSet -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when AttributeSetId is empty" { + { Get-EntraAttributeSet -AttributeSetId } | Should -Throw "Missing an argument for parameter 'AttributeSetId'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAttributeSet" - Get-EntraAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" | Out-Null + Get-EntraAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Out-Null Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true @@ -60,7 +67,7 @@ Describe "Get-EntraAttributeSet" { try { # Act & Assert: Ensure the function doesn't throw an exception { - Get-EntraAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug + Get-EntraAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference diff --git a/test/module/Entra/Get-EntraAuditSignInLog.Tests.ps1 b/test/module/Entra/Get-EntraAuditSignInLog.Tests.ps1 index bd5e819e7..57a0dab03 100644 --- a/test/module/Entra/Get-EntraAuditSignInLog.Tests.ps1 +++ b/test/module/Entra/Get-EntraAuditSignInLog.Tests.ps1 @@ -48,13 +48,19 @@ BeforeAll { Describe "Get-EntraAuditSignInLog" { Context "Test for Get-EntraAuditSignInLog" { It "Should return specific Audit SignIn Logs" { + $result = Get-EntraAuditSignInLog -SignInId "bbbbbbbb-1111-2222-3333-cccccccccc22" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccc22' + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific Audit SignIn Logs with alias" { $result = Get-EntraAuditSignInLog -Id "bbbbbbbb-1111-2222-3333-cccccccccc22" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccc22' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Get-EntraAuditSignInLog -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when SignInId is empty" { + { Get-EntraAuditSignInLog -SignInId } | Should -Throw "Missing an argument for parameter 'SignInId'*" } It "Should fail when filter is empty" { { Get-EntraAuditSignInLog -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" @@ -86,13 +92,13 @@ Describe "Get-EntraAuditSignInLog" { Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should contain ID in parameters when passed Id to it" { - $result = Get-EntraAuditSignInLog -Id "bbbbbbbb-1111-2222-3333-cccccccccc22" + $result = Get-EntraAuditSignInLog -SignInId "bbbbbbbb-1111-2222-3333-cccccccccc22" $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc22" } It "Should contain 'User-Agent' header" { Mock -CommandName Invoke-GraphRequest -MockWith {$args} -ModuleName Microsoft.Graph.Entra $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAuditSignInLog" - $result = Get-EntraAuditSignInLog -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraAuditSignInLog -SignInId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue @@ -106,7 +112,7 @@ Describe "Get-EntraAuditSignInLog" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraAuditSignInLog -Id "bbbbbbbb-1111-2222-3333-cccccccccc22" -Debug } | Should -Not -Throw + { Get-EntraAuditSignInLog -SignInId "bbbbbbbb-1111-2222-3333-cccccccccc22" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraContact.Tests.ps1 b/test/module/Entra/Get-EntraContact.Tests.ps1 index d6f2760e6..1ba8b88d6 100644 --- a/test/module/Entra/Get-EntraContact.Tests.ps1 +++ b/test/module/Entra/Get-EntraContact.Tests.ps1 @@ -48,6 +48,20 @@ BeforeAll { Describe "Get-EntraContact" { Context "Test for Get-EntraContact" { It "Should return specific Contact" { + $result = Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + $result.OnPremisesSyncEnabled | Should -BeNullOrEmpty + $result.OnPremisesLastSyncDateTime | Should -BeNullOrEmpty + $result.Phones | Should -BeNullOrEmpty + $result.ServiceProvisioningErrors | Should -BeNullOrEmpty + $result.Mobile | Should -BeNullOrEmpty + $result.TelephoneNumber | Should -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific Contact alias" { $result = Get-EntraContact -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' @@ -60,13 +74,14 @@ Describe "Get-EntraContact" { Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 } + - It "Should fail when ObjectId is empty" { - { Get-EntraContact -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when OrgContactId is empty" { + { Get-EntraContact -OrgContactId } | Should -Throw "Missing an argument for parameter 'OrgContactId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraContact -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when OrgContactId is invalid" { + { Get-EntraContact -OrgContactId "" } | Should -Throw "Cannot bind argument to parameter 'OrgContactId' because it is an empty string." } It "Should return all contact" { @@ -106,31 +121,31 @@ Describe "Get-EntraContact" { { Get-EntraContact -Top xy } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraContact -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Result should Contain OrgContactId" { + $result = Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } - It "Should contain OrgContactId in parameters when passed ObjectId to it" { - $result = Get-EntraContact -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Should contain OrgContactId in parameters when passed OrgContactId to it" { + $result = Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result.Parameters $params.OrgContactId | Should -Match "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } It "Property parameter should work" { - $result = Get-EntraContact -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property DisplayName + $result = Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Bob Kelly (TAILSPIN)' Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraContact -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraContact" - $result = Get-EntraContact -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraContact" @@ -148,7 +163,7 @@ Describe "Get-EntraContact" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraContact -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + { Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraContactMembership.Tests.ps1 b/test/module/Entra/Get-EntraContactMembership.Tests.ps1 index 2faa9bb97..2d917c32a 100644 --- a/test/module/Entra/Get-EntraContactMembership.Tests.ps1 +++ b/test/module/Entra/Get-EntraContactMembership.Tests.ps1 @@ -11,7 +11,7 @@ BeforeAll { return @( [PSCustomObject]@{ "Id" = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - " DeletedDateTime" = $null + "DeletedDateTime" = $null "AdditionalProperties" = @{"@odata.type" ="#microsoft.graph.group" "DisplayName" = "All Employees" "MailNickname" = "Employees" @@ -32,6 +32,15 @@ BeforeAll { Describe "Get-EntraContactMembership" { Context "Test for Get-EntraContactMembership" { It "Should return specific Contact Membership" { + $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + $result.DeletedDateTime | Should -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific Contact Membership with alias" { $result = Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' @@ -40,48 +49,48 @@ Describe "Get-EntraContactMembership" { Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Get-EntraContactMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when OrgContactId is invalid" { + { Get-EntraContactMembership -OrgContactId "" } | Should -Throw "Cannot bind argument to parameter 'OrgContactId' because it is an empty string." } It "Should return all Contact Membership" { - $result = Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -All + $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All is invalid" { - { Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" + { Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" } It "Should return top Contact Membership" { - $result = Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Top 1 + $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Top DF } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Top DF } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should Contain ObjectId" { - $result = Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } - It "Should contain OrgContactId in parameters when passed ObjectId to it" { - $result = Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Should contain OrgContactId in parameters when passed OrgContactId to it" { + $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result.Parameters $params.OrgContactId | Should -Match "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } It "Property parameter should work" { - $result = Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property Id + $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' @@ -89,13 +98,13 @@ Describe "Get-EntraContactMembership" { } It "Should fail when Property is empty" { - { Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraContactMembership" - $result = Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraContactMembership" @@ -113,7 +122,7 @@ Describe "Get-EntraContactMembership" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraContactMembership -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + { Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDeletedApplication.Tests.ps1 b/test/module/Entra/Get-EntraDeletedApplication.Tests.ps1 index 36f50b989..8be7ecb45 100644 --- a/test/module/Entra/Get-EntraDeletedApplication.Tests.ps1 +++ b/test/module/Entra/Get-EntraDeletedApplication.Tests.ps1 @@ -54,7 +54,7 @@ BeforeAll { Describe "Get-EntraDeletedApplication" { Context "Test for Get-EntraDeletedApplication" { It "Should return all applications" { - $result = Get-EntraDeletedApplication | ConvertTo-Json -Depth 10 | ConvertFrom-Json + $result = Get-EntraDeletedApplication | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 } @@ -65,31 +65,31 @@ Describe "Get-EntraDeletedApplication" { { Get-EntraDeletedApplication -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'*" } It "Should return specific application by searchstring" { - $result = Get-EntraDeletedApplication -SearchString 'Mock-test-App' | ConvertTo-Json -Depth 10 | ConvertFrom-Json + $result = Get-EntraDeletedApplication -SearchString 'Mock-test-App' | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-test-App' Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should return specific application by filter" { - $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 10 | ConvertFrom-Json + $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-test-App' Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should return top application" { - $result = Get-EntraDeletedApplication -Top 1 | ConvertTo-Json -Depth 10 | ConvertFrom-Json + $result = Get-EntraDeletedApplication -Top 1 | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 } It "Result should Contain ObjectId" { - $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 10 | ConvertFrom-Json + $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result.ObjectId | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain Filter in parameters when passed SearchString to it" { - $result = Get-EntraDeletedApplication -SearchString 'Mock-test-App' | ConvertTo-Json -Depth 10| ConvertFrom-Json + $result = Get-EntraDeletedApplication -SearchString 'Mock-test-App' | ConvertTo-Json -Depth 5| ConvertFrom-Json $params = Get-Parameters -data $result.Parameters $params.Filter | Should -Match "Mock-test-App" } @@ -106,7 +106,7 @@ Describe "Get-EntraDeletedApplication" { } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedApplication" - $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 10 | ConvertFrom-Json + $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedApplication" Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { diff --git a/test/module/Entra/Get-EntraDeletedDirectoryObject.Tests.ps1 b/test/module/Entra/Get-EntraDeletedDirectoryObject.Tests.ps1 index bc05403bc..637d7026f 100644 --- a/test/module/Entra/Get-EntraDeletedDirectoryObject.Tests.ps1 +++ b/test/module/Entra/Get-EntraDeletedDirectoryObject.Tests.ps1 @@ -22,26 +22,30 @@ BeforeAll { } Describe "Get-EntraDeletedDirectoryObject"{ - It "Should fail when Id is empty" { - { Get-EntraDeletedDirectoryObject -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id'*" + It "Result should return DeletedDirectoryObject using alias" { + $result = Get-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.ObjectId | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should fail when DirectoryObjectId is empty" { + { Get-EntraDeletedDirectoryObject -DirectoryObjectId "" } | Should -Throw "Cannot bind argument to parameter 'DirectoryObjectId'*" } - It "Should fail when Id is null" { - { Get-EntraDeletedDirectoryObject -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when DirectoryObjectId is null" { + { Get-EntraDeletedDirectoryObject -DirectoryObjectId } | Should -Throw "Missing an argument for parameter 'DirectoryObjectId'*" } It "Should fail when invalid parameter is passed" { { Get-EntraDeletedDirectoryObject -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'*" } It "Result should Contain ObjectId" { - $result = Get-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeletedDirectoryObject -DirectoryObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - } + } It "Should contain DirectoryObjectId in parameters when passed Id to it" { - $result = Get-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeletedDirectoryObject -DirectoryObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.DirectoryObjectId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraDeletedDirectoryObject -DirectoryObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -49,11 +53,11 @@ Describe "Get-EntraDeletedDirectoryObject"{ } It "Should fail when Property is empty" { - {Get-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + {Get-EntraDeletedDirectoryObject -DirectoryObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedDirectoryObject" - $result = Get-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeletedDirectoryObject -DirectoryObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedDirectoryObject" Should -Invoke -CommandName Get-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -68,7 +72,7 @@ Describe "Get-EntraDeletedDirectoryObject"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraDeletedDirectoryObject -DirectoryObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDeletedGroup.Tests.ps1 b/test/module/Entra/Get-EntraDeletedGroup.Tests.ps1 index e5b9d4f4c..4db95da6a 100644 --- a/test/module/Entra/Get-EntraDeletedGroup.Tests.ps1 +++ b/test/module/Entra/Get-EntraDeletedGroup.Tests.ps1 @@ -31,6 +31,15 @@ BeforeAll { Describe "Get-EntraDeletedGroup" { Context "Test for Get-EntraDeletedGroup" { It "Should return specific Deleted Group" { + $result = Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.DisplayName | Should -Be "Mock-App" + $result.GroupTypes | Should -Be "Unified" + + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific Deleted Group with alias" { $result = Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -39,11 +48,11 @@ Context "Test for Get-EntraDeletedGroup" { Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Get-EntraDeletedGroup -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when GroupId is empty" { + { Get-EntraDeletedGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when Id is invalid" { - { Get-EntraDeletedGroup -Id ""} | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Get-EntraDeletedGroup -GroupId ""} | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should return All deleted groups" { $result = Get-EntraDeletedGroup -All @@ -52,7 +61,7 @@ Context "Test for Get-EntraDeletedGroup" { Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All is invalid" { - { Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" } It "Should return top 1 deleted group" { $result = Get-EntraDeletedGroup -Top 1 @@ -64,10 +73,10 @@ Context "Test for Get-EntraDeletedGroup" { Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Top is empty" { - { Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Should return specific deleted group by filter" { $result = Get-EntraDeletedGroup -Filter "DisplayName eq 'Mock-App'" @@ -94,17 +103,17 @@ Context "Test for Get-EntraDeletedGroup" { { Get-EntraDeletedGroup -SearchString } | Should -Throw "Missing an argument for parameter 'SearchString'*" } It "Property parameter should work" { - $result = Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } - It "Should contain DirectoryObjectId in parameters when passed Id to it" { - $result = Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain GroupId in parameters when passed Id to it" { + $result = Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.DirectoryObjectId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -115,7 +124,7 @@ Context "Test for Get-EntraDeletedGroup" { } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedGroup" - $result = Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedGroup" Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -130,7 +139,7 @@ Context "Test for Get-EntraDeletedGroup" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDevice.Tests.ps1 b/test/module/Entra/Get-EntraDevice.Tests.ps1 index 4fa142fa3..c2514635f 100644 --- a/test/module/Entra/Get-EntraDevice.Tests.ps1 +++ b/test/module/Entra/Get-EntraDevice.Tests.ps1 @@ -51,14 +51,35 @@ BeforeAll { Describe "Get-EntraDevice" { Context "Test for Get-EntraDevice" { It "Should return specific device" { - $result = Get-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-ccccccccccc" + $result = Get-EntraDevice -DeviceId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb') Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraDevice -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should return specific device with Alias" { + $result = Get-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when DeviceId is invalid" { + { Get-EntraDevice -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." + } + It "Should fail when DeviceId is empty" { + { Get-EntraDevice -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" + } + It "Should fail when searchstring is empty" { + { Get-EntraDevice -SearchString } | Should -Throw "Missing an argument for parameter 'SearchString'*" + } + It "Should fail when filter is empty" { + { Get-EntraDevice -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" + } + It "Should fail when Top is empty" { + { Get-EntraDevice -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + } + It "Should fail when Top is invalid" { + { Get-EntraDevice -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Should return all devices" { $result = Get-EntraDevice -All @@ -100,11 +121,11 @@ Describe "Get-EntraDevice" { { Get-EntraDevice -Property DisplayName -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Result should Contain ObjectId" { - $result = Get-EntraDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDevice -DeviceId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.ObjectId | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain DeviceId in parameters when passed ObjectId to it" { - $result = Get-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraDevice -DeviceId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.DeviceId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } diff --git a/test/module/Entra/Get-EntraDeviceRegisteredOwner.Tests.ps1 b/test/module/Entra/Get-EntraDeviceRegisteredOwner.Tests.ps1 index 18c3b502f..1588867f3 100644 --- a/test/module/Entra/Get-EntraDeviceRegisteredOwner.Tests.ps1 +++ b/test/module/Entra/Get-EntraDeviceRegisteredOwner.Tests.ps1 @@ -36,20 +36,27 @@ BeforeAll { Describe "Get-EntraDeviceRegisteredOwner" { Context "Test for Get-EntraDeviceRegisteredOwner" { It "Should return specific device registered owner" { + $result = Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific device registered owner with alias" { $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraDeviceRegisteredOwner -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when DeviceId is empty" { + { Get-EntraDeviceRegisteredOwner -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraDeviceRegisteredOwner -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when DeviceId is invalid" { + { Get-EntraDeviceRegisteredOwner -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" } It "Should return all device registered owner" { - $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' @@ -57,24 +64,24 @@ Describe "Get-EntraDeviceRegisteredOwner" { } It "Should fail when All is invalid" { - { Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" + { Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" } It "Should return top device registered owner" { - $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should contain Alias property" { - $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.DeletionTimestamp | should -Be $null $result.DirSyncEnabled | should -Be $null @@ -89,7 +96,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { } It "Should contain DeviceId in parameters when passed Name to it" { - $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $para= $params | ConvertTo-json | ConvertFrom-Json $para.URI | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -97,7 +104,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeviceRegisteredOwner" - $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeviceRegisteredOwner" @@ -109,7 +116,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { } It "Property parameter should work" { - $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property mobilePhone + $result = Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property mobilePhone $result | Should -Not -BeNullOrEmpty $result.mobilePhone | Should -Be '425-555-0100' @@ -117,7 +124,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { } It "Should fail when Property is empty" { - { Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should execute successfully without throwing an error" { @@ -127,7 +134,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDeviceRegisteredUser.Tests.ps1 b/test/module/Entra/Get-EntraDeviceRegisteredUser.Tests.ps1 index a0aa4e9df..34aa7d687 100644 --- a/test/module/Entra/Get-EntraDeviceRegisteredUser.Tests.ps1 +++ b/test/module/Entra/Get-EntraDeviceRegisteredUser.Tests.ps1 @@ -36,20 +36,27 @@ BeforeAll { Describe "Get-EntraDeviceRegisteredUser" { Context "Test for Get-EntraDeviceRegisteredUser" { It "Should return specific device registered User" { + $result = Get-EntraDeviceRegisteredUser -DeviceId "8542ebd1-3d49-4073-9dce-30f197c67755" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific device registered User with alias" { $result = Get-EntraDeviceRegisteredUser -ObjectId "8542ebd1-3d49-4073-9dce-30f197c67755" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraDeviceRegisteredUser -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when DeviceId is empty" { + { Get-EntraDeviceRegisteredUser -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraDeviceRegisteredUser -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when DeviceId is invalid" { + { Get-EntraDeviceRegisteredUser -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" } It "Should return all device registered owner" { - $result = Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' @@ -57,21 +64,21 @@ Describe "Get-EntraDeviceRegisteredUser" { } It "Should return top device registered owner" { - $result = Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should contain Alias property" { - $result = Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.DeletionTimestamp | should -Be $null $result.DirSyncEnabled | should -Be $null @@ -86,7 +93,7 @@ Describe "Get-EntraDeviceRegisteredUser" { } It "Should contain DeviceId in parameters when passed Name to it" { - $result = Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $Para= $params | ConvertTo-json | ConvertFrom-Json $para.URI | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -94,7 +101,7 @@ Describe "Get-EntraDeviceRegisteredUser" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeviceRegisteredUser" - $result = Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $a= $params | ConvertTo-json | ConvertFrom-Json $a.headers.'User-Agent' | Should -Be $userAgentHeaderValue @@ -103,7 +110,7 @@ Describe "Get-EntraDeviceRegisteredUser" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeviceRegisteredUser" - $result = Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeviceRegisteredUser" @@ -115,7 +122,7 @@ Describe "Get-EntraDeviceRegisteredUser" { } It "Should fail when Property is empty" { - { Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should execute successfully without throwing an error" { @@ -125,7 +132,7 @@ Describe "Get-EntraDeviceRegisteredUser" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDirectoryRole.Tests.ps1 b/test/module/Entra/Get-EntraDirectoryRole.Tests.ps1 index c93f1da2a..f07dd363c 100644 --- a/test/module/Entra/Get-EntraDirectoryRole.Tests.ps1 +++ b/test/module/Entra/Get-EntraDirectoryRole.Tests.ps1 @@ -30,14 +30,21 @@ BeforeAll { Describe "Get-EntraDirectoryRole" { Context "Test for Get-EntraDirectoryRole" { It "Should return specific role" { + $result = Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + + Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraDirectoryRole -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when DirectoryRoleId is empty" { + { Get-EntraDirectoryRole -DirectoryRoleId "" } | Should -Throw "Cannot bind argument to parameter 'DirectoryRoleId' because it is an empty string." } It "Should return specific role by filter" { $result = Get-EntraDirectoryRole -Filter "DisplayName -eq 'Attribute Assignment Reader'" @@ -46,28 +53,28 @@ BeforeAll { Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Result should Contain ObjectId" { - $result = Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Result should Contain DirectoryRoleId" { + $result = Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } - It "Should contain DirectoryRoleId in parameters when passed ObjectId to it" { - $result = Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should contain DirectoryRoleId in parameters when passed DirectoryRoleId to it" { + $result = Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.DirectoryRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Property parameter should work" { - $result = Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property DisplayName + $result = Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Attribute Assignment Reader' Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRole" - $result = Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRole" Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -82,7 +89,7 @@ BeforeAll { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDirectoryRoleAssignment.Tests.ps1 b/test/module/Entra/Get-EntraDirectoryRoleAssignment.Tests.ps1 index d45d30fa8..c5cc6ec69 100644 --- a/test/module/Entra/Get-EntraDirectoryRoleAssignment.Tests.ps1 +++ b/test/module/Entra/Get-EntraDirectoryRoleAssignment.Tests.ps1 @@ -32,16 +32,22 @@ BeforeAll { Describe "Get-EntraDirectoryRoleAssignment" { Context "Test for Get-EntraDirectoryRoleAssignment" { It "Should return specific role assignment" { + $result = Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Get-EntraDirectoryRoleAssignment -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when Get-EntraDirectoryRoleAssignment is empty" { + { Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId } | Should -Throw "Missing an argument for parameter 'UnifiedRoleAssignmentId'*" } - It "Should fail when Id is invalid" { - { Get-EntraDirectoryRoleAssignment -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when Get-EntraDirectoryRoleAssignment is invalid" { + { Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'UnifiedRoleAssignmentId' because it is an empty string." } It "Should return all role assignments" { $result = Get-EntraDirectoryRoleAssignment -All @@ -76,28 +82,28 @@ Describe "Get-EntraDirectoryRoleAssignment" { } It "Result should Contain ObjectId" { - $result = Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + $result = Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $result.ObjectId | should -Be "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" } It "Should contain UnifiedRoleAssignmentId in parameters when passed Id to it" { - $result = Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + $result = Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $params = Get-Parameters -data $result.Parameters $params.UnifiedRoleAssignmentId | Should -Be "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" } It "Property parameter should work" { - $result = Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Property PrincipalId + $result = Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Property PrincipalId $result | Should -Not -BeNullOrEmpty $result.PrincipalId | Should -Be 'aaaaaaaa-bbbb-cccc-1111-222222222222' Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleAssignment" - Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleAssignment" @@ -113,7 +119,7 @@ Describe "Get-EntraDirectoryRoleAssignment" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Debug } | Should -Not -Throw + { Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDirectoryRoleDefinition.Tests.ps1 b/test/module/Entra/Get-EntraDirectoryRoleDefinition.Tests.ps1 index a107c363f..8723cf56e 100644 --- a/test/module/Entra/Get-EntraDirectoryRoleDefinition.Tests.ps1 +++ b/test/module/Entra/Get-EntraDirectoryRoleDefinition.Tests.ps1 @@ -35,6 +35,14 @@ BeforeAll { Describe "Get-EntraDirectoryRoleDefinition" { Context "Test for Get-EntraDirectoryRoleDefinition" { It "Should return specificrole Defination" { + $result = Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "0000aaaa-11bb-cccc-dd22-eeeeee333333" + $result | Should -Not -BeNullOrEmpty + $result.DisplayName | Should -Be "Mock-App" + $result.Id | Should -Be "0000aaaa-11bb-cccc-dd22-eeeeee333333" + + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specificrole Defination With Alias" { $result = Get-EntraDirectoryRoleDefinition -Id "0000aaaa-11bb-cccc-dd22-eeeeee333333" $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Mock-App" @@ -42,11 +50,11 @@ Describe "Get-EntraDirectoryRoleDefinition" { Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Get-EntraDirectoryRoleDefinition -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when UnifiedRoleDefinitionId is empty" { + { Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId } | Should -Throw "Missing an argument for parameter 'UnifiedRoleDefinitionId'*" } - It "Should fail when Id is invalid" { - { Get-EntraDirectoryRoleDefinition -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when UnifiedRoleDefinitionId is invalid" { + { Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "" } | Should -Throw "Cannot bind argument to parameter 'UnifiedRoleDefinitionId' because it is an empty string." } It "Should return all role assignments" { $result = Get-EntraDirectoryRoleDefinition -All @@ -90,7 +98,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { { Get-EntraDirectoryRoleDefinition -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" } It "Result should Contain ObjectId" { - $result = Get-EntraDirectoryRoleDefinition -Id "0000aaaa-11bb-cccc-dd22-eeeeee333333" + $result = Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "0000aaaa-11bb-cccc-dd22-eeeeee333333" $result.ObjectId | should -Be "0000aaaa-11bb-cccc-dd22-eeeeee333333" } It "Should contain Filter in parameters when passed SearchString to it" { @@ -99,19 +107,19 @@ Describe "Get-EntraDirectoryRoleDefinition" { $params.Filter | Should -Match "Mock-App" } It "Property parameter should work" { - $result = Get-EntraDirectoryRoleDefinition -Id "0000aaaa-11bb-cccc-dd22-eeeeee333333" -Property DisplayName + $result = Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "0000aaaa-11bb-cccc-dd22-eeeeee333333" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraDirectoryRoleDefinition -Id "0000aaaa-11bb-cccc-dd22-eeeeee333333" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "0000aaaa-11bb-cccc-dd22-eeeeee333333" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleDefinition" - Get-EntraDirectoryRoleDefinition -Id "0000aaaa-11bb-cccc-dd22-eeeeee333333" + Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "0000aaaa-11bb-cccc-dd22-eeeeee333333" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleDefinition" @@ -127,7 +135,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDirectoryRoleDefinition -Id "0000aaaa-11bb-cccc-dd22-eeeeee333333" -Debug } | Should -Not -Throw + { Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "0000aaaa-11bb-cccc-dd22-eeeeee333333" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraDirectoryRoleMember.Tests.ps1 b/test/module/Entra/Get-EntraDirectoryRoleMember.Tests.ps1 index 298a59403..a24871e3a 100644 --- a/test/module/Entra/Get-EntraDirectoryRoleMember.Tests.ps1 +++ b/test/module/Entra/Get-EntraDirectoryRoleMember.Tests.ps1 @@ -30,20 +30,27 @@ BeforeAll { Describe "EntraDirectoryRoleMember" { Context "Test for EntraDirectoryRoleMember" { It "Should return specific directory rolemember" { + $result = (Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb") | ConvertTo-json | ConvertFrom-json + $result | Should -Not -BeNullOrEmpty + $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific directory rolemember with alias" { $result = (Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb") | ConvertTo-json | ConvertFrom-json $result | Should -Not -BeNullOrEmpty $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraDirectoryRoleMember -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when DirectoryRoleId is empty" { + { Get-EntraDirectoryRoleMember -DirectoryRoleId } | Should -Throw "Missing an argument for parameter 'DirectoryRoleId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraDirectoryRoleMember -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when DirectoryRoleId is invalid" { + { Get-EntraDirectoryRoleMember -DirectoryRoleId "" } | Should -Throw "Cannot bind argument to parameter 'DirectoryRoleId' because it is an empty string.*" } It "Result should Contain Alias property" { - $result = Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.DirSyncEnabled | should -Be $null $result.LastDirSyncTime | should -Be $null @@ -51,27 +58,27 @@ Describe "EntraDirectoryRoleMember" { $result.ProvisioningErrors | Should -BeNullOrEmpty $result.TelephoneNumber | should -Be "425-555-0100" } - It "Should contain ObjectId in URI" { - $result = Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain DirectoryRoleId in URI" { + $result = Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $Para= $params | ConvertTo-json | ConvertFrom-Json $Para.URI | Should -match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleMember" - Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleMember" @@ -87,7 +94,7 @@ Describe "EntraDirectoryRoleMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraGroup.Tests.ps1 b/test/module/Entra/Get-EntraGroup.Tests.ps1 index 47ba25693..1f72a6435 100644 --- a/test/module/Entra/Get-EntraGroup.Tests.ps1 +++ b/test/module/Entra/Get-EntraGroup.Tests.ps1 @@ -28,14 +28,26 @@ BeforeAll { Describe "Get-EntraGroup" { Context "Test for Get-EntraGroup" { It "Should return specific group" { - $result = Get-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when GroupId is empty" { + { Get-EntraGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is empty" { - { Get-EntraGroup -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when searchstring is empty" { + { Get-EntraGroup -SearchString } | Should -Throw "Missing an argument for parameter 'SearchString'*" + } + It "Should fail when filter is empty" { + { Get-EntraGroup -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" + } + It "Should fail when Top is empty" { + { Get-EntraGroup -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + } + It "Should fail when Top is invalid" { + { Get-EntraGroup -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Should return all group" { $result = Get-EntraGroup -All @@ -67,11 +79,11 @@ Describe "Get-EntraGroup" { Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 } It "Result should Contain ObjectId" { - $result = Get-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } - It "Should contain GroupId in parameters when passed ObjectId to it" { - $result = Get-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should contain GroupId in parameters when passed GroupId to it" { + $result = Get-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.GroupId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } @@ -82,7 +94,7 @@ Describe "Get-EntraGroup" { } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroup" - $result = Get-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroup" Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { diff --git a/test/module/Entra/Get-EntraGroupAppRoleAssignment.Tests.ps1 b/test/module/Entra/Get-EntraGroupAppRoleAssignment.Tests.ps1 index e15af2094..8bd49fd7b 100644 --- a/test/module/Entra/Get-EntraGroupAppRoleAssignment.Tests.ps1 +++ b/test/module/Entra/Get-EntraGroupAppRoleAssignment.Tests.ps1 @@ -28,10 +28,21 @@ BeforeAll { Mock -CommandName Get-MgGroupAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra } -Describe "New-EntraGroupAppRoleAssignment" { -Context "Test for New-EntraGroupAppRoleAssignment" { +Describe "Get-EntraGroupAppRoleAssignment" { +Context "Test for Get-EntraGroupAppRoleAssignment" { It "Should return specific Group AppRole Assignment" { - $result = Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" + $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + + + Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific Group AppRole Assignment with alias" { + $result = Get-EntraGroupAppRoleAssignment -objectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" @@ -42,13 +53,13 @@ Context "Test for New-EntraGroupAppRoleAssignment" { Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when ObjectlId is empty" { - { Get-EntraGroupAppRoleAssignment -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + { Get-EntraGroupAppRoleAssignment -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } It "Should fail when ObjectlId is invalid" { - { Get-EntraGroupAppRoleAssignment -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Get-EntraGroupAppRoleAssignment -GroupId ""} | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should return All Group AppRole Assignment" { - $result = Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" @@ -59,10 +70,10 @@ Context "Test for New-EntraGroupAppRoleAssignment" { Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All is invalid" { - { Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" } It "Should return top 1 Group AppRole Assignment" { - $result = Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" @@ -73,34 +84,34 @@ Context "Test for New-EntraGroupAppRoleAssignment" { Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Top is empty" { - { Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Property parameter should work" { - $result = Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.PrincipalDisplayName | Should -Be 'Mock-Group' Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Result should Contain GroupId" { + $result = Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" } It "Should contain GroupId in parameters when passed Id to it" { - $result = Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.GroupId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupAppRoleAssignment" - $result = Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupAppRoleAssignment" @@ -117,7 +128,7 @@ Context "Test for New-EntraGroupAppRoleAssignment" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraGroupLifecyclePolicy.Tests.ps1 b/test/module/Entra/Get-EntraGroupLifecyclePolicy.Tests.ps1 index fb829c351..5a4be8d3d 100644 --- a/test/module/Entra/Get-EntraGroupLifecyclePolicy.Tests.ps1 +++ b/test/module/Entra/Get-EntraGroupLifecyclePolicy.Tests.ps1 @@ -34,9 +34,14 @@ Describe "Get-EntraGroupLifecyclePolicy" { Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 } + It "Should execute successfully with Alias" { + $result = Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + $result.GroupLifetimeInDays | Should -Be 200 + } It "Retrieve properties of an groupLifecyclePolicy" { - $result = Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $result.ObjectId | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' $result.GroupLifetimeInDays | Should -Be 200 @@ -47,22 +52,22 @@ Describe "Get-EntraGroupLifecyclePolicy" { Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Get-EntraGroupLifecyclePolicy -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when GroupLifecyclePolicyId is empty" { + { Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'*" } - It "Should fail when Id is invalid" { - { Get-EntraGroupLifecyclePolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string." } - It "Should contain GroupLifecyclePolicyId in parameters when passed Id to it" { - $result = Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Should contain GroupLifecyclePolicyId in parameters when passed GroupLifecyclePolicyId to it" { + $result = Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result.Parameters $params.GroupLifecyclePolicyId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } It "Property parameter should work" { - $result = Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property Id + $result = Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" @@ -70,13 +75,13 @@ Describe "Get-EntraGroupLifecyclePolicy" { } It "Should fail when Property is empty" { - { Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupLifecyclePolicy" - $result = Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupLifecyclePolicy" @@ -94,7 +99,7 @@ Describe "Get-EntraGroupLifecyclePolicy" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + { Get-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraGroupMember.Tests.ps1 b/test/module/Entra/Get-EntraGroupMember.Tests.ps1 index a30b6124f..93ff0695b 100644 --- a/test/module/Entra/Get-EntraGroupMember.Tests.ps1 +++ b/test/module/Entra/Get-EntraGroupMember.Tests.ps1 @@ -27,19 +27,17 @@ BeforeAll { Describe "Get-EntraGroupMember" { Context "Test for Get-EntraGroupMember" { It "Should return specific group" { - $result = Get-EntraGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Contain 'bbbbbbbb-1111-2222-3333-cccccccccccc' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - - It "Should fail when ObjectId is invalid" { - { Get-EntraGroupMember -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Get-EntraGroupMember -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } - - It "Should fail when ObjectId is empty" { - { Get-EntraGroupMember -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Get-EntraGroupMember -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } It "Should fail when Top is empty" { @@ -51,18 +49,17 @@ Describe "Get-EntraGroupMember" { } It "Should return all group" { - $result = Get-EntraGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All + $result = Get-EntraGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" - } - + { Get-EntraGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + } It "Should return top group" { - $result = Get-EntraGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1 + $result = @(Get-EntraGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1) $result | Should -Not -BeNullOrEmpty $result | Should -HaveCount 1 @@ -84,7 +81,7 @@ Describe "Get-EntraGroupMember" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupMember" - $result = Get-EntraGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupMember" diff --git a/test/module/Entra/Get-EntraGroupOwner.Tests.ps1 b/test/module/Entra/Get-EntraGroupOwner.Tests.ps1 index 1fd46c400..99c92ed68 100644 --- a/test/module/Entra/Get-EntraGroupOwner.Tests.ps1 +++ b/test/module/Entra/Get-EntraGroupOwner.Tests.ps1 @@ -34,7 +34,15 @@ BeforeAll { Describe "Get-EntraGroupOwner" { Context "Test for Get-EntraGroupOwner" { - It "Get a group owner by Id" { + It "Get a group owner by GroupId" { + $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' + $result.DeletedDateTime | should -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Get a group owner by alias" { $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' @@ -43,54 +51,54 @@ Describe "Get-EntraGroupOwner" { Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraGroupOwner -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Get-EntraGroupOwner -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraGroupOwner -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Get-EntraGroupOwner -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Gets all group owners" { - $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All + $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + { Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" } It "Gets two group owners" { - $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 2 + $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 2 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top XY} | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top XY} | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Result should Contain GroupId" { + $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } - It "Should contain GroupId in parameters when passed ObjectId to it" { - $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should contain GroupId in parameters when passed GroupId to it" { + $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $groupId= $params | ConvertTo-json | ConvertFrom-Json $groupId.Uri -match "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -BeTrue } It "Property parameter should work" { - $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id + $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -98,13 +106,13 @@ Describe "Get-EntraGroupOwner" { } It "Should fail when Property is empty" { - { Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupOwner" - $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupOwner" @@ -122,7 +130,7 @@ Describe "Get-EntraGroupOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraIdentityProvider.Tests.ps1 b/test/module/Entra/Get-EntraIdentityProvider.Tests.ps1 index b6f3c3b0e..b583838b5 100644 --- a/test/module/Entra/Get-EntraIdentityProvider.Tests.ps1 +++ b/test/module/Entra/Get-EntraIdentityProvider.Tests.ps1 @@ -13,7 +13,7 @@ BeforeAll { "Id" = "Google-OAUTH" "DisplayName" = "Mock-App" "AdditionalProperties" = @{ - "@odata.context" = "https://graph.microsoft.com/v1.0/$metadata#identity/identityProviders/$entity" + "@odata.context" = 'https://graph.microsoft.com/v1.0/$metadata#identity/identityProviders/$entity' "@odata.type" = "#microsoft.graph.socialIdentityProvider" "clientId" = "Google123" "clientSecret" = "******" @@ -30,7 +30,16 @@ BeforeAll { Describe "Get-EntraIdentityProvider" { Context "Test for Get-EntraIdentityProvider" { It "Should return specific identity provider" { - $result = Get-EntraIdentityProvider -Id "Google-OAUTH" + $result = Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "Google-OAUTH" + $result.DisplayName | Should -Be "Mock-App" + $result.identityProviderType | Should -Be "Google" + + Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific identity provider with alias" { + $result = Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "Google-OAUTH" $result.DisplayName | Should -Be "Mock-App" @@ -39,37 +48,37 @@ Context "Test for Get-EntraIdentityProvider" { Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Id is empty" { - { Get-EntraIdentityProvider -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + { Get-EntraIdentityProvider -IdentityProviderBaseId } | Should -Throw "Missing an argument for parameter 'IdentityProviderBaseId'*" } It "Should fail when Id is invalid" { - { Get-EntraIdentityProvider -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + { Get-EntraIdentityProvider -IdentityProviderBaseId "" } | Should -Throw "Cannot bind argument to parameter 'IdentityProviderBaseId' because it is an empty string." } It "Result should Contain Alias properties" { - $result = Get-EntraIdentityProvider -Id "Google-OAUTH" + $result = Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $result.ObjectId | should -Be "Google-OAUTH" $result.Name | should -Be "Mock-App" $result.Type | should -Be "Google" } It "Should contain IdentityProviderBaseId in parameters when passed Id to it" { - $result = Get-EntraIdentityProvider -Id "Google-OAUTH" + $result = Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $params = Get-Parameters -data $result.Parameters $params.IdentityProviderBaseId | Should -Be "Google-OAUTH" } It "Property parameter should work" { - $result = Get-EntraIdentityProvider -Id "Google-OAUTH" -Property DisplayName + $result = Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraIdentityProvider -Id "Google-OAUTH" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraIdentityProvider" - Get-EntraIdentityProvider -Id "Google-OAUTH" + Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraIdentityProvider" @@ -85,7 +94,7 @@ Context "Test for Get-EntraIdentityProvider" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraIdentityProvider -Id "Google-OAUTH" -Debug } | Should -Not -Throw + { Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraLifecyclePolicyGroup.Tests.ps1 b/test/module/Entra/Get-EntraLifecyclePolicyGroup.Tests.ps1 index 1265ce02f..db7f87444 100644 --- a/test/module/Entra/Get-EntraLifecyclePolicyGroup.Tests.ps1 +++ b/test/module/Entra/Get-EntraLifecyclePolicyGroup.Tests.ps1 @@ -25,6 +25,18 @@ BeforeAll { Describe "Get-EntraLifecyclePolicyGroup" { Context "Test for Get-EntraLifecyclePolicyGroup" { It "Retrieve lifecycle policy object" { + $result = Get-EntraLifecyclePolicyGroup -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" + $result | Should -Not -BeNullOrEmpty + $result.ObjectId | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + $result.GroupLifetimeInDays | Should -Be 200 + $result.AlternateNotificationEmails | Should -Be "admingroup@contoso.com" + $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result.ManagedGroupTypes | Should -Be "All" + + Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Retrieve lifecycle policy object with alias" { $result = Get-EntraLifecyclePolicyGroup -Id "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" $result | Should -Not -BeNullOrEmpty $result.ObjectId | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' @@ -36,22 +48,22 @@ Describe "Get-EntraLifecyclePolicyGroup" { Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Get-EntraLifecyclePolicyGroup -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when GroupId is empty" { + { Get-EntraLifecyclePolicyGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when Id is invalid" { - { Get-EntraLifecyclePolicyGroup -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Get-EntraLifecyclePolicyGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } - It "Should contain GroupId in parameters when passed Id to it" { - $result = Get-EntraLifecyclePolicyGroup -Id "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" + It "Should contain GroupId in parameters when passed GroupId to it" { + $result = Get-EntraLifecyclePolicyGroup -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" $params = Get-Parameters -data $result.Parameters $params.GroupId | Should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } It "Property parameter should work" { - $result = Get-EntraLifecyclePolicyGroup -Id "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Property Id + $result = Get-EntraLifecyclePolicyGroup -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" @@ -59,13 +71,13 @@ Describe "Get-EntraLifecyclePolicyGroup" { } It "Should fail when Property is empty" { - { Get-EntraLifecyclePolicyGroup -Id "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraLifecyclePolicyGroup -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraLifecyclePolicyGroup" - $result = Get-EntraLifecyclePolicyGroup -Id "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" + $result = Get-EntraLifecyclePolicyGroup -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraLifecyclePolicyGroup" @@ -83,7 +95,7 @@ Describe "Get-EntraLifecyclePolicyGroup" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraLifecyclePolicyGroup -Id "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Debug } | Should -Not -Throw + { Get-EntraLifecyclePolicyGroup -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraScopedRoleMembership.Tests.ps1 b/test/module/Entra/Get-EntraScopedRoleMembership.Tests.ps1 index 532a72c5f..3785667f1 100644 --- a/test/module/Entra/Get-EntraScopedRoleMembership.Tests.ps1 +++ b/test/module/Entra/Get-EntraScopedRoleMembership.Tests.ps1 @@ -32,6 +32,14 @@ BeforeAll{ } Describe "Tests for Get-EntraScopedRoleMembership"{ It "Result should not be empty"{ + $result = Get-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId + $result | Should -Not -BeNullOrEmpty + $result.ObjectId | should -Be $scopedRoleMembershipId + $result.AdministrativeUnitObjectId | should -Be $unitObjId + $result.RoleObjectId | should -Be $roleObjId + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Result should not be empty with ObjectId"{ $result = Get-EntraScopedRoleMembership -ObjectId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId $result | Should -Not -BeNullOrEmpty $result.ObjectId | should -Be $scopedRoleMembershipId @@ -39,21 +47,21 @@ Describe "Tests for Get-EntraScopedRoleMembership"{ $result.RoleObjectId | should -Be $roleObjId Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Get-EntraScopedRoleMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is invalid" { + { Get-EntraScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is empty" { - { Get-EntraScopedRoleMembership -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Get-EntraScopedRoleMembership -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when ScopedRoleMembershipId is empty" { - { Get-EntraScopedRoleMembership -ObjectId $unitObjId -ScopedRoleMembershipId } | Should -Throw "Missing an argument for parameter 'ScopedRoleMembershipId'*" + { Get-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -ScopedRoleMembershipId } | Should -Throw "Missing an argument for parameter 'ScopedRoleMembershipId'*" } It "Should fail when invalid parameter is passed" { { Get-EntraScopedRoleMembership -xyz } | Should -Throw "A parameter cannot be found that matches parameter name 'xyz'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraScopedRoleMembership" - $result = Get-EntraScopedRoleMembership -ObjectId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId + $result = Get-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraScopedRoleMembership" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -68,7 +76,7 @@ Describe "Tests for Get-EntraScopedRoleMembership"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraScopedRoleMembership -ObjectId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId -Debug } | Should -Not -Throw + { Get-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraServicePrincipal.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipal.Tests.ps1 index 9c1179e42..4396f3ef2 100644 --- a/test/module/Entra/Get-EntraServicePrincipal.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipal.Tests.ps1 @@ -77,6 +77,14 @@ BeforeAll { Describe "Get-EntraServicePrincipal" { Context "Test for Get-EntraServicePrincipal" { It "Should return specific service" { + $result = Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should execute successfully with Alias" { $result = Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' @@ -84,12 +92,12 @@ Describe "Get-EntraServicePrincipal" { Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraServicePrincipal -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraServicePrincipal -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraServicePrincipal -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ServicePrincipalId is invalid" { + { Get-EntraServicePrincipal -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } It "Should return all service" { @@ -118,8 +126,8 @@ Describe "Get-EntraServicePrincipal" { { Get-EntraServicePrincipal -Top XY} | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } @@ -147,13 +155,13 @@ Describe "Get-EntraServicePrincipal" { { Get-EntraServicePrincipal -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { + $result = Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result.Parameters $params.ServicePrincipalId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } @@ -165,7 +173,7 @@ Describe "Get-EntraServicePrincipal" { } It "Property parameter should work" { - $result = Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property DisplayName + $result = Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Windows Update for Business Deployment Service" @@ -173,12 +181,12 @@ Describe "Get-EntraServicePrincipal" { } It "Should fail when Property is empty" { - { Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipal" - $result = Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipal" @@ -196,7 +204,7 @@ Describe "Get-EntraServicePrincipal" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraServicePrincipal -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + { Get-EntraServicePrincipal -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 index 569c885a7..df71bf8d6 100644 --- a/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 @@ -29,51 +29,58 @@ BeforeAll { Describe "Get-EntraServicePrincipalAppRoleAssignedTo" { Context "Test for Get-EntraServicePrincipalAppRoleAssignedTo" { It "Should return app role assignments" { - $result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" + $result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" $result | Should -Not -BeNullOrEmpty $result.PrincipalId | should -Be '4d8fcb23-adc7-4d47-9328-2420eb1075ef' Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should execute successfully with Alias" { + $result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" + $result | Should -Not -BeNullOrEmpty + $result.PrincipalId | should -Be '4d8fcb23-adc7-4d47-9328-2420eb1075ef' + + Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - {Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" + } + It "Should fail when ServicePrincipalId is invalid" { + {Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } It "Should return all app role assignments" { - $result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -All + $result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should return top app role assignments " { - $result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -top 1 + $result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Top is empty" { - { Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" - $result.ObjectId | should -Be "I8uPTcetR02TKCQg6xB170ZWgaqJluBEqPHHxTxJ9Hs" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" + $result.ObjectID | should -Be "I8uPTcetR02TKCQg6xB170ZWgaqJluBEqPHHxTxJ9Hs" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { Mock -CommandName Get-MgServicePrincipalAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" + $result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "4d8fcb23-adc7-4d47-9328-2420eb1075ef" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalAppRoleAssignedTo" - $result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" + $result= Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalAppRoleAssignedTo" Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -81,14 +88,14 @@ Describe "Get-EntraServicePrincipalAppRoleAssignedTo" { $true } } - It "Should execute successfully without throwing an error " { + It "Should execute successfully without throwing an error" { # Disable confirmation prompts $originalDebugPreference = $DebugPreference $DebugPreference = 'Continue' - + try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -Debug } | Should -Not -Throw + { Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 index b635bf71a..34372eeeb 100644 --- a/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 @@ -29,71 +29,78 @@ BeforeAll { Describe "Get-EntraServiceAppRoleAssigned" { Context "Test for Get-EntraServiceAppRoleAssigned" { It "Should return service principal application role assignment." { + $result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" + $result | Should -Not -BeNullOrEmpty + $result.ResourceId | should -Be '021510b7-e753-40aa-b668-29753295ca34' + + Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" $result | Should -Not -BeNullOrEmpty $result.ResourceId | should -Be '021510b7-e753-40aa-b668-29753295ca34' Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraServicePrincipalAppRoleAssignment -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraServicePrincipalAppRoleAssignment -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when ServicePrincipalId is invalid" { + { Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } It "Should return all service principal application role assignment." { - $result = Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" -All + $result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should return top service principal application role assignment." { - $result = Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" -top 1 + $result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Top is empty" { - { Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" $result.ObjectId | should -Be "qjltmaz9l02qPcgftHNirITXiOnmHR5GmW_oEXl_ZL8" } It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { Mock -CommandName Get-MgServicePrincipalAppRoleAssignedTo -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" + $result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "021510b7-e753-40aa-b668-29753295ca34" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalAppRoleAssignment" - $result = Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" + $result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalAppRoleAssignment" Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true - } - } - It "Should execute successfully without throwing an error " { + } + } + It "Should execute successfully without throwing an error" { # Disable confirmation prompts $originalDebugPreference = $DebugPreference $DebugPreference = 'Continue' - + try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34" -Debug } | Should -Not -Throw + { Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference } - } + } } } \ No newline at end of file diff --git a/test/module/Entra/Get-EntraServicePrincipalKeyCredential.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalKeyCredential.Tests.ps1 index 5fb2b7aa0..c04df2275 100644 --- a/test/module/Entra/Get-EntraServicePrincipalKeyCredential.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalKeyCredential.Tests.ps1 @@ -32,25 +32,33 @@ Describe "Get-EntraServicePrincipalKeyCredential" { Context "Test for Get-EntraServicePrincipalKeyCredential" { It "Should return specific principal key credential" { $objectId = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - $result = Get-EntraServicePrincipalKeyCredential -ObjectId $objectId + $result = Get-EntraServicePrincipalKeyCredential -ServicePrincipalId $objectId $result | Should -Not -BeNullOrEmpty $result.KeyId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { + It "Should update the parameter with Alias" { + $objectId = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraServicePrincipalKeyCredential -ObjectId $objectId + $result | Should -Not -BeNullOrEmpty + $result.KeyId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when ServicePrincipalId is empty" { $errorActionPreference = "Stop" - { Get-EntraServicePrincipalKeyCredential -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + { Get-EntraServicePrincipalKeyCredential -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'*" } - It "Should fail when ObjectId is invalid" { + It "Should fail when ServicePrincipalId is invalid" { $errorActionPreference = "Stop" - { Get-EntraServicePrincipalKeyCredential -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Get-EntraServicePrincipalKeyCredential -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraServicePrincipalKeyCredential -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { + $result = Get-EntraServicePrincipalKeyCredential -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $servicePrincipalKeyCredential = $result | ConvertTo-Json -Depth 10 | ConvertFrom-Json $params = Get-Parameters -data $servicePrincipalKeyCredential.Parameters $params.ServicePrincipalId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" @@ -59,7 +67,7 @@ Describe "Get-EntraServicePrincipalKeyCredential" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalKeyCredential" - $result = Get-EntraServicePrincipalKeyCredential -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraServicePrincipalKeyCredential -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalKeyCredential" diff --git a/test/module/Entra/Get-EntraServicePrincipalMembership.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalMembership.Tests.ps1 index 880f4ceb3..338b41568 100644 --- a/test/module/Entra/Get-EntraServicePrincipalMembership.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalMembership.Tests.ps1 @@ -21,48 +21,53 @@ BeforeAll { } Describe "Get-EntraServicePrincipalMembership"{ It "Result should not be empty" { + $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should update the parameter with Alias" { $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraServicePrincipalMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraServicePrincipalMembership -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } It "Should return all applications" { - $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." + { Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." } It "Should return top application" { - $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { + $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.ServicePrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalMembership" - $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalMembership" Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -77,7 +82,7 @@ Describe "Get-EntraServicePrincipalMembership"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.tests.ps1 index 12b687bb3..51d886851 100644 --- a/test/module/Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalOAuth2PermissionGrant.tests.ps1 @@ -25,48 +25,53 @@ BeforeAll { } Describe "Get-EntraServicePrincipalOAuth2PermissionGrant"{ It "Result should not be empty" { + $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should update the parameter with Alias" { $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } It "Should return all applications" { - $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." + { Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." } It "Should return top application" { - $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { + $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.ServicePrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'aaaaaaaa-0b0b-1c1c-2d2d-333333333333' Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOAuth2PermissionGrant" - $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOAuth2PermissionGrant" Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -81,7 +86,7 @@ Describe "Get-EntraServicePrincipalOAuth2PermissionGrant"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraServicePrincipalOwnedObject.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalOwnedObject.Tests.ps1 index c7f1471d0..bee28bca2 100644 --- a/test/module/Entra/Get-EntraServicePrincipalOwnedObject.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalOwnedObject.Tests.ps1 @@ -11,7 +11,7 @@ BeforeAll { $scriptblock = { return @( [PSCustomObject]@{ - "Id" = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + "Id" = "111cc9b5-fce9-485e-9566-c68debafac5f" "DeletedDateTime" = $null "AdditionalProperties" = @{ accountEnabled = $true; @@ -29,65 +29,57 @@ BeforeAll { Describe "Get-EntraServicePrincipalOwnedObject" { Context "Test for Get-EntraServicePrincipalOwnedObject" { It "Should return specific Owned Object" { - $result = Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" $result | Should -Not -BeNullOrEmpty - $result.Id | should -Be @('00aa00aa-bb11-cc22-dd33-44ee44ee44ee') + $result.Id | should -Be @('111cc9b5-fce9-485e-9566-c68debafac5f') Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraServicePrincipalOwnedObject -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should return specific ServicePrincipalOwnedObject with Alias" { + $result = Get-EntraServicePrincipalOwnedObject -ObjectId "2d028fff-7e65-4340-80ca-89be16dae0b3" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be @('111cc9b5-fce9-485e-9566-c68debafac5f') + Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId'*" } - It "Should fail when ObjectId is null" { - { Get-EntraServicePrincipalOwnedObject -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ServicePrincipalId is null" { + { Get-EntraServicePrincipalOwnedObject -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'*" } It "Should return all Owned Objects" { - $result = Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + { Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" } It "Should return top Owned Object" { - $result = Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" + $result.ObjectId | should -Be "111cc9b5-fce9-485e-9566-c68debafac5f" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { + $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" $params = Get-Parameters -data $result.Parameters - $params.ServicePrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $params.ServicePrincipalId | Should -Be "2d028fff-7e65-4340-80ca-89be16dae0b3" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOwnedObject" - - $result = Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" $result | Should -Not -BeNullOrEmpty - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOwnedObject" - Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } } - It "Property parameter should work" { - $result = Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id - $result | Should -Not -BeNullOrEmpty - $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - - Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 - } - - It "Should fail when Property is empty" { - { Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" - } - + It "Should execute successfully without throwing an error " { # Disable confirmation prompts $originalDebugPreference = $DebugPreference @@ -95,12 +87,10 @@ Describe "Get-EntraServicePrincipalOwnedObject" { try { # Act & Assert: Ensure the function doesn't throw an exception - { - Get-EntraServicePrincipalOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug - } | Should -Not -Throw + { Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" -Debug } | Should -Not -Throw } finally { - # Restore original confirmation preference - $DebugPreference = $originalDebugPreference + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference } } } diff --git a/test/module/Entra/Get-EntraServicePrincipalOwner.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalOwner.Tests.ps1 index d80d1a2f3..13c22fe2a 100644 --- a/test/module/Entra/Get-EntraServicePrincipalOwner.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalOwner.Tests.ps1 @@ -45,48 +45,53 @@ BeforeAll { } Describe "Get-EntraServicePrincipalOwner"{ It "Result should not be empty" { + $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should update the parameter with Alias" { $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraServicePrincipalOwner -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraServicePrincipalOwner -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } It "Should return all applications" { - $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." + { Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." } It "Should return top application" { - $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Result should Contain ObjectId" { - $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Result should Contain ServicePrincipalId" { + $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { + $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.ServicePrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Adams Smith' Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOwner" - $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOwner" Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -101,7 +106,7 @@ Describe "Get-EntraServicePrincipalOwner"{ try { # Act & Assert: Ensure the function doesn't throw an exception - {Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + {Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 b/test/module/Entra/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 index 8a99ec828..882d66d86 100644 --- a/test/module/Entra/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 +++ b/test/module/Entra/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 @@ -33,6 +33,15 @@ BeforeAll { Describe "Get-EntraServicePrincipalPasswordCredential" { Context "Test for Get-EntraServicePrincipalPasswordCredential" { It "Should return specific principal password credential" { + $ServicePrincipalId = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraServicePrincipalPasswordCredential -ServicePrincipalId $ServicePrincipalId + $result | Should -Not -BeNullOrEmpty + $result.KeyId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should update the parameter with Alias" { $ServicePrincipalId = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result = Get-EntraServicePrincipalPasswordCredential -ObjectId $ServicePrincipalId $result | Should -Not -BeNullOrEmpty @@ -41,18 +50,18 @@ Describe "Get-EntraServicePrincipalPasswordCredential" { Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { + It "Should fail when ServicePrincipalId is empty" { $errorActionPreference = "Stop" - { Get-EntraServicePrincipalPasswordCredential -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + { Get-EntraServicePrincipalPasswordCredential -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'*" } - It "Should fail when ObjectId is invalid" { + It "Should fail when ServicePrincipalId is invalid" { $errorActionPreference = "Stop" - { Get-EntraServicePrincipalPasswordCredential -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Get-EntraServicePrincipalPasswordCredential -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraServicePrincipalPasswordCredential -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { + $result = Get-EntraServicePrincipalPasswordCredential -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $servicePrincipalPasswordCredential = $result | ConvertTo-Json -Depth 10 | ConvertFrom-Json $params = Get-Parameters -data $servicePrincipalPasswordCredential.Parameters $params.ServicePrincipalId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" @@ -61,7 +70,7 @@ Describe "Get-EntraServicePrincipalPasswordCredential" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalPasswordCredential" - $result = Get-EntraServicePrincipalPasswordCredential -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraServicePrincipalPasswordCredential -ServicePrincipalId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalPasswordCredential" diff --git a/test/module/Entra/Get-EntraSubscribedSku.Tests.ps1 b/test/module/Entra/Get-EntraSubscribedSku.Tests.ps1 index 2d92feaa7..108d31293 100644 --- a/test/module/Entra/Get-EntraSubscribedSku.Tests.ps1 +++ b/test/module/Entra/Get-EntraSubscribedSku.Tests.ps1 @@ -36,17 +36,24 @@ $scriptblock = { Describe "Get-EntraSubscribedSku" { Context "Test for Get-EntraSubscribedSku" { It "Should return specific SubscribedSku" { + $result = Get-EntraSubscribedSku -SubscribedSkuId "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" + + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific SubscribedSku with alias" { $result = Get-EntraSubscribedSku -ObjectId "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId empty" { - { Get-EntraSubscribedSku -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when SubscribedSkuId empty" { + { Get-EntraSubscribedSku -SubscribedSkuId } | Should -Throw "Missing an argument for parameter 'SubscribedSkuId'*" } - It "Should fail when ObjectId invalid" { - { Get-EntraSubscribedSku -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when SubscribedSkuId invalid" { + { Get-EntraSubscribedSku -SubscribedSkuId "" } | Should -Throw "Cannot bind argument to parameter 'SubscribedSkuId' because it is an empty string." } It "Should return all SubscribedSku" { $result = Get-EntraSubscribedSku @@ -83,7 +90,7 @@ Describe "Get-EntraSubscribedSku" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraSubscribedSku -ObjectId "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" -Debug } | Should -Not -Throw + { Get-EntraSubscribedSku -SubscribedSkuId "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUser.Tests.ps1 b/test/module/Entra/Get-EntraUser.Tests.ps1 index fc91b8bd3..d6639e7c8 100644 --- a/test/module/Entra/Get-EntraUser.Tests.ps1 +++ b/test/module/Entra/Get-EntraUser.Tests.ps1 @@ -38,13 +38,6 @@ BeforeAll { "MobilePhone" = $null } - # Response from an Invoke-GraphRequest is a hashtable with @odata.context and Value objects - - # Name Value - # ---- ----- - # @odata.context https://graph.microsoft.com/v1.0/$metadata#users - # value {System.Collections.Hashtable, System.Collections.Hashtable, System.Collections.Hasht... - $response = @{ '@odata.context' = 'Users()' Value = $valueObject @@ -61,6 +54,15 @@ BeforeAll { Describe "Get-EntraUser" { Context "Test for Get-EntraUser" { It "Should return specific user" { + $result = Get-EntraUser -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Write-Verbose "Result : {$result}" -Verbose + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should execute successfully with Alias" { $result = Get-EntraUser -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" Write-Verbose "Result : {$result}" -Verbose $result | Should -Not -BeNullOrEmpty @@ -84,11 +86,11 @@ Describe "Get-EntraUser" { } It "Should fail when ObjectId is empty string value" { - { Get-EntraUser -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Get-EntraUser -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should fail when ObjectId is empty" { - { Get-EntraUser -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + { Get-EntraUser -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } It "Should return all contact" { @@ -161,7 +163,7 @@ Describe "Get-EntraUser" { try { # Act & Assert: Ensure the function doesn't throw an exception { - Get-EntraUser -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug + Get-EntraUser -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference diff --git a/test/module/Entra/Get-EntraUserCreatedObject.Tests.ps1 b/test/module/Entra/Get-EntraUserCreatedObject.Tests.ps1 index da2688fd6..73d29e283 100644 --- a/test/module/Entra/Get-EntraUserCreatedObject.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserCreatedObject.Tests.ps1 @@ -55,6 +55,14 @@ BeforeAll { Describe "Get-EntraUserCreatedObject" { Context "Test for Get-EntraUserCreatedObject" { It "Should return specific User" { + $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific User with alias" { $result = Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty @@ -62,41 +70,41 @@ Describe "Get-EntraUserCreatedObject" { Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string value" { - { Get-EntraUserCreatedObject -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string value" { + { Get-EntraUserCreatedObject -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraUserCreatedObject -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Get-EntraUserCreatedObject -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } It "Should return all contact" { - $result = Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + { Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" } It "Should return top user" { - $result = Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top HH } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top HH } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -104,7 +112,7 @@ Describe "Get-EntraUserCreatedObject" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserCreatedObject" - $result = Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserCreatedObject" @@ -116,7 +124,7 @@ Describe "Get-EntraUserCreatedObject" { } It "Property parameter should work" { - $result = Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property appDisplayName + $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property appDisplayName $result | Should -Not -BeNullOrEmpty $result.appDisplayName | Should -Be "Microsoft Graph Command Line Tools" @@ -124,7 +132,7 @@ Describe "Get-EntraUserCreatedObject" { } It "Should fail when Property is empty" { - { Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should execute successfully without throwing an error" { @@ -134,7 +142,7 @@ Describe "Get-EntraUserCreatedObject" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserCreatedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserDirectReport.Tests.ps1 b/test/module/Entra/Get-EntraUserDirectReport.Tests.ps1 index 419df4cfb..ca3f93239 100644 --- a/test/module/Entra/Get-EntraUserDirectReport.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserDirectReport.Tests.ps1 @@ -37,53 +37,60 @@ BeforeAll { Describe "Get-EntraUserDirectReport" { Context "Test for Get-EntraUserDirectReport" { It "Should return specific user direct report" { + $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific user direct report with alias" { $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraUserDirectReport -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when UserId is empty" { + { Get-EntraUserDirectReport -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraUserDirectReport -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when UserId is invalid" { + { Get-EntraUserDirectReport -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string.*" } It "Should return all user direct reports" { - $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All is invalid" { - { Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" } It "Should return top 1 user direct report" { - $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Property parameter should work" { - $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Mock-User" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Result should contain Properties" { - $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.DeletionTimestamp | Should -Be $null $result.DirSyncEnabled | Should -Be $null @@ -96,16 +103,16 @@ Describe "Get-EntraUserDirectReport" { $result.UserStateChangedOn | Should -Be $null } - It "Should contain UserId in parameters when passed ObjectId to it" { + It "Should contain UserId in parameters when passed UserId to it" { - $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $para= $params | ConvertTo-json | ConvertFrom-Json $para.URI | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserDirectReport" - $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserDirectReport" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -120,7 +127,7 @@ Describe "Get-EntraUserDirectReport" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserExtension.Tests.ps1 b/test/module/Entra/Get-EntraUserExtension.Tests.ps1 new file mode 100644 index 000000000..bc64546e0 --- /dev/null +++ b/test/module/Entra/Get-EntraUserExtension.Tests.ps1 @@ -0,0 +1,81 @@ +BeforeAll { + if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { + Import-Module Microsoft.Graph.Entra + } + Import-Module (Join-Path $PSScriptRoot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @{ + "employeeId" = $null + "createdDateTime" = $null + "onPremisesDistinguishedName" = $null + "identities" = @("testuser@contoso.com") + "Parameters" = $args + } + } + + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra +} +Describe "Get-EntraUserExtension" { + Context "Test for Get-EntraUserExtension" { + It "Should return user extensions" { + $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should execute successfully with Alias" { + $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserExtension" + $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should fail when UserId is empty string value" { + { Get-EntraUserExtension -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." + } + + It "Should fail when UserId is empty" { + { Get-EntraUserExtension -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." + } + + It "Property parameter should work" { + $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property DisplayName + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should fail when Property is empty" { + { Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" + } + + It "Should execute successfully without throwing an error " { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { + Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug + } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/Entra/Get-EntraUserLicenseDetail.Tests.ps1 b/test/module/Entra/Get-EntraUserLicenseDetail.Tests.ps1 index 9684f9994..1841ca5ef 100644 --- a/test/module/Entra/Get-EntraUserLicenseDetail.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserLicenseDetail.Tests.ps1 @@ -28,6 +28,17 @@ BeforeAll { Describe "Get-EntraUserLicenseDetail" { Context "Test for Get-EntraUserLicenseDetail" { It "Should return specific User" { + $result = Get-EntraUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be "X8Wu1RItQkSNL8zKldQ5DmAn38eBLPdOtXhbU5K1cd8" + $result.ServicePlans | Should -Be @("COMMON_DEFENDER_PLATFORM_FOR_OFFICE", "Bing_Chat_Enterprise", "MESH_IMMERSIVE_FOR_TEAMS", "PURVIEW_DISCOVERY") + $result.SkuId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + $result.SkuPartNumber | Should -Be "ENTERPRISEPREMIUM" + $result.AdditionalProperties | Should -BeOfType [System.Collections.Hashtable] + + should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific User with alias" { $result = Get-EntraUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "X8Wu1RItQkSNL8zKldQ5DmAn38eBLPdOtXhbU5K1cd8" @@ -39,33 +50,33 @@ Describe "Get-EntraUserLicenseDetail" { should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string value" { - { Get-EntraUserLicenseDetail -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string value" { + { Get-EntraUserLicenseDetail -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraUserLicenseDetail -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Get-EntraUserLicenseDetail -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'X8Wu1RItQkSNL8zKldQ5DmAn38eBLPdOtXhbU5K1cd8' Should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserLicenseDetail" - $result = Get-EntraUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserLicenseDetail" @@ -82,7 +93,7 @@ Describe "Get-EntraUserLicenseDetail" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserManager.Tests.ps1 b/test/module/Entra/Get-EntraUserManager.Tests.ps1 index befa64f50..4abfdbc63 100644 --- a/test/module/Entra/Get-EntraUserManager.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserManager.Tests.ps1 @@ -38,6 +38,24 @@ BeforeAll { Describe "Get-EntraUserManager" { Context "Test for Get-EntraUserManager" { It "Should return specific User" { + $result = Get-EntraUserManager -UserId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + $result.ageGroup | Should -BeNullOrEmpty + $result.onPremisesLastSyncDateTime | Should -BeNullOrEmpty + $result.creationType | Should -BeNullOrEmpty + $result.imAddresses | Should -Be @("test@contoso.com") + $result.preferredLanguage | Should -BeNullOrEmpty + $result.mail | Should -Be "test@contoso.com" + $result.securityIdentifier | Should -Be "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + $result.identities | Should -HaveCount 1 + $result.identities[0].signInType | Should -Be "userPrincipalName" + $result.identities[0].issuer | Should -Be "contoso.com" + $result.identities[0].issuerAssignedId | Should -Be "test@contoso.com" + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific User wit alias" { $result = Get-EntraUserManager -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $result.ageGroup | Should -BeNullOrEmpty @@ -55,16 +73,16 @@ Describe "Get-EntraUserManager" { Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string value" { - { Get-EntraUserManager -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string value" { + { Get-EntraUserManager -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraUserManager -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Get-EntraUserManager -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserManager -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserManager -UserId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result.Parameters $params.Uri | Should -Match "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } @@ -72,7 +90,7 @@ Describe "Get-EntraUserManager" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserManager" - $result = Get-EntraUserManager -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Get-EntraUserManager -UserId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserManager" @@ -84,7 +102,7 @@ Describe "Get-EntraUserManager" { } It "Property parameter should work" { - $result = Get-EntraUserManager -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property Id + $result = Get-EntraUserManager -UserId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" @@ -92,7 +110,7 @@ Describe "Get-EntraUserManager" { } It "Should fail when Property is empty" { - { Get-EntraUserManager -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserManager -UserId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should execute successfully without throwing an error" { @@ -102,7 +120,7 @@ Describe "Get-EntraUserManager" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserManager -ObjectId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + { Get-EntraUserManager -UserId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserMembership.Tests.ps1 b/test/module/Entra/Get-EntraUserMembership.Tests.ps1 index 5b06b93fd..6c8a92343 100644 --- a/test/module/Entra/Get-EntraUserMembership.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserMembership.Tests.ps1 @@ -27,59 +27,66 @@ BeforeAll { Describe "Get-EntraUserMembership" { Context "Test for Get-EntraUserMembership" { It "Should return specific user membership" { + $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific user membership with alias" { $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraUserMembership -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when UserId is empty" { + { Get-EntraUserMembership -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraUserMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is invalid" { + { Get-EntraUserMembership -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should return all user membership" { - $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + { Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" } It "Should return top user membership" { - $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 5 + $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 5 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should Contain ObjectId" { - $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" @@ -87,13 +94,13 @@ Describe "Get-EntraUserMembership" { } It "Should fail when Property is empty" { - { Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserMembership" - $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserMembership" @@ -111,7 +118,7 @@ Describe "Get-EntraUserMembership" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 b/test/module/Entra/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 index b7ad90c06..2a69bbfff 100644 --- a/test/module/Entra/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 @@ -27,6 +27,15 @@ BeforeAll { Describe "Get-EntraUserOAuth2PermissionGrant" { Context "Test for Get-EntraUserOAuth2PermissionGrant" { It "Should return specific UserOAuth2PermissionGrant" { + $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" + $result | Should -Not -BeNullOrEmpty + $result.PrincipalId | should -Contain 'aaaaaaaa-bbbb-cccc-1111-222222222222' + $result.Id | Should -Contain 'Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2' + + Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific UserOAuth2PermissionGrant with alias" { $result = Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" $result | Should -Not -BeNullOrEmpty $result.PrincipalId | should -Contain 'aaaaaaaa-bbbb-cccc-1111-222222222222' @@ -35,54 +44,54 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraUserOAuth2PermissionGrant -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when UserId is empty" { + { Get-EntraUserOAuth2PermissionGrant -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraUserOAuth2PermissionGrant -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is invalid" { + { Get-EntraUserOAuth2PermissionGrant -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should return all User OAuth2Permission Grant" { - $result = Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -All + $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + { Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" } It "Should return top User OAuth2Permission Grant" { - $result = Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Top 1 + $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should Contain PrincipalId" { - $result = Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" + $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" $result.PrincipalId | should -Contain "aaaaaaaa-bbbb-cccc-1111-222222222222" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" } It "Property parameter should work" { - $result = Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Property ConsentType + $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Property ConsentType $result | Should -Not -BeNullOrEmpty $result.ConsentType | Should -Be "Principal" @@ -90,13 +99,13 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { } It "Should fail when Property is empty" { - { Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOAuth2PermissionGrant" - $result = Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" + $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOAuth2PermissionGrant" @@ -114,7 +123,7 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserOAuth2PermissionGrant -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Debug } | Should -Not -Throw + { Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserOwnedDevice.Tests.ps1 b/test/module/Entra/Get-EntraUserOwnedDevice.Tests.ps1 index 74ce4bac7..6d31703e5 100644 --- a/test/module/Entra/Get-EntraUserOwnedDevice.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserOwnedDevice.Tests.ps1 @@ -48,6 +48,16 @@ BeforeAll { Describe "Get-EntraUserOwnedDevice" { Context "Test for Get-EntraUserOwnedDevice" { It "Should get devices owned by a user" { + $result = Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" + $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-3333-4444-5555-bbbbbbbbbbbb" + $result.AdditionalProperties.displayName | Should -Be "Sawyer Miller" + + Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should get devices owned by a user with alias" { $result = Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" @@ -58,20 +68,20 @@ Context "Test for Get-EntraUserOwnedDevice" { } It "Property parameter should work" { - $result = Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Property DisplayName $result.Id | Should -Be 'aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb' } It "Should fail when ObjectlId is empty" { - { Get-EntraUserOwnedDevice -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + { Get-EntraUserOwnedDevice -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } It "Should fail when ObjectlId is invalid" { - { Get-EntraUserOwnedDevice -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Get-EntraUserOwnedDevice -UserId ""} | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should get all devices owned by a user" { - $result = Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -All + $result = Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty $result.Id | Should -Contain "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" @@ -83,7 +93,7 @@ Context "Test for Get-EntraUserOwnedDevice" { } It "Should get top one device owned by a user" { - $result = Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-3333-4444-5555-bbbbbbbbbbbb" @@ -93,22 +103,22 @@ Context "Test for Get-EntraUserOwnedDevice" { } It "Should fail when Top is empty" { - { Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top "XCX" } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top "XCX" } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOwnedDevice" - $result = Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result = Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOwnedDevice" Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -123,7 +133,7 @@ Context "Test for Get-EntraUserOwnedDevice" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserOwnedDevice -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserOwnedObject.Tests.ps1 b/test/module/Entra/Get-EntraUserOwnedObject.Tests.ps1 index f6ee59f74..55f025d0a 100644 --- a/test/module/Entra/Get-EntraUserOwnedObject.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserOwnedObject.Tests.ps1 @@ -31,7 +31,7 @@ BeforeAll { Describe "Get-EntraUserOwnedObject" { Context "Test for Get-EntraUserOwnedObject" { It "Should return specific User" { - $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" @@ -44,42 +44,55 @@ Describe "Get-EntraUserOwnedObject" { should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } + It "Should return specific User with alias" { + $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result.applicationTemplateId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + $result.appId | Should -Be "11112222-bbbb-3333-cccc-4444dddd5555" + $result.signInAudience | Should -Be "AzureADMyOrg" + $result.publisherDomain | Should -Be "contoso.com" + $result.DisplayName | Should -Be "ToGraph_443DEM" - It "Should fail when ObjectId is empty string value" { - { Get-EntraUserOwnedObject -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + + should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when UserId is empty string value" { + { Get-EntraUserOwnedObject -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraUserOwnedObject -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Get-EntraUserOwnedObject -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } It "Should return top user" { - $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when top is empty" { - { Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Should return all contact" { - $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All has an argument" { - { Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + { Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.Uri | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -87,7 +100,7 @@ Describe "Get-EntraUserOwnedObject" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOwnedObject" - $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOwnedObject" @@ -99,7 +112,7 @@ Describe "Get-EntraUserOwnedObject" { } It "Property parameter should work" { - $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property displayName + $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property displayName $result | Should -Not -BeNullOrEmpty $result.displayName | Should -Be "ToGraph_443DEM" @@ -107,7 +120,7 @@ Describe "Get-EntraUserOwnedObject" { } It "Should fail when Property is empty" { - { Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should execute successfully without throwing an error" { @@ -117,7 +130,7 @@ Describe "Get-EntraUserOwnedObject" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Get-EntraUserRegisteredDevice.Tests.ps1 b/test/module/Entra/Get-EntraUserRegisteredDevice.Tests.ps1 index d8d895bc3..3d09369cd 100644 --- a/test/module/Entra/Get-EntraUserRegisteredDevice.Tests.ps1 +++ b/test/module/Entra/Get-EntraUserRegisteredDevice.Tests.ps1 @@ -35,6 +35,15 @@ BeforeAll { Describe "Get-EntraUserRegisteredDevice" { Context "Test for Get-EntraUserRegisteredDevice" { It "Should return specific user registered device" { + $result = Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "ffffffff-5555-6666-7777-aaaaaaaaaaaa" + $result.AdditionalProperties.deviceId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + $result.AdditionalProperties.displayName | Should -Be "Mock-App" + + Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return specific user registered device with alias" { $result = Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "ffffffff-5555-6666-7777-aaaaaaaaaaaa" @@ -44,13 +53,13 @@ Context "Test for Get-EntraUserRegisteredDevice" { Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when ObjectlId is empty" { - { Get-EntraUserRegisteredDevice -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + { Get-EntraUserRegisteredDevice -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } It "Should fail when ObjectlId is invalid" { - { Get-EntraUserRegisteredDevice -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Get-EntraUserRegisteredDevice -UserId ""} | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should return All user registered devices" { - $result = Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "ffffffff-5555-6666-7777-aaaaaaaaaaaa" $result.AdditionalProperties.deviceId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" @@ -59,10 +68,10 @@ Context "Test for Get-EntraUserRegisteredDevice" { Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when All is invalid" { - { Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" } It "Should return top 1 user registered device" { - $result = Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result = Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "ffffffff-5555-6666-7777-aaaaaaaaaaaa" $result.AdditionalProperties.deviceId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" @@ -71,29 +80,29 @@ Context "Test for Get-EntraUserRegisteredDevice" { Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Top is empty" { - { Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Property parameter should work" { - $result = Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.AdditionalProperties.displayName | Should -Be "Mock-App" Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Property is empty" { - { Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserRegisteredDevice" - $result = Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserRegisteredDevice" Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -108,7 +117,7 @@ Context "Test for Get-EntraUserRegisteredDevice" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/New-EntraApplicationExtensionProperty.Tests.ps1 b/test/module/Entra/New-EntraApplicationExtensionProperty.Tests.ps1 index 6d0cdbf7e..2ba614f4b 100644 --- a/test/module/Entra/New-EntraApplicationExtensionProperty.Tests.ps1 +++ b/test/module/Entra/New-EntraApplicationExtensionProperty.Tests.ps1 @@ -18,7 +18,7 @@ BeforeAll { "IsSyncedFromOnPremises" = $False "Name" = "Mock-App" "TargetObjects" = "Application" - "AdditionalProperties" = @{"@odata.context" = "https://graph.microsoft.com/v1.0/$metadata#applications('aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb')/extensionProperties/$entity"} + "AdditionalProperties" = @{"@odata.context" = "https://graph.microsoft.com/v1.0/`$metadata#applications('aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb')/extensionProperties/`$entity"} "Parameters" = $args } ) @@ -30,43 +30,52 @@ BeforeAll { Describe "New-EntraApplicationExtensionProperty" { Context "Test for New-EntraApplicationExtensionProperty" { It "Should return created MS application extension property" { - $result = New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" + $result = New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" $result.Name | Should -Be "Mock-App" $result.TargetObjects | Should -Be "Application" $result.DataType | Should -Be "MockType" + Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return created MS application extension property with alias" { + $result = New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" + $result.Name | Should -Be "Mock-App" + $result.TargetObjects | Should -Be "Application" + $result.DataType | Should -Be "MockType" Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectlId is empty" { - { New-EntraApplicationExtensionProperty -ObjectId -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { New-EntraApplicationExtensionProperty -ApplicationId -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } - It "Should fail when ObjectlId is invalid" { - { New-EntraApplicationExtensionProperty -ObjectId "" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is invalid" { + { New-EntraApplicationExtensionProperty -ApplicationId "" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } It "Should fail when DataType is empty" { - { New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType -Name "Mock-App" -TargetObjects "Application" } | Should -Throw "Missing an argument for parameter 'DataType'*" + { New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType -Name "Mock-App" -TargetObjects "Application" } | Should -Throw "Missing an argument for parameter 'DataType'*" } It "Should fail when Name is empty" { - { New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name -TargetObjects "Application" } | Should -Throw "Missing an argument for parameter 'Name'*" + { New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name -TargetObjects "Application" } | Should -Throw "Missing an argument for parameter 'Name'*" } It "Should fail when TargetObjects is empty" { - { New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects } | Should -Throw "Missing an argument for parameter 'TargetObjects'*" + { New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects } | Should -Throw "Missing an argument for parameter 'TargetObjects'*" } It "Result should Contain ObjectId" { - $result = New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" + $result = New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" $result.ObjectId | should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { - $result = New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { + $result = New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" $params = Get-Parameters -data $result.Parameters $params.ApplicationId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationExtensionProperty" - $result = New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" + $result = New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationExtensionProperty" Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -81,7 +90,7 @@ Context "Test for New-EntraApplicationExtensionProperty" { try { # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" -Debug } | Should -Not -Throw + { New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/New-EntraApplicationPassword.Tests.ps1 b/test/module/Entra/New-EntraApplicationPassword.Tests.ps1 index 5495c2e9e..372dd5b2e 100644 --- a/test/module/Entra/New-EntraApplicationPassword.Tests.ps1 +++ b/test/module/Entra/New-EntraApplicationPassword.Tests.ps1 @@ -26,37 +26,37 @@ BeforeAll { } Describe "New-EntraApplicationPassword"{ It "Should return created password credential"{ - $result = New-EntraApplicationPassword -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } | ConvertTo-Json | ConvertFrom-Json + $result = New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } | ConvertTo-Json | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $result.KeyId | should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result.SecretText | Should -Be "wbBNW8kCuiPjNRg9NX98W_EaU6cqG" Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { New-EntraApplicationPassword -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { New-EntraApplicationPassword -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { New-EntraApplicationPassword -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { New-EntraApplicationPassword -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should fail when PasswordCredential is null" { { New-EntraApplicationPassword -PasswordCredential } | Should -Throw "Missing an argument for parameter 'PasswordCredential'*" } It "Should fail when StartDate is empty" { - { New-EntraApplicationPassword -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ StartDateTime = "" } } | Should -Throw "Cannot process argument transformation on parameter 'PasswordCredential'*" + { New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ StartDateTime = "" } } | Should -Throw "Cannot process argument transformation on parameter 'PasswordCredential'*" } It "Should fail when EndDate is empty" { - { New-EntraApplicationPassword -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ EndDateTime = "" } } | Should -Throw "Cannot process argument transformation on parameter 'PasswordCredential'*" + { New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ EndDateTime = "" } } | Should -Throw "Cannot process argument transformation on parameter 'PasswordCredential'*" } It "Should fail when invalid parameter is passed" { { New-EntraApplicationPassword -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'." } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { - $result = New-EntraApplicationPassword -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { + $result = New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } $params = Get-Parameters -data $result.Parameters $params.ApplicationId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "should contain password credential parameters in body parameter when passed PasswordCredential to it"{ - $result = New-EntraApplicationPassword -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ DisplayName = "mypassword"; Hint = "123"; StartDateTime=(get-date).AddYears(0); EndDateTime=(get-date).AddYears(2) } + $result = New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ DisplayName = "mypassword"; Hint = "123"; StartDateTime=(get-date).AddYears(0); EndDateTime=(get-date).AddYears(2) } $params = Get-Parameters -data $result.Parameters $a = $params.PasswordCredential | ConvertTo-json | ConvertFrom-Json $a.DisplayName | Should -Be "mypassword" @@ -66,7 +66,7 @@ Describe "New-EntraApplicationPassword"{ } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationPassword" - $result = New-EntraApplicationPassword -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } | ConvertTo-Json | ConvertFrom-Json + $result = New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } | ConvertTo-Json | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationPassword" Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -81,7 +81,7 @@ Describe "New-EntraApplicationPassword"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraApplicationPassword -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } | ConvertTo-Json | ConvertFrom-Json -Debug } | Should -Not -Throw + { New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } | ConvertTo-Json | ConvertFrom-Json -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/New-EntraApplicationPasswordCredential.Tests.ps1 b/test/module/Entra/New-EntraApplicationPasswordCredential.Tests.ps1 index a83231fd8..6a309f0e2 100644 --- a/test/module/Entra/New-EntraApplicationPasswordCredential.Tests.ps1 +++ b/test/module/Entra/New-EntraApplicationPasswordCredential.Tests.ps1 @@ -26,53 +26,53 @@ BeforeAll { } Describe "New-EntraApplicationPasswordCredential"{ It "Should return created password credential"{ - $result = New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.KeyId | should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result.SecretText | Should -Be "wbBNW8kCuiPjNRg9NX98W_EaU6cqG" Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { New-EntraApplicationPasswordCredential -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { New-EntraApplicationPasswordCredential -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { New-EntraApplicationPasswordCredential -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { New-EntraApplicationPasswordCredential -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should fail when StartDate is empty" { - { New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -StartDate "" } | Should -Throw "Cannot process argument transformation on parameter 'StartDate'*" + { New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -StartDate "" } | Should -Throw "Cannot process argument transformation on parameter 'StartDate'*" } It "Should fail when StartDate is null" { - { New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -StartDate } | Should -Throw "Missing an argument for parameter 'StartDate'*" + { New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -StartDate } | Should -Throw "Missing an argument for parameter 'StartDate'*" } It "Should fail when EndDate is empty" { - { New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -EndDate "" } | Should -Throw "Cannot process argument transformation on parameter 'EndDate'*" + { New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -EndDate "" } | Should -Throw "Cannot process argument transformation on parameter 'EndDate'*" } It "Should fail when EndDate is null" { - { New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -EndDate } | Should -Throw "Missing an argument for parameter 'EndDate'*" + { New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -EndDate } | Should -Throw "Missing an argument for parameter 'EndDate'*" } It "Should fail when invalid parameter is passed" { { New-EntraApplicationPasswordCredential -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'." } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { - $result = New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { + $result = New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.ApplicationId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "should contain startDateTime in body parameter when passed StartDate to it"{ - $result = New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -StartDate (get-date).AddYears(0) + $result = New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -StartDate (get-date).AddYears(0) $params = Get-Parameters -data $result.Parameters $a = $params.PasswordCredential | ConvertTo-json | ConvertFrom-Json $a.startDateTime | Should -Not -BeNullOrEmpty } It "should contain endDateTime in body parameter when passed EndDate to it"{ - $result = New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -EndDate (get-date).AddYears(0) + $result = New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -EndDate (get-date).AddYears(0) $params = Get-Parameters -data $result.Parameters $a = $params.PasswordCredential | ConvertTo-json | ConvertFrom-Json $a.endDateTime | Should -Not -BeNullOrEmpty } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationPasswordCredential" - $result = New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationPasswordCredential" Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -87,7 +87,7 @@ Describe "New-EntraApplicationPasswordCredential"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraApplicationPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/New-EntraAttributeSet.Tests.ps1 b/test/module/Entra/New-EntraAttributeSet.Tests.ps1 index 8688a6b2f..766a84f56 100644 --- a/test/module/Entra/New-EntraAttributeSet.Tests.ps1 +++ b/test/module/Entra/New-EntraAttributeSet.Tests.ps1 @@ -25,6 +25,15 @@ BeforeAll { Describe "New-EntraAttributeSet" { Context "Test for New-EntraAttributeSet" { It "Should return created AttributeSet" { + $result = New-EntraAttributeSet -AttributeSetId "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be "NewCustomAttributeSet" + $result.MaxAttributesPerSet | should -Be 125 + $result.Description | should -Be "CustomAttributeSet" + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return created AttributeSet with alias" { $result = New-EntraAttributeSet -Id "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "NewCustomAttributeSet" @@ -33,8 +42,8 @@ Describe "New-EntraAttributeSet" { Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id parameter is invalid" { - { New-EntraAttributeSet -Id } | Should -Throw "Missing an argument for parameter 'Id*" + It "Should fail when AttributeSetId parameter is invalid" { + { New-EntraAttributeSet -AttributeSetId } | Should -Throw "Missing an argument for parameter 'AttributeSetId*" } It "Should fail when Description parameter is empty" { { New-EntraAttributeSet -Description } | Should -Throw "Missing an argument for parameter 'Description*" @@ -48,7 +57,7 @@ Describe "New-EntraAttributeSet" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraAttributeSet" - New-EntraAttributeSet -Id "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 | Out-Null + New-EntraAttributeSet -AttributeSetId "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 | Out-Null Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true @@ -62,7 +71,7 @@ Describe "New-EntraAttributeSet" { try { # Act & Assert: Ensure the function doesn't throw an exception { - New-EntraAttributeSet -Id "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 -Debug + New-EntraAttributeSet -AttributeSetId "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference diff --git a/test/module/Entra/New-EntraGroupAppRoleAssignment.Tests.ps1 b/test/module/Entra/New-EntraGroupAppRoleAssignment.Tests.ps1 index 89e9cd0b1..38eb00af3 100644 --- a/test/module/Entra/New-EntraGroupAppRoleAssignment.Tests.ps1 +++ b/test/module/Entra/New-EntraGroupAppRoleAssignment.Tests.ps1 @@ -31,6 +31,17 @@ BeforeAll { Describe "New-EntraGroupAppRoleAssignment" { Context "Test for New-EntraGroupAppRoleAssignment" { It "Should return created Group AppRole Assignment" { + $result = New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + $result.ResourceId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + + + Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return created Group AppRole Assignment with alias" { $result = New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" @@ -42,42 +53,42 @@ Context "Test for New-EntraGroupAppRoleAssignment" { Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when ObjectlId is empty" { - { New-EntraGroupAppRoleAssignment -ObjectId -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + { New-EntraGroupAppRoleAssignment -GroupId -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'GroupId'*" } It "Should fail when ObjectlId is invalid" { - { New-EntraGroupAppRoleAssignment -ObjectId "" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { New-EntraGroupAppRoleAssignment -GroupId "" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when PrincipalId is empty" { - { New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'PrincipalId'*" + { New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'PrincipalId'*" } It "Should fail when PrincipalId is invalid" { - { New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'PrincipalId' because it is an empty string." + { New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'PrincipalId' because it is an empty string." } It "Should fail when ResourceId is empty" { - { New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ResourceId'*" + { New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ResourceId'*" } It "Should fail when ResourceId is invalid" { - { New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ResourceId' because it is an empty string." + { New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ResourceId' because it is an empty string." } It "Should fail when Id is empty" { - { New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + { New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -AppRoleId } | Should -Throw "Missing an argument for parameter 'AppRoleId'*" } It "Should fail when Id is invalid" { - { New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + { New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -AppRoleId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleId' because it is an empty string." } - It "Result should Contain ObjectId" { - $result = New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Result should Contain GroupId" { + $result = New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.ObjectId | should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" } It "Should contain AppRoleId in parameters when passed Id to it" { - $result = New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.AppRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraGroupAppRoleAssignment" - $result = New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraGroupAppRoleAssignment" @@ -94,7 +105,7 @@ Context "Test for New-EntraGroupAppRoleAssignment" { try { # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { New-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/New-EntraServicePrincipalPasswordCredential.Tests.ps1 b/test/module/Entra/New-EntraServicePrincipalPasswordCredential.Tests.ps1 index d0410dd5c..33c37e2a2 100644 --- a/test/module/Entra/New-EntraServicePrincipalPasswordCredential.Tests.ps1 +++ b/test/module/Entra/New-EntraServicePrincipalPasswordCredential.Tests.ps1 @@ -29,40 +29,46 @@ BeforeAll { Describe "New-EntraServicePrincipalPasswordCredential"{ Context "Test for New-EntraServicePrincipalPasswordCredential" { It "Should return created password credential for a service principal."{ - $result = New-EntraServicePrincipalPasswordCredential -ObjectID "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" + $result = New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" $result | Should -Not -Be NullOrEmpty $result.StartDate | should -Be "16/09/2024 14:14:14" $result.EndDate | should -Be "16/12/2024 13:14:14" Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectID is empty" { - {New-EntraServicePrincipalPasswordCredential -ObjectID } | Should -Throw "Missing an argument for parameter 'ObjectID'.*" + It "Should update the parameter with Alias" { + $result = New-EntraServicePrincipalPasswordCredential -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" + $result | Should -Not -Be NullOrEmpty + + Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when ServicePrincipalId is empty" { + {New-EntraServicePrincipalPasswordCredential -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectID is Invalid" { - { New-EntraServicePrincipalPasswordCredential -ObjectID "" } | Should -Throw "Cannot bind argument to parameter 'ObjectID' because it is an empty string.*" + It "Should fail when ServicePrincipalId is Invalid" { + { New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } It "Should fail when StartDate is empty" { - { New-EntraServicePrincipalPasswordCredential -ObjectID "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate } | Should -Throw "Missing an argument for parameter 'StartDate'.*" + { New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate } | Should -Throw "Missing an argument for parameter 'StartDate'.*" } It "Should fail when StartDate is invalid" { - { New-EntraServicePrincipalPasswordCredential -ObjectID "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "xyz" } | Should -Throw "Cannot process argument transformation on parameter 'StartDate'. Cannot convert value*" + { New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "xyz" } | Should -Throw "Cannot process argument transformation on parameter 'StartDate'. Cannot convert value*" } It "Should fail when EndDate is empty" { - { New-EntraServicePrincipalPasswordCredential -ObjectID "bbbbbbbb-1111-2222-3333-cccccccccccc" -EndDate } | Should -Throw "Missing an argument for parameter 'EndDate'.*" + { New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -EndDate } | Should -Throw "Missing an argument for parameter 'EndDate'.*" } It "Should fail when EndDate is invalid" { - { New-EntraServicePrincipalPasswordCredential -ObjectID "bbbbbbbb-1111-2222-3333-cccccccccccc" -EndDate "xyz" } | Should -Throw "Cannot process argument transformation on parameter 'EndDate'. Cannot convert value*" + { New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -EndDate "xyz" } | Should -Throw "Cannot process argument transformation on parameter 'EndDate'. Cannot convert value*" } It "Result should Contain StartDate and EndDate" { - $result = New-EntraServicePrincipalPasswordCredential -ObjectID "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" + $result = New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" $result.StartDate | should -Be "16/09/2024 14:14:14" $result.EndDate | should -Be "16/12/2024 13:14:14" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraServicePrincipalPasswordCredential" - $result = New-EntraServicePrincipalPasswordCredential -ObjectID "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" + $result = New-EntraServicePrincipalPasswordCredential -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraServicePrincipalPasswordCredential" diff --git a/test/module/Entra/Remove-EntraAdministrativeUnit.Tests.ps1 b/test/module/Entra/Remove-EntraAdministrativeUnit.Tests.ps1 index f7fafd23f..45b889cd9 100644 --- a/test/module/Entra/Remove-EntraAdministrativeUnit.Tests.ps1 +++ b/test/module/Entra/Remove-EntraAdministrativeUnit.Tests.ps1 @@ -12,15 +12,15 @@ BeforeAll { Describe "Test for Remove-EntraAdministrativeUnit" { It "Should return empty object" { - $result = Remove-EntraAdministrativeUnit -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" + $result = Remove-EntraAdministrativeUnit -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraAdministrativeUnit -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Remove-EntraAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is null" { - { Remove-EntraAdministrativeUnit -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is null" { + { Remove-EntraAdministrativeUnit -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when invalid parameter is passed" { { Remove-EntraAdministrativeUnit -xyz } | Should -Throw "A parameter cannot be found that matches parameter name 'xyz'*" @@ -28,7 +28,7 @@ Describe "Test for Remove-EntraAdministrativeUnit" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraAdministrativeUnit" - Remove-EntraAdministrativeUnit -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" + Remove-EntraAdministrativeUnit -AdministrativeUnitId "bbbbbbbb-1111-1111-1111-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraAdministrativeUnit" @@ -44,7 +44,7 @@ Describe "Test for Remove-EntraAdministrativeUnit" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraAdministrativeUnit -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraAdministrativeUnit -AdministrativeUnitId "bbbbbbbb-1111-1111-1111-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraAdministrativeUnitMember.Tests.ps1 b/test/module/Entra/Remove-EntraAdministrativeUnitMember.Tests.ps1 index 34c42621d..7a05bd315 100644 --- a/test/module/Entra/Remove-EntraAdministrativeUnitMember.Tests.ps1 +++ b/test/module/Entra/Remove-EntraAdministrativeUnitMember.Tests.ps1 @@ -15,15 +15,20 @@ BeforeAll { Describe "Test for Remove-EntraAdministrativeUnitMember" { It "Should return empty object" { + $result = Remove-EntraAdministrativeUnitMember -AdministrativeUnitId $auId -MemberId $memId + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with ObjectId" { $result = Remove-EntraAdministrativeUnitMember -ObjectId $auId -MemberId $memId $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraAdministrativeUnitMember -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Remove-EntraAdministrativeUnitMember -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is null" { - { Remove-EntraAdministrativeUnitMember -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is null" { + { Remove-EntraAdministrativeUnitMember -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when MemberId is empty" { { Remove-EntraAdministrativeUnitMember -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId'*" @@ -37,7 +42,7 @@ Describe "Test for Remove-EntraAdministrativeUnitMember" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraAdministrativeUnitMember" - Remove-EntraAdministrativeUnitMember -ObjectId $auId -MemberId $memId + Remove-EntraAdministrativeUnitMember -AdministrativeUnitId $auId -MemberId $memId $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraAdministrativeUnitMember" @@ -53,7 +58,7 @@ Describe "Test for Remove-EntraAdministrativeUnitMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraAdministrativeUnitMember -ObjectId $auId -MemberId $memId -Debug } | Should -Not -Throw + { Remove-EntraAdministrativeUnitMember -AdministrativeUnitId $auId -MemberId $memId -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraApplication.Tests.ps1 b/test/module/Entra/Remove-EntraApplication.Tests.ps1 index f775b438b..a33ff613a 100644 --- a/test/module/Entra/Remove-EntraApplication.Tests.ps1 +++ b/test/module/Entra/Remove-EntraApplication.Tests.ps1 @@ -14,48 +14,38 @@ BeforeAll { Describe "Remove-EntraApplication" { Context "Test for Remove-EntraApplication" { It "Should return empty object" { + $result = Remove-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Remove-EntraApplication -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is invalid" { + { Remove-EntraApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Remove-EntraApplication -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Remove-EntraApplication -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { Mock -CommandName Remove-MgApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplication" - Remove-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" - - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplication" - + Remove-EntraApplication -ApplicationId bbbbbbbb-1111-2222-3333-cccccccccccc Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } } - It "Should execute successfully without throwing an error" { - # Disable confirmation prompts - $originalDebugPreference = $DebugPreference - $DebugPreference = 'Continue' - - try { - # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw - } finally { - # Restore original confirmation preference - $DebugPreference = $originalDebugPreference - } - } } } \ No newline at end of file diff --git a/test/module/Entra/Remove-EntraApplicationExtensionProperty.Tests.ps1 b/test/module/Entra/Remove-EntraApplicationExtensionProperty.Tests.ps1 index 6f14c9b02..6e6e9e216 100644 --- a/test/module/Entra/Remove-EntraApplicationExtensionProperty.Tests.ps1 +++ b/test/module/Entra/Remove-EntraApplicationExtensionProperty.Tests.ps1 @@ -13,34 +13,40 @@ BeforeAll { Describe "Remove-EntraApplicationExtensionProperty" { Context "Test for Remove-EntraApplicationExtensionProperty" { It "Should return empty object" { + $result = Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraApplicationExtensionProperty -ObjectId -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444"} | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Remove-EntraApplicationExtensionProperty -ApplicationId -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444"} | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraApplicationExtensionProperty -ObjectId "" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is invalid" { + { Remove-EntraApplicationExtensionProperty -ApplicationId "" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } It "Should fail when ExtensionPropertyId is empty" { - { Remove-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId } | Should -Throw "Missing an argument for parameter 'ExtensionPropertyId'*" + { Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId } | Should -Throw "Missing an argument for parameter 'ExtensionPropertyId'*" } It "Should fail when ExtensionPropertyId is invalid" { - { Remove-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "" } | Should -Throw "Cannot bind argument to parameter 'ExtensionPropertyId' because it is an empty string." + { Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "" } | Should -Throw "Cannot bind argument to parameter 'ExtensionPropertyId' because it is an empty string." } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { Mock -CommandName Remove-MgApplicationExtensionProperty -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result = Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationExtensionProperty" - Remove-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" + Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationExtensionProperty" @@ -56,7 +62,7 @@ Describe "Remove-EntraApplicationExtensionProperty" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw + { Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraApplicationOwner.Tests.ps1 b/test/module/Entra/Remove-EntraApplicationOwner.Tests.ps1 index e09af7a59..97fbc3515 100644 --- a/test/module/Entra/Remove-EntraApplicationOwner.Tests.ps1 +++ b/test/module/Entra/Remove-EntraApplicationOwner.Tests.ps1 @@ -11,32 +11,37 @@ BeforeAll { } Describe "Remove-EntraApplicationOwner"{ + It "Should return empty object" { + $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } It "Should return empty object" { $result = Remove-EntraApplicationOwner -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraApplicationOwner -ObjectId "" } + It "Should fail when ApplicationId is empty" { + { Remove-EntraApplicationOwner -ApplicationId "" } } - It "Should fail when -OwnerId is empty" { + It "Should fail when OwnerId is empty" { { Remove-EntraApplicationOwner -OwnerId "" } } - It "Should contain DeviceId in parameters" { + It "Should contain ApplicationId in parameters" { Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraApplicationOwner -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" + $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" } It "Should contain DirectoryObjectId in parameters" { Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraApplicationOwner -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" + $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbbbbb-cccc-dddd-2222-333333333333" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationOwner" - $result = Remove-EntraApplicationOwner -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" + $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationOwner" Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -51,7 +56,7 @@ Describe "Remove-EntraApplicationOwner"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraApplicationOwner -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" -Debug } | Should -Not -Throw + { Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraApplicationPasswordCredential.Tests.ps1 b/test/module/Entra/Remove-EntraApplicationPasswordCredential.Tests.ps1 index 6b48b4803..88efef512 100644 --- a/test/module/Entra/Remove-EntraApplicationPasswordCredential.Tests.ps1 +++ b/test/module/Entra/Remove-EntraApplicationPasswordCredential.Tests.ps1 @@ -12,15 +12,20 @@ BeforeAll { Describe "Remove-EntraApplicationPasswordCredential"{ It "Should return empty object" { + $result = Remove-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with alias" { $result = Remove-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraApplicationPasswordCredential -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Remove-EntraApplicationPasswordCredential -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { Remove-EntraApplicationPasswordCredential -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { Remove-EntraApplicationPasswordCredential -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should fail when KeyId is empty" { { Remove-EntraApplicationPasswordCredential -KeyId "" } | Should -Throw "Cannot bind argument to parameter 'KeyId'*" @@ -31,15 +36,15 @@ Describe "Remove-EntraApplicationPasswordCredential"{ It "Should fail when invalid parameter is passed" { { Remove-EntraApplicationPasswordCredential -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'." } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { Mock -CommandName Remove-MgApplicationPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" + $result = Remove-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationPasswordCredential" - $result = Remove-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" + $result = Remove-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationPasswordCredential" Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { @@ -54,7 +59,7 @@ Describe "Remove-EntraApplicationPasswordCredential"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" -Debug } | Should -Not -Throw + { Remove-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraDeletedDirectoryObject.Tests.ps1 b/test/module/Entra/Remove-EntraDeletedDirectoryObject.Tests.ps1 index 96dbd6e26..854eef784 100644 --- a/test/module/Entra/Remove-EntraDeletedDirectoryObject.Tests.ps1 +++ b/test/module/Entra/Remove-EntraDeletedDirectoryObject.Tests.ps1 @@ -13,24 +13,31 @@ BeforeAll { Describe "Remove-EntraDeletedDirectoryObject" { Context "Test for Remove-EntraDeletedDirectoryObject" { It "Should delete a previously deleted directory object" { + $result = Remove-EntraDeletedDirectoryObject -DirectoryObjectId "11112222-bbbb-3333-cccc-4444dddd5555" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should execute successfully with Alias" { $result = Remove-EntraDeletedDirectoryObject -Id "11112222-bbbb-3333-cccc-4444dddd5555" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Remove-EntraDeletedDirectoryObject -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when DirectoryObjectId is empty" { + { Remove-EntraDeletedDirectoryObject -DirectoryObjectId } | Should -Throw "Missing an argument for parameter 'DirectoryObjectId'*" } - It "Should fail when Id is invalid" { - { Remove-EntraDeletedDirectoryObject -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when DirectoryObjectId is invalid" { + { Remove-EntraDeletedDirectoryObject -DirectoryObjectId "" } | Should -Throw "Cannot bind argument to parameter 'DirectoryObjectId' because it is an empty string." } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeletedDirectoryObject" - Remove-EntraDeletedDirectoryObject -Id "11112222-bbbb-3333-cccc-4444dddd5555" + Remove-EntraDeletedDirectoryObject -DirectoryObjectId "11112222-bbbb-3333-cccc-4444dddd5555" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeletedDirectoryObject" @@ -46,7 +53,7 @@ Describe "Remove-EntraDeletedDirectoryObject" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraDeletedDirectoryObject -Id "11112222-bbbb-3333-cccc-4444dddd5555" -Debug } | Should -Not -Throw + { Remove-EntraDeletedDirectoryObject -DirectoryObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraDevice.Tests.ps1 b/test/module/Entra/Remove-EntraDevice.Tests.ps1 index 82eaaa8f0..2f35c0eb0 100644 --- a/test/module/Entra/Remove-EntraDevice.Tests.ps1 +++ b/test/module/Entra/Remove-EntraDevice.Tests.ps1 @@ -14,28 +14,34 @@ BeforeAll { Describe "Remove-EntraDevice" { Context "Test for Remove-EntraDevice" { It "Should return empty object" { - $result = Remove-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDevice -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Remove-EntraDevice -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should execute successfully with Alias" { + $result = Remove-EntraDevice -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when DeviceId is invalid" { + { Remove-EntraDevice -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Remove-EntraDevice -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when DeviceId is empty" { + { Remove-EntraDevice -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" } - It "Should contain DeviceId in parameters when passed ObjectId to it" { + It "Should contain DeviceId in parameters when passed DeviceId to it" { Mock -CommandName Remove-MgDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDevice -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result $params.DeviceId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDevice" - Remove-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Remove-EntraDevice -DeviceId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDevice" @@ -51,7 +57,7 @@ Describe "Remove-EntraDevice" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraDevice -DeviceId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraDeviceRegisteredOwner.Tests.ps1 b/test/module/Entra/Remove-EntraDeviceRegisteredOwner.Tests.ps1 index da71c857e..3e7a53107 100644 --- a/test/module/Entra/Remove-EntraDeviceRegisteredOwner.Tests.ps1 +++ b/test/module/Entra/Remove-EntraDeviceRegisteredOwner.Tests.ps1 @@ -14,34 +14,40 @@ BeforeAll { Describe "Remove-EntraDeviceRegisteredOwner" { Context "Test for Remove-EntraDeviceRegisteredOwner" { It "Should return empty object" { - $result = Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraDeviceRegisteredOwner -ObjectId -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'ObjectId'*" } + It "Should execute successfully with Alias" { + $result = Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when DeviceId is empty" { + { Remove-EntraDeviceRegisteredOwner -DeviceId -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'DeviceId'*" } } - It "Should fail when ObjectId is invalid" { - { Remove-EntraDeviceRegisteredOwner -ObjectId "" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" } + It "Should fail when DeviceId is invalid" { + { Remove-EntraDeviceRegisteredOwner -DeviceId "" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" } } It "Should fail when OwnerId is empty" { - { Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId | Should -Throw "Missing an argument for parameter 'OwnerId'*" } + { Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId | Should -Throw "Missing an argument for parameter 'OwnerId'*" } } It "Should fail when OwnerId is invalid" { - { Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "" | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string.*" } + { Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "" | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string.*" } } It "Should contain DeviceId in parameters when passed OwnerId to it" { Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain DirectoryObjectId in parameters when passed OwnerId to it" { Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } @@ -49,7 +55,7 @@ Describe "Remove-EntraDeviceRegisteredOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeviceRegisteredOwner" - $result = Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeviceRegisteredOwner" @@ -66,7 +72,7 @@ Describe "Remove-EntraDeviceRegisteredOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraDeviceRegisteredUser.Tests.ps1 b/test/module/Entra/Remove-EntraDeviceRegisteredUser.Tests.ps1 index 253e50113..b2f4e8fa4 100644 --- a/test/module/Entra/Remove-EntraDeviceRegisteredUser.Tests.ps1 +++ b/test/module/Entra/Remove-EntraDeviceRegisteredUser.Tests.ps1 @@ -14,34 +14,40 @@ BeforeAll { Describe "Remove-EntraDeviceRegisteredUser" { Context "Test for Remove-EntraDeviceRegisteredUser" { It "Should return empty object" { - $result = Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraDeviceRegisteredUser -ObjectId -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'ObjectId'*" } + It "Should execute successfully with Alias" { + $result = Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when DeviceId is empty" { + { Remove-EntraDeviceRegisteredUser -DeviceId -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'DeviceId'*" } } - It "Should fail when ObjectId is invalid" { - { Remove-EntraDeviceRegisteredUser -ObjectId "" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" } + It "Should fail when DeviceId is invalid" { + { Remove-EntraDeviceRegisteredUser -DeviceId "" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" } } It "Should fail when UserId is empty" { - { Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId | Should -Throw "Missing an argument for parameter 'UserId'*" } + { Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId | Should -Throw "Missing an argument for parameter 'UserId'*" } } It "Should fail when UserId is invalid" { - { Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "" | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string.*" } + { Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "" | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string.*" } } It "Should contain DeviceId in parameters when passed UserId to it" { Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain DirectoryObjectId in parameters when passed UserId to it" { Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } @@ -49,7 +55,7 @@ Describe "Remove-EntraDeviceRegisteredUser" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeviceRegisteredUser" - Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeviceRegisteredUser" @@ -66,7 +72,7 @@ Describe "Remove-EntraDeviceRegisteredUser" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraDirectoryRoleAssignment.Tests.ps1 b/test/module/Entra/Remove-EntraDirectoryRoleAssignment.Tests.ps1 index 0294f4481..dfe4307d6 100644 --- a/test/module/Entra/Remove-EntraDirectoryRoleAssignment.Tests.ps1 +++ b/test/module/Entra/Remove-EntraDirectoryRoleAssignment.Tests.ps1 @@ -13,28 +13,34 @@ BeforeAll { Describe "Remove-EntraDirectoryRoleAssignment" { Context "Test for Remove-EntraDirectoryRoleAssignment" { It "Should return empty object" { + $result = Remove-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Remove-EntraDirectoryRoleAssignment -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when UnifiedRoleAssignmentId is empty" { + { Remove-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId } | Should -Throw "Missing an argument for parameter 'UnifiedRoleAssignmentId'*" } - It "Should fail when Id is invalid" { - { Remove-EntraDirectoryRoleAssignment -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when UnifiedRoleAssignmentId is invalid" { + { Remove-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'UnifiedRoleAssignmentId' because it is an empty string." } It "Should contain UnifiedRoleAssignmentId in parameters when passed Id to it" { Mock -CommandName Remove-MgRoleManagementDirectoryRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + $result = Remove-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $params = Get-Parameters -data $result $params.UnifiedRoleAssignmentId | Should -Be "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDirectoryRoleAssignment" - Remove-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" + Remove-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDirectoryRoleAssignment" @@ -50,7 +56,7 @@ Describe "Remove-EntraDirectoryRoleAssignment" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Debug } | Should -Not -Throw + { Remove-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraDirectoryRoleDefinition.Tests.ps1 b/test/module/Entra/Remove-EntraDirectoryRoleDefinition.Tests.ps1 index 79cd12682..1b70b45f5 100644 --- a/test/module/Entra/Remove-EntraDirectoryRoleDefinition.Tests.ps1 +++ b/test/module/Entra/Remove-EntraDirectoryRoleDefinition.Tests.ps1 @@ -13,28 +13,34 @@ BeforeAll { Describe "Remove-EntraDirectoryRoleDefinition" { Context "Test for Remove-EntraDirectoryRoleDefinition" { It "Should return empty object" { + $result = Remove-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Remove-EntraDirectoryRoleDefinition -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when UnifiedRoleDefinitionId is empty" { + { Remove-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId } | Should -Throw "Missing an argument for parameter 'UnifiedRoleDefinitionId'*" } - It "Should fail when Id is invalid" { - { Remove-EntraDirectoryRoleDefinition -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string*" + It "Should fail when UnifiedRoleDefinitionId is invalid" { + { Remove-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "" } | Should -Throw "Cannot bind argument to parameter 'UnifiedRoleDefinitionId' because it is an empty string*" } It "Should contain UnifiedRoleDefinitionId in parameters when passed Id to it" { Mock -CommandName Remove-MgRoleManagementDirectoryRoleDefinition -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Remove-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result $params.UnifiedRoleDefinitionId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDirectoryRoleDefinition" - Remove-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + Remove-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDirectoryRoleDefinition" @@ -50,7 +56,7 @@ Describe "Remove-EntraDirectoryRoleDefinition" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + { Remove-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraDirectoryRoleMember.Tests.ps1 b/test/module/Entra/Remove-EntraDirectoryRoleMember.Tests.ps1 index e33005f57..0c050dc2b 100644 --- a/test/module/Entra/Remove-EntraDirectoryRoleMember.Tests.ps1 +++ b/test/module/Entra/Remove-EntraDirectoryRoleMember.Tests.ps1 @@ -13,41 +13,47 @@ BeforeAll { Describe "Remove-EntraDirectoryRoleMember" { Context "Test for Remove-EntraDirectoryRoleMember" { It "Should return empty object" { + $result = Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with alias" { $result = Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraDirectoryRoleMember -ObjectId -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when DirectoryRoleId is empty" { + { Remove-EntraDirectoryRoleMember -DirectoryRoleId -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DirectoryRoleId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraDirectoryRoleMember -ObjectId "" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when DirectoryRoleId is invalid" { + { Remove-EntraDirectoryRoleMember -DirectoryRoleId "" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'DirectoryRoleId' because it is an empty string." } It "Should fail when MemberId is empty" { - { Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" + { Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" } It "Should fail when MemberId is invalid" { - { Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." + { Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." } It "Should contain DirectoryRoleId in parameters when passed ObjectId to it" { Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryRoleId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain DirectoryObjectId in parameters when passed RefObjectId to it" { Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDirectoryRoleMember" - Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDirectoryRoleMember" @@ -63,7 +69,7 @@ Describe "Remove-EntraDirectoryRoleMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraGroup.Tests.ps1 b/test/module/Entra/Remove-EntraGroup.Tests.ps1 index 5964534b2..af0e821d6 100644 --- a/test/module/Entra/Remove-EntraGroup.Tests.ps1 +++ b/test/module/Entra/Remove-EntraGroup.Tests.ps1 @@ -14,28 +14,34 @@ BeforeAll { Describe "Remove-EntraGroup" { Context "Test for Remove-EntraGroup" { It "Should return empty object" { - $result = Remove-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Remove-EntraGroup -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should execute successfully with Alias" { + $result = Remove-EntraGroup -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when GroupId is invalid" { + { Remove-EntraGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Remove-EntraGroup -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Remove-EntraGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Remove-MgGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result $params.GroupId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroup" - Remove-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Remove-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroup" @@ -51,7 +57,7 @@ Describe "Remove-EntraGroup" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraGroupAppRoleAssignment.Tests.ps1 b/test/module/Entra/Remove-EntraGroupAppRoleAssignment.Tests.ps1 index 61d0d4b05..ae40a78f5 100644 --- a/test/module/Entra/Remove-EntraGroupAppRoleAssignment.Tests.ps1 +++ b/test/module/Entra/Remove-EntraGroupAppRoleAssignment.Tests.ps1 @@ -13,34 +13,40 @@ BeforeAll { Describe "Remove-EntraGroupAppRoleAssignment" { Context "Test for Remove-EntraGroupAppRoleAssignment" { It "Should return empty object" { + $result = Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with Alias" { $result = Remove-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraGroupAppRoleAssignment -ObjectId -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Remove-EntraGroupAppRoleAssignment -GroupId -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraGroupAppRoleAssignment -ObjectId "" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Remove-EntraGroupAppRoleAssignment -GroupId "" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when AppRoleAssignmentId is empty" { - { Remove-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId } | Should -Throw "Missing an argument for parameter 'AppRoleAssignmentId'*" + { Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId } | Should -Throw "Missing an argument for parameter 'AppRoleAssignmentId'*" } It "Should fail when AppRoleAssignmentId is invalid" { - { Remove-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleAssignmentId' because it is an empty string." + { Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleAssignmentId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Remove-MgGroupAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result = Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupAppRoleAssignment" - Remove-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupAppRoleAssignment" @@ -56,7 +62,7 @@ Describe "Remove-EntraGroupAppRoleAssignment" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" -Debug } | Should -Not -Throw + { Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraGroupLifecyclePolicy.Tests.ps1 b/test/module/Entra/Remove-EntraGroupLifecyclePolicy.Tests.ps1 index 96969534b..7b3b2ce2d 100644 --- a/test/module/Entra/Remove-EntraGroupLifecyclePolicy.Tests.ps1 +++ b/test/module/Entra/Remove-EntraGroupLifecyclePolicy.Tests.ps1 @@ -13,24 +13,29 @@ BeforeAll { Describe "Remove-EntraGroupLifecyclePolicy" { Context "Test for Remove-EntraGroupLifecyclePolicy" { It "Should remove a groupLifecyclePolicies" { - $result = Remove-EntraGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result = Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 } + It "Should execute successfully with Alias" { + $result = Remove-EntraGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result | Should -BeNullOrEmpty - It "Should fail when Id is empty" { - { Remove-EntraGroupLifecyclePolicy -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when GroupLifecyclePolicyId is empty" { + { Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'*" } - It "Should fail when Id is invalid" { - { Remove-EntraGroupLifecyclePolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string." } - It "Should contain GroupLifecyclePolicyId in parameters when passed Id to it" { + It "Should contain GroupLifecyclePolicyId in parameters when passed GroupLifecyclePolicyId to it" { Mock -CommandName Remove-MgGroupLifecyclePolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result = Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $params = Get-Parameters -data $result $params.GroupLifecyclePolicyId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } @@ -38,7 +43,7 @@ Describe "Remove-EntraGroupLifecyclePolicy" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupLifecyclePolicy" - Remove-EntraGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" + Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupLifecyclePolicy" @@ -54,7 +59,7 @@ Describe "Remove-EntraGroupLifecyclePolicy" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Debug } | Should -Not -Throw + { Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraGroupMember.Tests.ps1 b/test/module/Entra/Remove-EntraGroupMember.Tests.ps1 index 2be0d8174..302d7fbc6 100644 --- a/test/module/Entra/Remove-EntraGroupMember.Tests.ps1 +++ b/test/module/Entra/Remove-EntraGroupMember.Tests.ps1 @@ -13,32 +13,32 @@ BeforeAll { Describe "Remove-EntraGroupMember" { Context "Test for Remove-EntraGroupMember" { It "Should reemove a member" { - $result = Remove-EntraGroupMember -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result = Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgGroupMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraGroupMember -ObjectId -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Remove-EntraGroupMember -GroupId -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraGroupMember -ObjectId "" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Remove-EntraGroupMember -GroupId "" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when MemberId is empty" { - { Remove-EntraGroupMember -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" + { Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" } It "Should fail when MemberId is invalid" { - { Remove-EntraGroupMember -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." + { Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Remove-MgGroupMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraGroupMember -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result = Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result $params.GroupId | Should -Be "11112222-bbbb-3333-cccc-4444dddd5555" } @@ -46,7 +46,7 @@ Describe "Remove-EntraGroupMember" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupMember" - Remove-EntraGroupMember -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" + Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupMember" @@ -62,7 +62,7 @@ Describe "Remove-EntraGroupMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraGroupMember -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw + { Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraGroupOwner.Tests.ps1 b/test/module/Entra/Remove-EntraGroupOwner.Tests.ps1 index d6d9bb65c..4663a3927 100644 --- a/test/module/Entra/Remove-EntraGroupOwner.Tests.ps1 +++ b/test/module/Entra/Remove-EntraGroupOwner.Tests.ps1 @@ -13,32 +13,32 @@ BeforeAll { Describe "Remove-EntraGroupOwner" { Context "Test for Remove-EntraGroupOwner" { It "Should remove an owner" { - $result = Remove-EntraGroupOwner -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result = Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraGroupOwner -ObjectId -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Remove-EntraGroupOwner -GroupId -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraGroupOwner -ObjectId "" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Remove-EntraGroupOwner -GroupId "" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when OwnerId is empty" { - { Remove-EntraGroupOwner -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId } | Should -Throw "Missing an argument for parameter 'OwnerId'*" + { Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId } | Should -Throw "Missing an argument for parameter 'OwnerId'*" } It "Should fail when OwnerId is invalid" { - { Remove-EntraGroupOwner -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "" } | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string." + { Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "" } | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Remove-MgGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraGroupOwner -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result = Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result $params.GroupId | Should -Be "11112222-bbbb-3333-cccc-4444dddd5555" } @@ -46,7 +46,7 @@ Describe "Remove-EntraGroupOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupOwner" - Remove-EntraGroupOwner -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" + Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupOwner" @@ -62,7 +62,7 @@ Describe "Remove-EntraGroupOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraGroupOwner -ObjectId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw + { Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraIdentityProvider.Tests.ps1 b/test/module/Entra/Remove-EntraIdentityProvider.Tests.ps1 index 1901a35fd..f90f8909f 100644 --- a/test/module/Entra/Remove-EntraIdentityProvider.Tests.ps1 +++ b/test/module/Entra/Remove-EntraIdentityProvider.Tests.ps1 @@ -14,28 +14,34 @@ BeforeAll { Describe "Remove-EntraIdentityProvider" { Context "Test for Remove-EntraIdentityProvider" { It "Should return empty object" { + $result = Remove-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraIdentityProvider -Id "Google-OAUTH" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should fail when Id is empty" { - { Remove-EntraIdentityProvider -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + { Remove-EntraIdentityProvider -IdentityProviderBaseId } | Should -Throw "Missing an argument for parameter 'IdentityProviderBaseId'*" } - It "Should fail when Id is invalid" { - { Remove-EntraIdentityProvider -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when IdentityProviderBaseId is invalid" { + { Remove-EntraIdentityProvider -IdentityProviderBaseId "" } | Should -Throw "Cannot bind argument to parameter 'IdentityProviderBaseId' because it is an empty string." } - It "Should contain IdentityProviderBaseId in parameters when passed Id to it" { + It "Should contain IdentityProviderBaseId in parameters when passed IdentityProviderBaseId to it" { Mock -CommandName Remove-MgIdentityProvider -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraIdentityProvider -Id "Google-OAUTH" + $result = Remove-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $params = Get-Parameters -data $result $params.IdentityProviderBaseId | Should -Be "Google-OAUTH" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraIdentityProvider" - Remove-EntraIdentityProvider -Id "Google-OAUTH" + Remove-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraIdentityProvider" @@ -51,7 +57,7 @@ Context "Test for Remove-EntraIdentityProvider" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraIdentityProvider -Id "Google-OAUTH" -Debug } | Should -Not -Throw + { Remove-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraLifecyclePolicyGroup.Tests.ps1 b/test/module/Entra/Remove-EntraLifecyclePolicyGroup.Tests.ps1 index 141e40cc2..1b06b4cd8 100644 --- a/test/module/Entra/Remove-EntraLifecyclePolicyGroup.Tests.ps1 +++ b/test/module/Entra/Remove-EntraLifecyclePolicyGroup.Tests.ps1 @@ -21,36 +21,43 @@ BeforeAll { Describe "Remove-EntraLifecyclePolicyGroup" { Context "Test for Remove-EntraLifecyclePolicyGroup" { It "Should remove a group from a lifecycle policy" { + $result = Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" + $result.Value | Should -Be $true + + Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should remove a group from a lifecycle policy with alias" { $result = Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" $result.Value | Should -Be $true Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Remove-EntraLifecyclePolicyGroup -Id -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when GroupLifecyclePolicyId is empty" { + { Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'*" } - It "Should fail when Id is invalid" { - { Remove-EntraLifecyclePolicyGroup -Id "" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string." } It "Should fail when GroupId is empty" { - { Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" + { Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } It "Should fail when GroupId is invalid" { - { Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." + { Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } - It "Should contain GroupLifecyclePolicyId in parameters when passed Id to it" { - $result = Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "bea81df1-91cb-4b6e-aa79-b40888fe0b8b" + It "Should contain GroupLifecyclePolicyId in parameters when passed GroupLifecyclePolicyId to it" { + $result = Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "bea81df1-91cb-4b6e-aa79-b40888fe0b8b" $params = Get-Parameters -data $result.Parameters $params.GroupLifecyclePolicyId | Should -Be "bbbbcccc-1111-dddd-2222-eeee3333ffff" } It "Should contain GroupId in parameters when passed GroupId to it" { - $result = Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" + $result = Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" $params = Get-Parameters -data $result.Parameters $params.GroupId | Should -Be "ccccdddd-2222-eeee-3333-ffff4444aaaa" } @@ -58,7 +65,7 @@ Describe "Remove-EntraLifecyclePolicyGroup" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraLifecyclePolicyGroup" - Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" + Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraLifecyclePolicyGroup" @@ -74,7 +81,7 @@ Describe "Remove-EntraLifecyclePolicyGroup" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" -Debug } | Should -Not -Throw + { Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraScopedRoleMembership.Tests.ps1 b/test/module/Entra/Remove-EntraScopedRoleMembership.Tests.ps1 index 2a1e63972..52a70a536 100644 --- a/test/module/Entra/Remove-EntraScopedRoleMembership.Tests.ps1 +++ b/test/module/Entra/Remove-EntraScopedRoleMembership.Tests.ps1 @@ -12,15 +12,20 @@ BeforeAll { Describe "Test for Remove-EntraScopedRoleMembership" { It "Should return empty object" { - $result = Remove-EntraScopedRoleMembership -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" -ScopedRoleMembershipId "bbbbbbbb-2222-2222-2222-cccccccccccc" + $result = Remove-EntraScopedRoleMembership -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc -ScopedRoleMembershipId bbbbbbbb-2222-2222-2222-cccccccccccc $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraScopedRoleMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should return empty object with ObjectId" { + $result = Remove-EntraScopedRoleMembership -ObjectId bbbbbbbb-1111-1111-1111-cccccccccccc -ScopedRoleMembershipId bbbbbbbb-2222-2222-2222-cccccccccccc + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when AdministrativeUnitId is empty" { + { Remove-EntraScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is null" { - { Remove-EntraScopedRoleMembership -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is null" { + { Remove-EntraScopedRoleMembership -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when ScopedRoleMembershipId is empty" { { Remove-EntraScopedRoleMembership -ScopedRoleMembershipId "" } | Should -Throw "Cannot bind argument to parameter 'ScopedRoleMembershipId'*" @@ -34,7 +39,7 @@ Describe "Test for Remove-EntraScopedRoleMembership" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraScopedRoleMembership" - Remove-EntraScopedRoleMembership -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" -ScopedRoleMembershipId "bbbbbbbb-2222-2222-2222-cccccccccccc" + Remove-EntraScopedRoleMembership -AdministrativeUnitId "bbbbbbbb-1111-1111-1111-cccccccccccc" -ScopedRoleMembershipId "bbbbbbbb-2222-2222-2222-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraScopedRoleMembership" @@ -50,7 +55,7 @@ Describe "Test for Remove-EntraScopedRoleMembership" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraScopedRoleMembership -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" -ScopedRoleMembershipId "bbbbbbbb-2222-2222-2222-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraScopedRoleMembership -AdministrativeUnitId "bbbbbbbb-1111-1111-1111-cccccccccccc" -ScopedRoleMembershipId "bbbbbbbb-2222-2222-2222-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraServicePrincipal.Tests.ps1 b/test/module/Entra/Remove-EntraServicePrincipal.Tests.ps1 index 83cfdb698..cf6f3f935 100644 --- a/test/module/Entra/Remove-EntraServicePrincipal.Tests.ps1 +++ b/test/module/Entra/Remove-EntraServicePrincipal.Tests.ps1 @@ -12,21 +12,25 @@ BeforeAll { Describe "Remove-EntraServicePrincipal" { Context "Test for Remove-EntraServicePrincipal" { It "Should return empty object" { + $result = Remove-EntraServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should update the parameter with Alias" { $result = Remove-EntraServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 } - - It "Should fail when ObjectId is empty" { - { Remove-EntraServicePrincipal -ObjectId }| Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when ServicePrincipalId is empty" { + { Remove-EntraServicePrincipal -ServicePrincipalId }| Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraServicePrincipal -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when ServicePrincipalId is invalid" { + { Remove-EntraServicePrincipal -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { Mock -CommandName Remove-MgServicePrincipal -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Remove-EntraServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -34,7 +38,7 @@ Describe "Remove-EntraServicePrincipal" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipal" - Remove-EntraServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Remove-EntraServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipal" @@ -51,7 +55,7 @@ Describe "Remove-EntraServicePrincipal" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Remove-EntraServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 b/test/module/Entra/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 index fb6c7a59d..62046b874 100644 --- a/test/module/Entra/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 +++ b/test/module/Entra/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 @@ -11,54 +11,57 @@ BeforeAll { } Describe "Remove-EntraServicePrincipalAppRoleAssignment" { Context "Test for Remove-EntraServicePrincipalAppRoleAssignment" { - It "Should return empty object" { + It "Should return empty ServicePrincipalId" { + $result = Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraServicePrincipalAppRoleAssignment -ObjectId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraServicePrincipalAppRoleAssignment -ObjectId -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww"}| Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when ServicePrincipalId is empty" { + { Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww"}| Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraServicePrincipalAppRoleAssignment -ObjectId "" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when ServicePrincipalId is invalid" { + { Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } It "Should fail when AppRoleAssignmentId is empty" { - { Remove-EntraServicePrincipalAppRoleAssignment -ObjectId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId }| Should -Throw "Missing an argument for parameter 'AppRoleAssignmentId'.*" + { Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId }| Should -Throw "Missing an argument for parameter 'AppRoleAssignmentId'.*" } It "Should fail when AppRoleAssignmentId is invalid" { - { Remove-EntraServicePrincipalAppRoleAssignment -ObjectId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleAssignmentId' because it is an empty string.*" + { Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleAssignmentId' because it is an empty string.*" } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { Mock -CommandName Remove-MgServicePrincipalAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraServicePrincipalAppRoleAssignment -ObjectId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" + $result = Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "cc7fcc82-ac1b-4785-af47-2ca3b7052886" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalAppRoleAssignment" - $result = Remove-EntraServicePrincipalAppRoleAssignment -ObjectId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" - $result | Should -BeNullOrEmpty - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalAppRoleAssignment" + Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" Should -Invoke -CommandName Remove-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } } - It "Should execute successfully without throwing an error " { + It "Should execute successfully without throwing an error" { # Disable confirmation prompts $originalDebugPreference = $DebugPreference $DebugPreference = 'Continue' - + try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraServicePrincipalAppRoleAssignment -ObjectId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" -Debug } | Should -Not -Throw + { Remove-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "cc7fcc82-ac1b-4785-af47-2ca3b7052886" -AppRoleAssignmentId "gsx_zBushUevRyyjtwUohm_RMYjcGsJIjXwKOVMr3ww" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference } - } + } } } \ No newline at end of file diff --git a/test/module/Entra/Remove-EntraServicePrincipalOwner.Tests.ps1 b/test/module/Entra/Remove-EntraServicePrincipalOwner.Tests.ps1 index b7d0ed84b..06a430fdd 100644 --- a/test/module/Entra/Remove-EntraServicePrincipalOwner.Tests.ps1 +++ b/test/module/Entra/Remove-EntraServicePrincipalOwner.Tests.ps1 @@ -13,34 +13,38 @@ BeforeAll { Describe "Remove-EntraServicePrincipalOwner" { Context "Test for Remove-EntraServicePrincipalOwner" { It "Should return empty object" { + $result = Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should update the parameter with Alias" { $result = Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - - It "Should fail when ObjectId is empty" { - { Remove-EntraServicePrincipalOwner -ObjectId -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" }| Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when ServicePrincipalId is empty" { + { Remove-EntraServicePrincipalOwner -ServicePrincipalId -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" }| Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraServicePrincipalOwner -ObjectId "" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333"} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when ServicePrincipalId is invalid" { + { Remove-EntraServicePrincipalOwner -ServicePrincipalId "" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333"} | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } It "Should fail when OwnerId is empty" { - { Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId } | Should -Throw "Missing an argument for parameter 'OwnerId'.*" + { Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId } | Should -Throw "Missing an argument for parameter 'OwnerId'.*" } It "Should fail when OwnerId is invalid" { - { Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId ""} | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string." + { Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId ""} | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string." } - It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { + It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + $result = Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain DirectoryObjectId in parameters when passed OwnerId to it" { Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + $result = Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } @@ -48,7 +52,7 @@ Describe "Remove-EntraServicePrincipalOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalOwner" - Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalOwner" @@ -65,7 +69,7 @@ Describe "Remove-EntraServicePrincipalOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -Debug } | Should -Not -Throw + { Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 b/test/module/Entra/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 index 9a8017d64..c413bef8f 100644 --- a/test/module/Entra/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 +++ b/test/module/Entra/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 @@ -13,34 +13,40 @@ BeforeAll { Describe "Remove-EntraServicePrincipalPasswordCredential" { Context "Test for Remove-EntraServicePrincipalPasswordCredential" { It "Should return empty object" { - $result = Remove-EntraServicePrincipalPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + $result = Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectID is empty" { - { Remove-EntraServicePrincipalPasswordCredential -ObjectID -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } | should -Throw "Missing an argument for parameter 'ObjectID'.*" + It "Should update the parameter with Alias" { + $result = Remove-EntraServicePrincipalPasswordCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when ServicePrincipalId is empty" { + { Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } | should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectID is invalid" { - {Remove-EntraServicePrincipalPasswordCredential -ObjectID "" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } | should -Throw "Cannot bind argument to parameter 'ObjectID'*" + It "Should fail when ServicePrincipalId is invalid" { + {Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } | should -Throw "Cannot bind argument to parameter 'ServicePrincipalId'*" } It "Should fail when KeyId is empty" { - {Remove-EntraServicePrincipalPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId } | should -Throw "Missing an argument for parameter 'KeyId'.*" + {Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId } | should -Throw "Missing an argument for parameter 'KeyId'.*" } It "Should fail when KeyId is invalid" { - { Remove-EntraServicePrincipalPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId ""} | should -Throw "Cannot bind argument to parameter 'KeyId'*" + { Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId ""} | should -Throw "Cannot bind argument to parameter 'KeyId'*" } It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { Mock -CommandName Remove-MgServicePrincipalPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraServicePrincipalPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + $result = Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalPasswordCredential" - Remove-EntraServicePrincipalPasswordCredential -ObjectID "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalPasswordCredential" diff --git a/test/module/Entra/Remove-EntraUser.Tests.ps1 b/test/module/Entra/Remove-EntraUser.Tests.ps1 index dcf0024e3..3c839bb1c 100644 --- a/test/module/Entra/Remove-EntraUser.Tests.ps1 +++ b/test/module/Entra/Remove-EntraUser.Tests.ps1 @@ -15,27 +15,32 @@ BeforeAll { Describe "Remove-EntraUser" { Context "Test for Remove-EntraUser" { It "Should return empty object" { + $result = Remove-EntraUser -UserId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraUser -ObjectId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string" { - { Remove-EntraUser -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string" { + { Remove-EntraUser -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Remove-EntraUser -ObjectId } | Should -Throw "Missing an argument for parameter*" + It "Should fail when UserId is empty" { + { Remove-EntraUser -UserId } | Should -Throw "Missing an argument for parameter*" } - It "Should contain Id in parameters when passed ObjectId to it" { + It "Should contain Id in parameters when passed UserId to it" { Mock -CommandName Remove-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraUser -ObjectId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" + $result = Remove-EntraUser -UserId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" $params = Get-Parameters -data $result $params.userId | Should -Be "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraUser" - Remove-EntraUser -ObjectId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" + Remove-EntraUser -UserId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraUser" @@ -51,7 +56,7 @@ Describe "Remove-EntraUser" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraUser -ObjectId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Remove-EntraUser -UserId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Remove-EntraUserManager.Tests.ps1 b/test/module/Entra/Remove-EntraUserManager.Tests.ps1 index 29d6baee0..ddc2f3c83 100644 --- a/test/module/Entra/Remove-EntraUserManager.Tests.ps1 +++ b/test/module/Entra/Remove-EntraUserManager.Tests.ps1 @@ -14,20 +14,25 @@ BeforeAll { Describe "Remove-EntraUserManager" { Context "Test for Remove-EntraUserManager" { It "Should return empty object" { + $result = Remove-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with alias" { $result = Remove-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string" { - { Remove-EntraUserManager -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string" { + { Remove-EntraUserManager -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Remove-EntraUserManager -ObjectId } | Should -Throw "Missing an argument for parameter*" + It "Should fail when UserId is empty" { + { Remove-EntraUserManager -UserId } | Should -Throw "Missing an argument for parameter*" } - It "Should contain Id in parameters when passed ObjectId to it" { + It "Should contain UserId in parameters when passed UserId to it" { Mock -CommandName Remove-MgUserManagerByRef -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Remove-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Remove-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result $params.userId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -36,7 +41,7 @@ Describe "Remove-EntraUserManager" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraUserManager" - Remove-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + Remove-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraUserManager" @@ -53,7 +58,7 @@ Describe "Remove-EntraUserManager" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Remove-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Revoke-EntraUserAllRefreshToken.Tests.ps1 b/test/module/Entra/Revoke-EntraUserAllRefreshToken.Tests.ps1 index 9e919b79f..96f8afde1 100644 --- a/test/module/Entra/Revoke-EntraUserAllRefreshToken.Tests.ps1 +++ b/test/module/Entra/Revoke-EntraUserAllRefreshToken.Tests.ps1 @@ -14,20 +14,25 @@ BeforeAll { Describe "Revoke-EntraUserAllRefreshToken" { Context "Test for Revoke-EntraUserAllRefreshToken" { It "Should return empty object" { + $result = Revoke-EntraUserAllRefreshToken -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with alias" { $result = Revoke-EntraUserAllRefreshToken -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string" { - { Revoke-EntraUserAllRefreshToken -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string" { + { Revoke-EntraUserAllRefreshToken -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Revoke-EntraUserAllRefreshToken -ObjectId } | Should -Throw "Missing an argument for parameter*" + It "Should fail when UserId is empty" { + { Revoke-EntraUserAllRefreshToken -UserId } | Should -Throw "Missing an argument for parameter*" } - It "Should contain Id in parameters when passed ObjectId to it" { + It "Should contain Id in parameters when passed UserId to it" { Mock -CommandName Revoke-MgUserSignInSession -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Revoke-EntraUserAllRefreshToken -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Revoke-EntraUserAllRefreshToken -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result $params.userId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -35,7 +40,7 @@ Describe "Revoke-EntraUserAllRefreshToken" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Revoke-EntraUserAllRefreshToken" - Revoke-EntraUserAllRefreshToken -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + Revoke-EntraUserAllRefreshToken -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Revoke-EntraUserAllRefreshToken" @@ -52,7 +57,7 @@ Describe "Revoke-EntraUserAllRefreshToken" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Revoke-EntraUserAllRefreshToken -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Revoke-EntraUserAllRefreshToken -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraAdministrativeUnit.Tests.ps1 b/test/module/Entra/Set-EntraAdministrativeUnit.Tests.ps1 index dc624a57e..f05c33dbf 100644 --- a/test/module/Entra/Set-EntraAdministrativeUnit.Tests.ps1 +++ b/test/module/Entra/Set-EntraAdministrativeUnit.Tests.ps1 @@ -12,24 +12,27 @@ BeforeAll { Describe "Test for Set-EntraAdministrativeUnit" { It "Should return empty object" { - $result = Set-EntraAdministrativeUnit -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" -DisplayName "test" -Description "test" + $result = Set-EntraAdministrativeUnit -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc -DisplayName "test" -Description "test" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraAdministrativeUnit -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should return empty object withObjectID" { + $result = Set-EntraAdministrativeUnit -ObjectId bbbbbbbb-1111-1111-1111-cccccccccccc -DisplayName "test" -Description "test" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when AdministrativeUnitId is empty" { + { Set-EntraAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is null" { - { Set-EntraAdministrativeUnit -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is null" { + { Set-EntraAdministrativeUnit -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when invalid parameter is passed" { { Set-EntraAdministrativeUnit -xyz } | Should -Throw "A parameter cannot be found that matches parameter name 'xyz'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraAdministrativeUnit" - Set-EntraAdministrativeUnit -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" -DisplayName "test" -Description "test" - - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraAdministrativeUnit" + Set-EntraAdministrativeUnit -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc -DisplayName "test" -Description "test" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true @@ -42,7 +45,7 @@ Describe "Test for Set-EntraAdministrativeUnit" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraAdministrativeUnit -ObjectId "bbbbbbbb-1111-1111-1111-cccccccccccc" -DisplayName "test" -Description "test" -Debug } | Should -Not -Throw + { Set-EntraAdministrativeUnit -AdministrativeUnitId "bbbbbbbb-1111-1111-1111-cccccccccccc" -DisplayName "test" -Description "test" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraApplication.Tests.ps1 b/test/module/Entra/Set-EntraApplication.Tests.ps1 index e2c8e5cce..b53209e2a 100644 --- a/test/module/Entra/Set-EntraApplication.Tests.ps1 +++ b/test/module/Entra/Set-EntraApplication.Tests.ps1 @@ -14,28 +14,35 @@ BeforeAll { Describe "Set-EntraApplication"{ Context "Test for Set-EntraApplication" { It "Should return empty object"{ + $result = Set-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" -DisplayName "Mock-App" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Set-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -DisplayName "Mock-App" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Set-EntraApplication -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is invalid" { + { Set-EntraApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Set-EntraApplication -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Set-EntraApplication -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { Mock -CommandName Update-MgApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Set-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Set-EntraApplication -ApplicationId bbbbbbbb-1111-2222-3333-cccccccccccc + $result = Set-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraApplication" - Set-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Set-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraApplication" @@ -51,7 +58,7 @@ Describe "Set-EntraApplication"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Set-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraApplicationLogo.Tests.ps1 b/test/module/Entra/Set-EntraApplicationLogo.Tests.ps1 index 18b271160..c051aa861 100644 --- a/test/module/Entra/Set-EntraApplicationLogo.Tests.ps1 +++ b/test/module/Entra/Set-EntraApplicationLogo.Tests.ps1 @@ -13,23 +13,29 @@ BeforeAll { Describe "Set-EntraApplicationLogo"{ Context "Test for Set-EntraApplicationLogo" { It "Should return empty object"{ + $result = Set-EntraApplicationLogo -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return empty object with alias"{ $result = Set-EntraApplicationLogo -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraApplicationLogo -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + + It "Should fail when ApplicationId is empty" { + { Set-EntraApplicationLogo -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { Set-EntraApplicationLogo -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { Set-EntraApplicationLogo -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should fail when filepath invalid"{ - { Set-EntraApplicationLogo -ObjectId f82a3f32-6bb6-404b-843c-5512fb3b35b8 -FilePath "sdd" } | Should -Throw "FilePath is invalid" + { Set-EntraApplicationLogo -ApplicationId f82a3f32-6bb6-404b-843c-5512fb3b35b8 -FilePath "sdd" } | Should -Throw "FilePath is invalid" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraApplicationLogo" - Set-EntraApplicationLogo -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" + Set-EntraApplicationLogo -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraApplicationLogo" @@ -45,7 +51,7 @@ Describe "Set-EntraApplicationLogo"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraApplicationLogo -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" -Debug } | Should -Not -Throw + { Set-EntraApplicationLogo -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraAttributeSet.Tests.ps1 b/test/module/Entra/Set-EntraAttributeSet.Tests.ps1 index 7f2376f68..5d6aaf317 100644 --- a/test/module/Entra/Set-EntraAttributeSet.Tests.ps1 +++ b/test/module/Entra/Set-EntraAttributeSet.Tests.ps1 @@ -14,13 +14,19 @@ BeforeAll { Describe "Set-EntraAttributeSet" { Context "Test for Set-EntraAttributeSet" { It "Should return created AttributeSet" { + $result = Set-EntraAttributeSet -AttributeSetId "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should return created AttributeSet with alias" { $result = Set-EntraAttributeSet -Id "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id parameter is empty" { - { Set-EntraAttributeSet -Id } | Should -Throw "Missing an argument for parameter 'Id*" + It "Should fail when AttributeSetId parameter is empty" { + { Set-EntraAttributeSet -AttributeSetId } | Should -Throw "Missing an argument for parameter 'AttributeSetId*" } It "Should fail when Description parameter is empty" { { Set-EntraAttributeSet -Description } | Should -Throw "Missing an argument for parameter 'Description*" @@ -34,28 +40,26 @@ Describe "Set-EntraAttributeSet" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraAttributeSet" - $result = Set-EntraAttributeSet -Id "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 - $result | Should -BeNullOrEmpty - - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraAttributeSet" - + Set-EntraAttributeSet -AttributeSetId "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 | Out-Null Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } - } - It "Should execute successfully without throwing an error" { + } + It "Should execute successfully without throwing an error " { # Disable confirmation prompts $originalDebugPreference = $DebugPreference $DebugPreference = 'Continue' - + try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraAttributeSet -Id "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 -Debug } | Should -Not -Throw + { + Set-EntraAttributeSet -AttributeSetId "NewCustomAttributeSet" -Description "CustomAttributeSet" -MaxAttributesPerSet 125 -Debug + } | Should -Not -Throw } finally { - # Restore original confirmation preference - $DebugPreference = $originalDebugPreference + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference } - } + } } } \ No newline at end of file diff --git a/test/module/Entra/Set-EntraDevice.Tests.ps1 b/test/module/Entra/Set-EntraDevice.Tests.ps1 index f95ad6992..12381be3e 100644 --- a/test/module/Entra/Set-EntraDevice.Tests.ps1 +++ b/test/module/Entra/Set-EntraDevice.Tests.ps1 @@ -14,28 +14,34 @@ BeforeAll { Describe "Set-EntraDevice"{ Context "Test for Set-EntraDevice" { It "Should return empty object"{ - $result = Set-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -DisplayName "Mock-App" -AccountEnabled $true + $result = Set-EntraDevice -DeviceObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" -AccountEnabled $true $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is invalid" { - { Set-EntraDevice -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should execute successfully with Alias" { + $result = Set-EntraDevice -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" -AccountEnabled $true + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should fail when DeviceObjectId is invalid" { + { Set-EntraDevice -DeviceObjectId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceObjectId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Set-EntraDevice -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when DeviceObjectId is empty" { + { Set-EntraDevice -DeviceObjectId } | Should -Throw "Missing an argument for parameter 'DeviceObjectId'*" } - It "Should contain DeviceId in parameters when passed ObjectId to it" { + It "Should contain DeviceId in parameters when passed DeviceObjectId to it" { Mock -CommandName Update-MgDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Set-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Set-EntraDevice -DeviceObjectId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result $params.DeviceId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDevice" - Set-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Set-EntraDevice -DeviceObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDevice" @@ -51,7 +57,7 @@ Describe "Set-EntraDevice"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Set-EntraDevice -DeviceObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraDirectoryRoleDefinition.Tests.ps1 b/test/module/Entra/Set-EntraDirectoryRoleDefinition.Tests.ps1 index 3c46286f9..133166f8c 100644 --- a/test/module/Entra/Set-EntraDirectoryRoleDefinition.Tests.ps1 +++ b/test/module/Entra/Set-EntraDirectoryRoleDefinition.Tests.ps1 @@ -13,6 +13,14 @@ BeforeAll { Describe "Set-EntraDirectoryRoleDefinition" { Context "Test for Set-EntraDirectoryRoleDefinition" { It "Should return empty object" { + $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission + $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") + $result = Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 3 + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") $result = Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 3 @@ -20,51 +28,51 @@ Describe "Set-EntraDirectoryRoleDefinition" { Should -Invoke -CommandName Update-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is empty" { - { Set-EntraDirectoryRoleDefinition -Id -DisplayName 'Mock-App' -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when UnifiedRoleDefinitionId is empty" { + { Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId -DisplayName 'Mock-App' -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Missing an argument for parameter 'UnifiedRoleDefinitionId'*" } - It "Should fail when Id is invalid" { - { Set-EntraDirectoryRoleDefinition -Id "" -IsEnabled $false -DisplayName 'Mock-App' -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 3 } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string*" + It "Should fail when UnifiedRoleDefinitionId is invalid" { + { Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "" -IsEnabled $false -DisplayName 'Mock-App' -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 3 } | Should -Throw "Cannot bind argument to parameter 'UnifiedRoleDefinitionId' because it is an empty string*" } It "Should fail when RolePermissions is empty" { - {Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions } | Should -Throw "Missing an argument for parameter 'RolePermissions'*" + {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions } | Should -Throw "Missing an argument for parameter 'RolePermissions'*" } It "Should fail when IsEnabled is empty" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -IsEnabled } | Should -Throw "Missing an argument for parameter 'IsEnabled'*" + {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -IsEnabled } | Should -Throw "Missing an argument for parameter 'IsEnabled'*" } It "Should fail when DisplayName is empty" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DisplayName } | Should -Throw "Missing an argument for parameter 'DisplayName'*" + {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DisplayName } | Should -Throw "Missing an argument for parameter 'DisplayName'*" } It "Should fail when ResourceScopes is empty" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -ResourceScopes } | Should -Throw "Missing an argument for parameter 'ResourceScopes'*" + {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -ResourceScopes } | Should -Throw "Missing an argument for parameter 'ResourceScopes'*" } It "Should fail when Description is empty" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Description } | Should -Throw "Missing an argument for parameter 'Description'*" + {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Description } | Should -Throw "Missing an argument for parameter 'Description'*" } It "Should fail when TemplateId is empty" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -TemplateId } | Should -Throw "Missing an argument for parameter 'TemplateId'*" + {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -TemplateId } | Should -Throw "Missing an argument for parameter 'TemplateId'*" } It "Should fail when Version is empty" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Version } | Should -Throw "Missing an argument for parameter 'Version'*" + {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Version } | Should -Throw "Missing an argument for parameter 'Version'*" } It "Should contain UnifiedRoleDefinitionId in parameters when passed Id to it" { Mock -CommandName Update-MgRoleManagementDirectoryRoleDefinition -MockWith {$args} -ModuleName Microsoft.Graph.Entra $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - $result = Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 + $result = Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 $params = Get-Parameters -data $result $params.UnifiedRoleDefinitionId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } @@ -73,7 +81,7 @@ Describe "Set-EntraDirectoryRoleDefinition" { $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 + Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDirectoryRoleDefinition" @@ -91,7 +99,7 @@ Describe "Set-EntraDirectoryRoleDefinition" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 -Debug } | Should -Not -Throw + { Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraGroup.Tests.ps1 b/test/module/Entra/Set-EntraGroup.Tests.ps1 index 2c1a59dab..fdc0ad991 100644 --- a/test/module/Entra/Set-EntraGroup.Tests.ps1 +++ b/test/module/Entra/Set-EntraGroup.Tests.ps1 @@ -14,18 +14,27 @@ BeforeAll { Describe "Set-EntraGroup" { Context "Test for Set-EntraGroup" { It "Should return empty object" { + $result = Set-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "demo" -MailEnabled $false -SecurityEnabled $true -MailNickName "demoNickname" -Description "test" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + } + It "Should execute successfully with Alias" { $result = Set-EntraGroup -Id bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "demo" -MailEnabled $false -SecurityEnabled $true -MailNickName "demoNickname" -Description "test" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraGroup -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." - } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should fail when GroupId is invalid" { + { Set-EntraGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." + } + It "Should fail when GroupId is empty" { + { Set-EntraGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" + } + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Update-MgGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra - $result = Set-EntraGroup -Id bbbbbbbb-1111-2222-3333-cccccccccccc + $result = Set-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result $params.GroupId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } diff --git a/test/module/Entra/Set-EntraGroupLifecyclePolicy.Tests.ps1 b/test/module/Entra/Set-EntraGroupLifecyclePolicy.Tests.ps1 index de87873ed..cfd361dfc 100644 --- a/test/module/Entra/Set-EntraGroupLifecyclePolicy.Tests.ps1 +++ b/test/module/Entra/Set-EntraGroupLifecyclePolicy.Tests.ps1 @@ -25,7 +25,7 @@ BeforeAll { Describe "Set-EntraGroupLifecyclePolicy" { Context "Test for Set-EntraGroupLifecyclePolicy" { It "Should return updated GroupLifecyclePolicy" { - $result = Set-EntraGroupLifecyclePolicy -Id "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result = Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" $result.GroupLifetimeInDays | should -Be "100" @@ -34,32 +34,36 @@ Describe "Set-EntraGroupLifecyclePolicy" { Should -Invoke -CommandName Update-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when Id is invalid" { - { Set-EntraGroupLifecyclePolicy -Id "" -GroupLifetimeInDays a -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string.*" + It "Should execute successfully with Alias" { + $result = Set-EntraGroupLifecyclePolicy -Id "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result | Should -Not -BeNullOrEmpty } - It "Should fail when Id is empty" { - { Set-EntraGroupLifecyclePolicy -Id -GroupLifetimeInDays -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'Id'.*" + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "" -GroupLifetimeInDays a -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string.*" + } + It "Should fail when GroupLifecyclePolicyId is empty" { + { Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId -GroupLifetimeInDays -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'.*" } It "Should fail when GroupLifetimeInDays is invalid" { - { Set-EntraGroupLifecyclePolicy -Id "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays a -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Cannot process argument transformation on parameter 'GroupLifetimeInDays'.*" + { Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays a -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Cannot process argument transformation on parameter 'GroupLifetimeInDays'.*" } It "Should fail when GroupLifetimeInDays is empty" { - { Set-EntraGroupLifecyclePolicy -Id "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'GroupLifetimeInDays'.*" + { Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'GroupLifetimeInDays'.*" } It "Should fail when ManagedGroupTypes is empty" { - { Set-EntraGroupLifecyclePolicy -Id "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 99 -ManagedGroupTypes -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'ManagedGroupTypes'.*" + { Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 99 -ManagedGroupTypes -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'ManagedGroupTypes'.*" } It "Should fail when AlternateNotificationEmails is empty" { - { Set-EntraGroupLifecyclePolicy -Id "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 99 -ManagedGroupTypes "Selected" -AlternateNotificationEmails } | Should -Throw "Missing an argument for parameter 'AlternateNotificationEmails'.*" + { Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 99 -ManagedGroupTypes "Selected" -AlternateNotificationEmails } | Should -Throw "Missing an argument for parameter 'AlternateNotificationEmails'.*" } It "Result should Contain ObjectId" { - $result = Set-EntraGroupLifecyclePolicy -Id "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result = Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" $result.ObjectId | should -Be "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraGroupLifecyclePolicy" - $result = Set-EntraGroupLifecyclePolicy -Id "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result = Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraGroupLifecyclePolicy" @@ -76,7 +80,7 @@ Describe "Set-EntraGroupLifecyclePolicy" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraGroupLifecyclePolicy -Id "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" -Debug } | Should -Not -Throw + { Set-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraServicePrincipal.Tests.ps1 b/test/module/Entra/Set-EntraServicePrincipal.Tests.ps1 index 4ca5fed18..45c0b59c5 100644 --- a/test/module/Entra/Set-EntraServicePrincipal.Tests.ps1 +++ b/test/module/Entra/Set-EntraServicePrincipal.Tests.ps1 @@ -14,19 +14,25 @@ Describe "Set-EntraServicePrincipal"{ Context "Test for Set-EntraServicePrincipal" { It "Should update the parameter" { $tags = @("Environment=Production", "Department=Finance", "Project=MNO") - $result= Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AccountEnabled $false -AppId "00001111-aaaa-2222-bbbb-3333cccc4444" -AppRoleAssignmentRequired $true -DisplayName "test11" -ServicePrincipalNames "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Tags $tags + $result= Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AccountEnabled $false -AppId "00001111-aaaa-2222-bbbb-3333cccc4444" -AppRoleAssignmentRequired $true -DisplayName "test11" -ServicePrincipalNames "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Tags $tags $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } + It "Should update the parameter with Alias" { + $result= Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AccountEnabled $false -AppId "00001111-aaaa-2222-bbbb-3333cccc4444" -AppRoleAssignmentRequired $true -DisplayName "test11" -ServicePrincipalNames "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + } It "Should update the LogoutUrl and ServicePrincipalType parameter" { - $result= Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -LogoutUrl 'https://securescore.office.com/SignOut' -ServicePrincipalType "Application" + $result= Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -LogoutUrl 'https://securescore.office.com/SignOut' -ServicePrincipalType "Application" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } It "Should update the Homepage, ReplyUrls and AlternativeNames parameter" { - $result= Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Homepage 'https://HomePageurlss.com' -ReplyUrls 'https://admin.microsoft1.com' -AlternativeNames "updatetest" + $result= Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Homepage 'https://HomePageurlss.com' -ReplyUrls 'https://admin.microsoft1.com' -AlternativeNames "updatetest" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 @@ -40,24 +46,24 @@ Describe "Set-EntraServicePrincipal"{ $creds.Usage = 'Sign' $creds.Value = [System.Text.Encoding]::UTF8.GetBytes("A") $creds.EndDate = Get-Date -Year 2025 -Month 12 -Day 20 - $result= Set-EntraServicePrincipal -ObjectId 6aa187e3-bbbb-4748-a708-fc380aa9eb17 -KeyCredentials $creds + $result= Set-EntraServicePrincipal -ServicePrincipalId 6aa187e3-bbbb-4748-a708-fc380aa9eb17 -KeyCredentials $creds $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraServicePrincipal -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when ServicePrincipalId is empty" { + { Set-EntraServicePrincipal -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" } - It "Should fail when ObjectId is Invalid" { - { Set-EntraServicePrincipal -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string.*" + It "Should fail when ServicePrincipalId is Invalid" { + { Set-EntraServicePrincipal -ServicePrincipalId ""} | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } It "Should fail when non-mandatory is empty" { - { Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AppId -Tags -ReplyUrls -AccountEnabled -AlternativeNames -KeyCredentials -Homepage} | Should -Throw "Missing an argument for parameter*" + { Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AppId -Tags -ReplyUrls -AccountEnabled -AlternativeNames -KeyCredentials -Homepage} | Should -Throw "Missing an argument for parameter*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraServicePrincipal" - Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -LogoutUrl 'https://securescore.office.com/SignOut' -ServicePrincipalType "Application" + Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -LogoutUrl 'https://securescore.office.com/SignOut' -ServicePrincipalType "Application" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraServicePrincipal" @@ -73,7 +79,7 @@ Describe "Set-EntraServicePrincipal"{ $tags = @("Environment=Production", "Department=Finance", "Project=MNO") try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AccountEnabled $false -AppId "00001111-aaaa-2222-bbbb-3333cccc4444" -AppRoleAssignmentRequired $true -DisplayName "test11" -ServicePrincipalNames "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Tags $tags -Debug } | Should -Not -Throw + { Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AccountEnabled $false -AppId "00001111-aaaa-2222-bbbb-3333cccc4444" -AppRoleAssignmentRequired $true -DisplayName "test11" -ServicePrincipalNames "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Tags $tags -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraUser.Tests.ps1 b/test/module/Entra/Set-EntraUser.Tests.ps1 index ac7f7eaa5..7c694bfeb 100644 --- a/test/module/Entra/Set-EntraUser.Tests.ps1 +++ b/test/module/Entra/Set-EntraUser.Tests.ps1 @@ -14,23 +14,23 @@ BeforeAll { Describe "Set-EntraUser" { Context "Test for Set-EntraUser" { It "Should return empty object" { - $result = Set-EntraUser -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "demo002" -UserPrincipalName "demo001@M365x99297270.OnMicrosoft.com" -AccountEnabled $true -MailNickName "demo002NickName" -AgeGroup "adult" -PostalCode "10001" + $result = Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "demo002" -UserPrincipalName "demo001@M365x99297270.OnMicrosoft.com" -AccountEnabled $true -MailNickName "demo002NickName" -AgeGroup "adult" -PostalCode "10001" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraUser -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty" { + { Set-EntraUser -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is no value" { - { Set-EntraUser -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when UserId is no value" { + { Set-EntraUser -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } - It "Should contain userId in parameters when passed ObjectId to it" { + It "Should contain userId in parameters when passed UserId to it" { Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Set-EntraUser -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" + $result = Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" $params = Get-Parameters -data $result $params.userId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" $params.MobilePhone | Should -Be "1234567890" @@ -39,7 +39,7 @@ Describe "Set-EntraUser" { It "Should contain MobilePhone in parameters when passed Mobile to it" { Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Set-EntraUser -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" + $result = Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" $params = Get-Parameters -data $result $params.MobilePhone | Should -Be "1234567890" } @@ -47,7 +47,7 @@ Describe "Set-EntraUser" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUser" - Set-EntraUser -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" + Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUser" @@ -63,7 +63,7 @@ Describe "Set-EntraUser" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraUser -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" -Debug } | Should -Not -Throw + { Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference @@ -75,7 +75,7 @@ Describe "Set-EntraUser" { # format like "yyyy-MM-dd HH:mm:ss" $userStateChangedOn = [System.DateTime]::Parse("2015-12-08 15:15:19") - $result = Set-EntraUser -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" ` + $result = Set-EntraUser -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" ` -UserState "PendingAcceptance" ` -UserStateChangedOn $userStateChangedOn ` -ImmutableId "djkjsajsa-e32j2-2i32" ` diff --git a/test/module/Entra/Set-EntraUserManager.Tests.ps1 b/test/module/Entra/Set-EntraUserManager.Tests.ps1 index 302c3f418..e7a44cb6b 100644 --- a/test/module/Entra/Set-EntraUserManager.Tests.ps1 +++ b/test/module/Entra/Set-EntraUserManager.Tests.ps1 @@ -13,28 +13,35 @@ BeforeAll { Describe "Set-EntraUserManager" { Context "Test for Set-EntraUserManager" { It "Should return specific User" { + $result = Set-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific User with alias" { $result = Set-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string value" { - { Set-EntraUserManager -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string value" { + { Set-EntraUserManager -UserId ""} | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Set-EntraUserManager -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Set-EntraUserManager -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } It "Should fail when RefObjectId is invalid" { - { Set-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" RefObjectId ""} | Should -Throw "A positional parameter cannot be found that accepts argument*" + { Set-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" RefObjectId ""} | Should -Throw "A positional parameter cannot be found that accepts argument*" } - It "Should contain UserId in parameters when passed ObjectId to it" { + It "Should contain UserId in parameters when passed UserId to it" { Mock -CommandName Set-MgUserManagerByRef -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Set-EntraUserManager -ObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" + $result = Set-EntraUserManager -UserId "00001111-aaaa-2222-bbbb-3333cccc4444" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result $params.UserId | Should -Match "00001111-aaaa-2222-bbbb-3333cccc4444" } @@ -42,7 +49,7 @@ Describe "Set-EntraUserManager" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserManager" - Set-EntraUserManager -ObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" + Set-EntraUserManager -UserId "00001111-aaaa-2222-bbbb-3333cccc4444" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserManager" @@ -59,7 +66,7 @@ Describe "Set-EntraUserManager" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraUserManager -ObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw + { Set-EntraUserManager -UserId "00001111-aaaa-2222-bbbb-3333cccc4444" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/Entra/Set-EntraUserThumbnailPhoto.Tests.ps1 b/test/module/Entra/Set-EntraUserThumbnailPhoto.Tests.ps1 index 76454d2f5..dfacac310 100644 --- a/test/module/Entra/Set-EntraUserThumbnailPhoto.Tests.ps1 +++ b/test/module/Entra/Set-EntraUserThumbnailPhoto.Tests.ps1 @@ -13,28 +13,35 @@ BeforeAll { Describe "Set-EntraUserThumbnailPhoto" { Context "Test for Set-EntraUserThumbnailPhoto" { It "Should return specific User" { + $result = Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra -Times 1 + } + + It "Should return specific User with alias" { $result = Set-EntraUserThumbnailPhoto -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $result | Should -BeNullOrEmpty Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra -Times 1 } - It "Should fail when ObjectId is empty string value" { - { Set-EntraUserThumbnailPhoto -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string value" { + { Set-EntraUserThumbnailPhoto -UserId ""} | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Set-EntraUserThumbnailPhoto -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Set-EntraUserThumbnailPhoto -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } It "Should fail when RefObjectId is invalid" { - { Set-EntraUserThumbnailPhoto -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" RefObjectId ""} | Should -Throw "A positional parameter cannot be found that accepts argument*" + { Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" RefObjectId ""} | Should -Throw "A positional parameter cannot be found that accepts argument*" } It "Should contain UserId in parameters when passed ObjectId to it" { Mock -CommandName Set-MgUserPhotoContent -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Set-EntraUserThumbnailPhoto -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' + $result = Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $params = Get-Parameters -data $result $params.UserId | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -42,7 +49,7 @@ Describe "Set-EntraUserThumbnailPhoto" { It "Should contain InFile in parameters" { Mock -CommandName Set-MgUserPhotoContent -MockWith { $args } -ModuleName Microsoft.Graph.Entra - $result = Set-EntraUserThumbnailPhoto -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' + $result = Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $params = Get-Parameters -data $result $params.InFile | Should -Match "UserThumbnailPhoto.jpg" } @@ -50,7 +57,7 @@ Describe "Set-EntraUserThumbnailPhoto" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserThumbnailPhoto" - Set-EntraUserThumbnailPhoto -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' + Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserThumbnailPhoto" @@ -67,7 +74,7 @@ Describe "Set-EntraUserThumbnailPhoto" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraUserThumbnailPhoto -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg'-Debug } | Should -Not -Throw + { Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg'-Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 b/test/module/EntraBeta/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 index d199bbec1..4d760cb35 100644 --- a/test/module/EntraBeta/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/test/module/EntraBeta/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -14,33 +14,39 @@ BeforeAll { Describe "Add-EntraBetaAdministrativeUnitMember" { Context "Test for Add-EntraBetaAdministrativeUnitMember" { It "Should return empty object" { - $result = Add-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" + $result = Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgBetaAdministrativeUnitMemberByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraBetaAdministrativeUnitMember -ObjectId -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should return empty object with alias" { + $result = Add-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgBetaAdministrativeUnitMemberByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when AdministrativeUnitId is empty" { + { Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraBetaAdministrativeUnitMember -ObjectId "" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff"} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff"} | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'*" + { Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId ""} | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId ""} | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } - It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { + It "Should contain AdministrativeUnitId in parameters when passed AdministrativeUnitId to it" { Mock -CommandName New-MgBetaAdministrativeUnitMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Add-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" + $result = Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" $params = Get-Parameters -data $result $params.AdministrativeUnitId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaAdministrativeUnitMember" - Add-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" + Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaAdministrativeUnitMember" @@ -56,7 +62,7 @@ Describe "Add-EntraBetaAdministrativeUnitMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" -Debug } | Should -Not -Throw + { Add-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "eeeeeeee-4444-5555-6666-ffffffffffff" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Add-EntraBetaDeviceRegisteredOwner.Tests.ps1 b/test/module/EntraBeta/Add-EntraBetaDeviceRegisteredOwner.Tests.ps1 new file mode 100644 index 000000000..0a27c6b75 --- /dev/null +++ b/test/module/EntraBeta/Add-EntraBetaDeviceRegisteredOwner.Tests.ps1 @@ -0,0 +1,85 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + Mock -CommandName New-MgBetaDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Add-EntraBetaDeviceRegisteredOwner" { + Context "Test for Add-EntraBetaDeviceRegisteredOwner" { + It "Should return empty object" { + $result = Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgBetaDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { + $result = Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgBetaDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is empty" { + { Add-EntraBetaDeviceRegisteredOwner -DeviceId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DeviceId'.*" + } + It "Should fail when DeviceId is invalid" { + { Add-EntraBetaDeviceRegisteredOwner -DeviceId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." + } + It "Should fail when RefObjectId is empty" { + { Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + } + It "Should fail when RefObjectId is invalid" { + { Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + } + It "Should contain DeviceId in parameters when passed ObjectId to it" { + Mock -CommandName New-MgBetaDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "412be9d1-1460-4061-8eed-cca203fcb215" + $params = Get-Parameters -data $result + $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain BodyParameter in parameters when passed RefObjectId to it" { + Mock -CommandName New-MgBetaDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $value = @{ + "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} + Should -Invoke -CommandName New-MgBetaDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $BodyParameter.AdditionalProperties.'@odata.id' | Should -Be $value.'@odata.id' + Write-Host $BodyParameter.AdditionalProperties.'@odata.id' + $true + } + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaDeviceRegisteredOwner" + + Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaDeviceRegisteredOwner" + + Should -Invoke -CommandName New-MgBetaDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + {Add-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Add-EntraBetaDeviceRegisteredUser.Tests.ps1 b/test/module/EntraBeta/Add-EntraBetaDeviceRegisteredUser.Tests.ps1 new file mode 100644 index 000000000..7cb909094 --- /dev/null +++ b/test/module/EntraBeta/Add-EntraBetaDeviceRegisteredUser.Tests.ps1 @@ -0,0 +1,87 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + Mock -CommandName New-MgBetaDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Add-EntraBetaDeviceRegisteredUser" { + Context "Test for Add-EntraBetaDeviceRegisteredUser" { + It "Should return empty object" { + $result = Add-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgBetaDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is empty" { + { Add-EntraBetaDeviceRegisteredUser -DeviceId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DeviceId'.*" + } + It "Should fail when DeviceId is invalid" { + { Add-EntraBetaDeviceRegisteredUser -DeviceId "" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." + } + It "Should fail when RefObjectId is empty" { + { Add-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + } + It "Should fail when RefObjectId is invalid" { + { Add-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + } + It "Should execute successfully with Alias" { + $result = Add-EntraBetaDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName New-MgBetaDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should contain DeviceId in parameters when passed DeviceId to it" { + Mock -CommandName New-MgBetaDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Add-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $params = Get-Parameters -data $result + $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain BodyParameter in parameters when passed RefObjectId to it" { + Mock -CommandName New-MgBetaDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + Add-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $value = @{ + "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} + Should -Invoke -CommandName New-MgBetaDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $BodyParameter.AdditionalProperties.'@odata.id' | Should -Be $value.'@odata.id' + Write-Host $BodyParameter.AdditionalProperties.'@odata.id' + $true + } + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaDeviceRegisteredUser" + + Add-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaDeviceRegisteredUser" + + Should -Invoke -CommandName New-MgBetaDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Add-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + + } + +} \ No newline at end of file diff --git a/test/module/EntraBeta/Add-EntraBetaGroupMember.Tests.ps1 b/test/module/EntraBeta/Add-EntraBetaGroupMember.Tests.ps1 index d920fa782..e2dae53d5 100644 --- a/test/module/EntraBeta/Add-EntraBetaGroupMember.Tests.ps1 +++ b/test/module/EntraBeta/Add-EntraBetaGroupMember.Tests.ps1 @@ -14,32 +14,32 @@ BeforeAll { Describe "Add-EntraBetaGroupMember" { Context "Test for Add-EntraBetaGroupMember" { It "Should return empty object" { - $result = Add-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Add-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgBetaGroupMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraBetaGroupMember -ObjectId -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when GroupId is empty" { + { Add-EntraBetaGroupMember -GroupId -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'GroupId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraBetaGroupMember -ObjectId "" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Add-EntraBetaGroupMember -GroupId "" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName New-MgBetaGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Add-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Add-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } @@ -47,14 +47,14 @@ Describe "Add-EntraBetaGroupMember" { It "Should contain DirectoryObjectId in parameters when passed RefObjectId to it" { Mock -CommandName New-MgBetaGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Add-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Add-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbcccc-1111-dddd-2222-eeee3333ffff" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaGroupMember" - Add-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + Add-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaGroupMember" Should -Invoke -CommandName New-MgBetaGroupMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -70,7 +70,7 @@ Describe "Add-EntraBetaGroupMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw + { Add-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Add-EntraBetaGroupOwner.Tests.ps1 b/test/module/EntraBeta/Add-EntraBetaGroupOwner.Tests.ps1 index 8ba96dcb8..f908faff9 100644 --- a/test/module/EntraBeta/Add-EntraBetaGroupOwner.Tests.ps1 +++ b/test/module/EntraBeta/Add-EntraBetaGroupOwner.Tests.ps1 @@ -14,38 +14,38 @@ BeforeAll { Describe "Add-EntraBetaGroupOwner" { Context "Test for Add-EntraBetaGroupOwner" { It "Should return empty object" { - $result = Add-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Add-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -BeNullOrEmpty Should -Invoke -CommandName New-MgBetaGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraBetaGroupOwner -ObjectId -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'ObjectId'.*" + It "Should fail when GroupId is empty" { + { Add-EntraBetaGroupOwner -GroupId -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'GroupId'.*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraBetaGroupOwner -ObjectId "" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Add-EntraBetaGroupOwner -GroupId "" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when RefObjectId is empty" { - { Add-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" + { Add-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId } | Should -Throw "Missing an argument for parameter 'RefObjectId'.*" } It "Should fail when RefObjectId is invalid" { - { Add-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." + { Add-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName New-MgBetaGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Add-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Add-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } It "Should contain BodyParameter in parameters when passed RefObjectId to it" { Mock -CommandName New-MgBetaGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Add-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Add-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $value = @{ "@odata.id" = "https://graph.microsoft.com/beta/users/bbbbcccc-1111-dddd-2222-eeee3333ffff"} Should -Invoke -CommandName New-MgBetaGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -58,7 +58,7 @@ Describe "Add-EntraBetaGroupOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaGroupOwner" - Add-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + Add-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaGroupOwner" Should -Invoke -CommandName New-MgBetaGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -74,7 +74,7 @@ Describe "Add-EntraBetaGroupOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug} | Should -Not -Throw + { Add-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -RefObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug} | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Add-EntraBetaScopedRoleMembership.Tests.ps1 b/test/module/EntraBeta/Add-EntraBetaScopedRoleMembership.Tests.ps1 index 0e7440fe6..f02604332 100644 --- a/test/module/EntraBeta/Add-EntraBetaScopedRoleMembership.Tests.ps1 +++ b/test/module/EntraBeta/Add-EntraBetaScopedRoleMembership.Tests.ps1 @@ -31,6 +31,17 @@ BeforeAll { Describe "Add-EntraBetaScopedRoleMembership" { Context "Test for Add-EntraBetaScopedRoleMembership" { It "Should add a user to the specified role within the specified administrative unit" { + $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo + $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" + $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "zTVcE8KFQ0W4bI9tvt6kz-5AOA62QHJLgnvAbh9Z0r7uQTWi6U_yTLYoEC66749-U" + $result.RoleId | Should -Be "cccccccc-85c2-4543-b86c-cccccccccccc" + $result.AdministrativeUnitId | Should -Be "dddddddd-7902-4be2-a25b-dddddddddddd" + + Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should add a user to the specified role within the specified administrative unit with alias" { $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" $result = Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember @@ -41,41 +52,41 @@ Describe "Add-EntraBetaScopedRoleMembership" { Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Add-EntraBetaScopedRoleMembership -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Add-EntraBetaScopedRoleMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } - It "Should fail when RoleObjectId is empty" { - { Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId } | Should -Throw "Missing an argument for parameter 'RoleObjectId'*" + It "Should fail when RoleAdministrativeUnitId is empty" { + { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId } | Should -Throw "Missing an argument for parameter 'RoleObjectId'*" } It "Should fail when AdministrativeUnitObjectId is empty" { - { Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -AdministrativeUnitObjectId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitObjectId'*" + { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -AdministrativeUnitObjectId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitObjectId'*" } It "Should fail when RoleMemberInfo is empty" { - { Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleMemberInfo } | Should -Throw "Missing an argument for parameter 'RoleMemberInfo'*" + { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleMemberInfo } | Should -Throw "Missing an argument for parameter 'RoleMemberInfo'*" } It "Should fail when RoleMemberInfo is invalid" { - { Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleMemberInfo "" } | Should -Throw "Cannot process argument transformation on parameter 'RoleMemberInfo'*" + { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleMemberInfo "" } | Should -Throw "Cannot process argument transformation on parameter 'RoleMemberInfo'*" } It "Result should contain Alias properties"{ $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" - $result = Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember + $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember $result.ObjectId | should -Be "zTVcE8KFQ0W4bI9tvt6kz-5AOA62QHJLgnvAbh9Z0r7uQTWi6U_yTLYoEC66749-U" $result.RoleObjectId | should -Be "cccccccc-85c2-4543-b86c-cccccccccccc" $result.AdministrativeUnitObjectId | should -Be "dddddddd-7902-4be2-a25b-dddddddddddd" } - It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { + It "Should contain AdministrativeUnitId in parameters when passed AdministrativeUnitId to it" { - $result = Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" + $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" $params = Get-Parameters -data $result.Parameters $params.AdministrativeUnitId | Should -Be "0e3840ee-40b6-4b72-827b-c06e1f59d2be" } It "Should contain AdministrativeUnitId1 in parameters when passed AdministrativeUnitObjectId to it" { - $result = Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -AdministrativeUnitObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" + $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -AdministrativeUnitObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" $params = Get-Parameters -data $result.Parameters $params.AdministrativeUnitId1 | Should -Be "0e3840ee-40b6-4b72-827b-c06e1f59d2be" } @@ -83,7 +94,7 @@ Describe "Add-EntraBetaScopedRoleMembership" { $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" - $result = Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember + $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember $params = Get-Parameters -data $result.Parameters $params.RoleId | Should -Be "135c35cd-85c2-4543-b86c-8f6dbedea4cf" } @@ -93,7 +104,7 @@ Describe "Add-EntraBetaScopedRoleMembership" { $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" - Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember + Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaScopedRoleMembership" @@ -109,7 +120,7 @@ Describe "Add-EntraBetaScopedRoleMembership" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -Debug } | Should -Not -Throw + { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaAdministrativeUnit.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaAdministrativeUnit.Tests.ps1 index 02c033584..369473dee 100644 --- a/test/module/EntraBeta/Get-EntraBetaAdministrativeUnit.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaAdministrativeUnit.Tests.ps1 @@ -30,6 +30,15 @@ BeforeAll { Describe "Get-EntraBetaAdministrativeUnit" { Context "Test for Get-EntraBetaAdministrativeUnit" { It "Should return specific administrative unit" { + $result = Get-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result.DisplayName | Should -Be "Mock-Administrative-unit" + $result.Description | Should -Be "NewAdministrativeUnit" + + Should -Invoke -CommandName Get-MgBetaAdministrativeUnit -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific administrative unit with alias" { $result = Get-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" @@ -38,11 +47,11 @@ Describe "Get-EntraBetaAdministrativeUnit" { Should -Invoke -CommandName Get-MgBetaAdministrativeUnit -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaAdministrativeUnit -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Get-EntraBetaAdministrativeUnit -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaAdministrativeUnit -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Get-EntraBetaAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should return all administrative units" { $result = Get-EntraBetaAdministrativeUnit -All @@ -75,18 +84,18 @@ Describe "Get-EntraBetaAdministrativeUnit" { It "Should fail when filter is empty" { { Get-EntraBetaAdministrativeUnit -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" } - It "Result should contain ObjectId"{ - $result = Get-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + It "Result should contain AdministrativeUnitId"{ + $result = Get-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result.ObjectId | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" } - It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { + It "Should contain AdministrativeUnitId in parameters when passed AdministrativeUnitId to it" { - $result = Get-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result = Get-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.AdministrativeUnitId | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" } It "Property parameter should work" { - $result = Get-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-Administrative-unit' @@ -98,7 +107,7 @@ Describe "Get-EntraBetaAdministrativeUnit" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaAdministrativeUnit" - $result = Get-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result = Get-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaAdministrativeUnit" @@ -115,7 +124,7 @@ Describe "Get-EntraBetaAdministrativeUnit" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 index 83e8f56b9..da180e305 100644 --- a/test/module/EntraBeta/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -32,6 +32,15 @@ BeforeAll { Describe "Get-EntraBetaAdministrativeUnitMember" { Context "Test for Get-EntraBetaAdministrativeUnitMember" { It "Should return specific administrative unit member" { + $result = Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result.AdditionalProperties.DisplayName | Should -Be "Mock-UnitMember" + $result.AdditionalProperties."@odata.type" | Should -Be "#microsoft.graph.user" + + Should -Invoke -CommandName Get-MgBetaAdministrativeUnitMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific administrative unit member with alias" { $result = Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -40,58 +49,58 @@ Describe "Get-EntraBetaAdministrativeUnitMember" { Should -Invoke -CommandName Get-MgBetaAdministrativeUnitMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaAdministrativeUnitMember -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaAdministrativeUnitMember -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should return all administrative unit members" { - $result = Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -All + $result = Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgBetaAdministrativeUnitMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when All is invalid" { - { Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" + { Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" } It "Should return top 1 administrative unit member" { - $result = Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Top 1 + $result = Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" Should -Invoke -CommandName Get-MgBetaAdministrativeUnitMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Top is empty" { - { Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" + It "Result should Contain AdministrativeUnitId" { + $result = Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } - It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { + It "Should contain AdministrativeUnitId in parameters when passed AdministrativeUnitId to it" { - $result = Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" + $result = Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" $params = Get-Parameters -data $result.Parameters $params.AdministrativeUnitId | Should -Be "pppppppp-1111-1111-1111-aaaaaaaaaaaa" } It "Property parameter should work" { - $result = Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Property ID + $result = Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Property ID $result | Should -Not -BeNullOrEmpty $result.ID | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" Should -Invoke -CommandName Get-MgBetaAdministrativeUnitMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaAdministrativeUnitMember" - $result = Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" + $result = Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaAdministrativeUnitMember" @@ -108,7 +117,7 @@ Describe "Get-EntraBetaAdministrativeUnitMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaAdministrativeUnitMember -ObjectId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Debug } | Should -Not -Throw + { Get-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "pppppppp-1111-1111-1111-aaaaaaaaaaaa" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaApplication.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaApplication.Tests.ps1 index 3f8356ec9..47dab27af 100644 --- a/test/module/EntraBeta/Get-EntraBetaApplication.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaApplication.Tests.ps1 @@ -38,13 +38,18 @@ BeforeAll { Describe "Get-EntraBetaApplication" { Context "Test for Get-EntraBetaApplication" { It "Should return specific application" { - $result = Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + $result = Get-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('aaaaaaaa-1111-1111-1111-000000000000') Should -Invoke -CommandName Get-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaApplication -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should execute successfully with Alias" { + $result = Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + $result | Should -Not -BeNullOrEmpty + Should -Invoke -CommandName Get-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when ApplicationId is empty" { + { Get-EntraBetaApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } It "Should return all applications" { $result = Get-EntraBetaApplication -All @@ -74,12 +79,12 @@ Describe "Get-EntraBetaApplication" { $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Result should Contain ObjectId" { - $result = Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + It "Result should Contain ApplicationId" { + $result = Get-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $result.ObjectId | should -Be "aaaaaaaa-1111-1111-1111-000000000000" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { + $result = Get-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $params = Get-Parameters -data $result.Parameters $params.ApplicationId | Should -Be "aaaaaaaa-1111-1111-1111-000000000000" } @@ -90,7 +95,7 @@ Describe "Get-EntraBetaApplication" { } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaApplication" - $result = Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + $result = Get-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaApplication" Should -Invoke -CommandName Get-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -99,7 +104,7 @@ Describe "Get-EntraBetaApplication" { } } It "Property parameter should work" { - $result = Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" -Property DisplayName + $result = Get-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' @@ -107,7 +112,7 @@ Describe "Get-EntraBetaApplication" { } It "Should fail when Property is empty" { - { Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should execute successfully without throwing an error " { # Disable confirmation prompts @@ -116,7 +121,7 @@ Describe "Get-EntraBetaApplication" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" -Debug } | Should -Not -Throw + { Get-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference @@ -144,7 +149,7 @@ Describe "Get-EntraBetaApplication" { It 'Should have Get parameterSet' { $GetAzureADApplication = Get-Command Get-EntraBetaApplication $GetParameterSet = $GetAzureADApplication.ParameterSets | Where-Object Name -eq "GetById" - $GetParameterSet.Parameters.Name | Should -Contain ObjectId + $GetParameterSet.Parameters.Name | Should -Contain ApplicationId } It 'Should have GetViaIdentity parameterSet' { $GetAzureADApplication = Get-Command Get-EntraBetaApplication diff --git a/test/module/EntraBeta/Get-EntraBetaApplicationLogo.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaApplicationLogo.Tests.ps1 index 2c648a7b8..9f6e42da9 100644 --- a/test/module/EntraBeta/Get-EntraBetaApplicationLogo.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaApplicationLogo.Tests.ps1 @@ -23,19 +23,19 @@ BeforeAll { Describe "Get-EntraBetaApplicationLogo" { It "Should return empty" { - $result = Get-EntraBetaApplicationLogo -ObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FilePath "D:\image.jpg" + $result = Get-EntraBetaApplicationLogo -ApplicationId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FilePath "D:\image.jpg" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaApplicationLogo -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Get-EntraBetaApplicationLogo -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { Get-EntraBetaApplicationLogo -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { Get-EntraBetaApplicationLogo -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaApplicationLogo" - $result = Get-EntraBetaApplicationLogo -ObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FilePath "D:\image.jpg" + $result = Get-EntraBetaApplicationLogo -ApplicationId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FilePath "D:\image.jpg" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaApplicationLogo" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -50,7 +50,7 @@ Describe "Get-EntraBetaApplicationLogo" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaApplicationLogo -ObjectId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FilePath "D:\image.jpg" -Debug } | Should -Not -Throw + { Get-EntraBetaApplicationLogo -ApplicationId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FilePath "D:\image.jpg" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 index 9bdd7f3be..2dc2c4d23 100644 --- a/test/module/EntraBeta/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 @@ -27,24 +27,30 @@ BeforeAll { } Describe "Get-EntraBetaApplicationPasswordCredential" { Context "Test for Get-EntraBetaApplicationPasswordCredential" { - It "Should return specific Policy" { - $result = Get-EntraBetaApplicationPasswordCredential -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should return specific credential" { + $result = Get-EntraBetaApplicationPasswordCredential -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.keyId | Should -Be "bbbbbbbb-1111-2222-3333-rrrrrrrrrrrr" $result.DisplayName | Should -Be "test" $result.CustomKeyIdentifier.gettype().name | Should -Be 'Byte[]' Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is invalObjectId" { - { Get-EntraBetaApplicationPasswordCredential -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should return specific credential with Alias" { + $result = Get-EntraBetaApplicationPasswordCredential -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when ApplicationId is invalid" { + { Get-EntraBetaApplicationPasswordCredential -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaApplicationPasswordCredential -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Get-EntraBetaApplicationPasswordCredential -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaApplicationPasswordCredential" - $result = Get-EntraBetaApplicationPasswordCredential -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaApplicationPasswordCredential -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue diff --git a/test/module/EntraBeta/Get-EntraBetaAttributeSet.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaAttributeSet.Tests.ps1 index 449ffd30b..066681422 100644 --- a/test/module/EntraBeta/Get-EntraBetaAttributeSet.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaAttributeSet.Tests.ps1 @@ -24,7 +24,17 @@ BeforeAll { Describe "Get-EntraBetaAttributeSet" { Context "Test for Get-EntraBetaAttributeSet" { - It "Should get attribute set by Id" { + It "Should get attribute set by AttributeSetId" { + $result = Get-EntraBetaAttributeSet -AttributeSetId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be 'bbbbcccc-1111-dddd-2222-eeee3333ffff' + $result.Description | should -Be "new test" + $result.MaxAttributesPerSet | should -Be 22 + + Should -Invoke -CommandName Get-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should get attribute set using alias" { $result = Get-EntraBetaAttributeSet -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbcccc-1111-dddd-2222-eeee3333ffff' @@ -34,28 +44,28 @@ Describe "Get-EntraBetaAttributeSet" { Should -Invoke -CommandName Get-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when Id is empty" { - { Get-EntraBetaAttributeSet -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when AttributeSetId is empty" { + { Get-EntraBetaAttributeSet -AttributeSetId } | Should -Throw "Missing an argument for parameter 'AttributeSetId'*" } - It "Should fail when Id is invalid" { - { Get-EntraBetaAttributeSet -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when AttributeSetId is invalid" { + { Get-EntraBetaAttributeSet -AttributeSetId "" } | Should -Throw "Cannot bind argument to parameter 'AttributeSetId' because it is an empty string." } It "Result should Contain ObjectId" { - $result = Get-EntraBetaAttributeSet -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Get-EntraBetaAttributeSet -AttributeSetId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result.ObjectId | should -Be "bbbbcccc-1111-dddd-2222-eeee3333ffff" } It "Should contain AttributeSetId in parameters when passed Id to it" { - $result = Get-EntraBetaAttributeSet -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Get-EntraBetaAttributeSet -AttributeSetId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $params = Get-Parameters -data $result.Parameters $params.AttributeSetId | Should -Be "bbbbcccc-1111-dddd-2222-eeee3333ffff" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaAttributeSet" - $result = Get-EntraBetaAttributeSet -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Get-EntraBetaAttributeSet -AttributeSetId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaAttributeSet" Should -Invoke -CommandName Get-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -64,14 +74,14 @@ Describe "Get-EntraBetaAttributeSet" { } } It "Property parameter should work" { - $result = Get-EntraBetaAttributeSet -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Property Id + $result = Get-EntraBetaAttributeSet -AttributeSetId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'bbbbcccc-1111-dddd-2222-eeee3333ffff' Should -Invoke -CommandName Get-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaAttributeSet -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaAttributeSet -AttributeSetId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should execute successfully without throwing an error " { # Disable confirmation prompts @@ -80,7 +90,7 @@ Describe "Get-EntraBetaAttributeSet" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaAttributeSet -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw + { Get-EntraBetaAttributeSet -AttributeSetId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaDeletedGroup.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaDeletedGroup.Tests.ps1 new file mode 100644 index 000000000..db26961f4 --- /dev/null +++ b/test/module/EntraBeta/Get-EntraBetaDeletedGroup.Tests.ps1 @@ -0,0 +1,149 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @( + [PSCustomObject]@{ + "Id" = "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + "DeletedDateTime" = "10-05-2024 04:27:17" + "CreatedDateTime" = "07-07-2023 14:31:41" + "DisplayName" = "Mock-App" + "MailNickname" = "Demo-Mock-App" + "GroupTypes" = "Unified" + "SecurityEnabled" = $False + "MailEnabled" = $True + "Visibility" = "Public" + "AdditionalProperties" = @{"@odata.context" = "https://graph.microsoft.com/beta/`$metadata#groups/`$entity"} + "Parameters" = $args + } + ) + } + + Mock -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Get-EntraBetaDeletedGroup" { +Context "Test for Get-EntraBetaDeletedGroup" { + It "Should return specific Deleted Group" { + $result = Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.DisplayName | Should -Be "Mock-App" + $result.GroupTypes | Should -Be "Unified" + + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific Deleted Group with alias" { + $result = Get-EntraBetaDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.DisplayName | Should -Be "Mock-App" + $result.GroupTypes | Should -Be "Unified" + + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when GroupId is empty" { + { Get-EntraBetaDeletedGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" + } + It "Should fail when GroupId is invalid" { + { Get-EntraBetaDeletedGroup -GroupId ""} | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." + } + It "Should return All deleted groups" { + $result = Get-EntraBetaDeletedGroup -All + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when All is invalid" { + { Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + } + It "Should return top 1 deleted group" { + $result = Get-EntraBetaDeletedGroup -Top 1 + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.DisplayName | Should -Be "Mock-App" + $result.GroupTypes | Should -Be "Unified" + + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when Top is empty" { + { Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + } + It "Should fail when Top is invalid" { + { Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + } + It "Should return specific deleted group by filter" { + $result = Get-EntraBetaDeletedGroup -Filter "DisplayName eq 'Mock-App'" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.DisplayName | Should -Be "Mock-App" + $result.GroupTypes | Should -Be "Unified" + + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when filter is empty" { + { Get-EntraBetaDeletedGroup -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" + } + It "Should return specific deleted groupn by SearchString" { + $result = Get-EntraBetaDeletedGroup -SearchString "Demo-Mock-App" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.MailNickname | Should -Be "Demo-Mock-App" + $result.DisplayName | Should -Be "Mock-App" + + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when searchstring is empty" { + { Get-EntraBetaDeletedGroup -SearchString } | Should -Throw "Missing an argument for parameter 'SearchString'*" + } + It "Property parameter should work" { + $result = Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result | Should -Not -BeNullOrEmpty + $result.DisplayName | Should -Be 'Mock-App' + + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when Property is empty" { + { Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + } + It "Should contain GroupId in parameters when passed Id to it" { + $result = Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $params = Get-Parameters -data $result.Parameters + $params.DirectoryObjectId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain Filter in parameters when passed SearchString to it" { + $result = Get-EntraBetaDeletedGroup -SearchString "Demo-Mock-App" + $params = Get-Parameters -data $result.Parameters + $params.Filter | Should -Match "Mock-App" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDeletedGroup" + $result = Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDeletedGroup" + Should -Invoke -CommandName Get-MgBetaDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error " { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Get-EntraBetaDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaDevice.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaDevice.Tests.ps1 index 584200709..69409cd0c 100644 --- a/test/module/EntraBeta/Get-EntraBetaDevice.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaDevice.Tests.ps1 @@ -33,18 +33,24 @@ BeforeAll { Describe "Get-EntraBetaDevice" { Context "Test for Get-EntraBetaDevice" { It "Should return specific device" { - $result = Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaDevice -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.DisplayName | should -Be "Mock-Device" Should -Invoke -CommandName Get-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaDevice -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should return specific device with Alias" { + $result = Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is empty" { + { Get-EntraBetaDevice -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaDevice -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when DeviceId is invalid" { + { Get-EntraBetaDevice -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." } It "Should return all applications" { $result = Get-EntraBetaDevice -All @@ -93,7 +99,7 @@ Describe "Get-EntraBetaDevice" { { Get-EntraBetaDevice -Top xy } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should Contain Alias properties" { - $result = Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaDevice -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.DevicePhysicalIds | should -Be "[HWID]:h:6825786449406074" $result.DeviceObjectVersion | should -Be "2" @@ -104,7 +110,7 @@ Describe "Get-EntraBetaDevice" { } It "Should contain DeviceId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaDevice -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -114,19 +120,19 @@ Describe "Get-EntraBetaDevice" { $params.Filter | Should -Match 'Mock-Device' } It "Property parameter should work" { - $result = Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result = Get-EntraBetaDevice -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-Device' Should -Invoke -CommandName Get-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaDevice -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDevice" - $result = Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaDevice -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDevice" @@ -143,7 +149,7 @@ Describe "Get-EntraBetaDevice" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraBetaDevice -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaDeviceRegisteredOwner.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaDeviceRegisteredOwner.Tests.ps1 new file mode 100644 index 000000000..3797194d1 --- /dev/null +++ b/test/module/EntraBeta/Get-EntraBetaDeviceRegisteredOwner.Tests.ps1 @@ -0,0 +1,124 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if ((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null) { + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $PSScriptRoot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @{ + "Id" = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + "BusinessPhones" = @("425-555-0100") + "onPremisesImmutableId" = $null + "deletedDateTime" = $null + "onPremisesSyncEnabled" = $null + "OnPremisesLastSyncDateTime" = $null + "onPremisesProvisioningErrors" = @{} + "mobilePhone" = "425-555-0100" + "ExternalUserState" = $null + "ExternalUserStateChangeDateTime" = $null + "Parameters" = $args + "AdditionalProperties" = @{ + "DisplayName" = "demo" + } + } + } + + + Mock -CommandName Get-MgBetaDeviceRegisteredOwner -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Get-EntraBetaDeviceRegisteredOwner" { + Context "Test for Get-EntraBetaDeviceRegisteredOwner" { + It "Should return specific device registered owner" { + $result = Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredOwner -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific device registered owner with alias" { + $result = Get-EntraBetaDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredOwner -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is empty" { + { Get-EntraBetaDeviceRegisteredOwner -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" + } + It "Should fail when DeviceId is invalid" { + { Get-EntraBetaDeviceRegisteredOwner -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" + } + It "Should return all device registered owner" { + $result = Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredOwner -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should fail when All is invalid" { + { Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" + } + It "Should return top device registered owner" { + $result = Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredOwner -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when top is empty" { + { Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + } + It "Should fail when top is invalid" { + { Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + } + It "Should contain DeviceId in parameters when passed Name to it" { + + $result = Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $params = Get-Parameters -data $result.Parameters + $para= $params | ConvertTo-json | ConvertFrom-Json + $para.DeviceId | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDeviceRegisteredOwner" + $result = Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredOwner -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Property parameter should work" { + $result = Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property mobilePhone + $result | Should -Not -BeNullOrEmpty + $result.mobilePhone | Should -Be '425-555-0100' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredOwner -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should fail when Property is empty" { + { Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + } + + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Get-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } + +} \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaDeviceRegisteredUser.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaDeviceRegisteredUser.Tests.ps1 new file mode 100644 index 000000000..75162ee24 --- /dev/null +++ b/test/module/EntraBeta/Get-EntraBetaDeviceRegisteredUser.Tests.ps1 @@ -0,0 +1,129 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if ((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null) { + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $PSScriptRoot "..\Common-Functions.ps1") -Force + + + $scriptblock = { + @{ + "Id" = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + "onPremisesImmutableId" = $null + "deletedDateTime" = $null + "onPremisesSyncEnabled" = $null + "OnPremisesLastSyncDateTime" = $null + "onPremisesProvisioningErrors" = @{} + "mobilePhone" = "425-555-0100" + "BusinessPhones" = @("425-555-0100") + "ExternalUserState" = $null + "ExternalUserStateChangeDateTime" = $null + "Parameters" = $args + "AdditionalProperties" = @{ + "DisplayName" = "Demo" + } + } + } + + Mock -CommandName Get-MgBetaDeviceRegisteredUser -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + + + +Describe "Get-EntraBetaDeviceRegisteredUser" { + Context "Test for Get-EntraBetaDeviceRegisteredUser" { + It "Should return specific device registered User" { + $result = Get-EntraBetaDeviceRegisteredUser -DeviceId "8542ebd1-3d49-4073-9dce-30f197c67755" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific device registered User with alias" { + $result = Get-EntraBetaDeviceRegisteredUser -ObjectId "8542ebd1-3d49-4073-9dce-30f197c67755" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is empty" { + { Get-EntraBetaDeviceRegisteredUser -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" + } + It "Should fail when DeviceId is invalid" { + { Get-EntraBetaDeviceRegisteredUser -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" + } + It "Should return all device registered owner" { + $result = Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should return top device registered owner" { + $result = Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when top is empty" { + { Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + } + It "Should fail when top is invalid" { + { Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + } + It "Should contain DeviceId in parameters when passed Name to it" { + + $result = Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $params = Get-Parameters -data $result.Parameters + $Para= $params | ConvertTo-json | ConvertFrom-Json + $para.DeviceId | Should -Match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDeviceRegisteredUser" + + $result = Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $params = Get-Parameters -data $result.Parameters + $a= $params | ConvertTo-json | ConvertFrom-Json + $a.headers.'User-Agent' | Should -Be $userAgentHeaderValue + } + + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDeviceRegisteredUser" + + $result = Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaDeviceRegisteredUser" + + Should -Invoke -CommandName Get-MgBetaDeviceRegisteredUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should fail when Property is empty" { + { Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + } + + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Get-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + + + } + +} \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaGroup.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaGroup.Tests.ps1 index 567d1de85..d247540be 100644 --- a/test/module/EntraBeta/Get-EntraBetaGroup.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaGroup.Tests.ps1 @@ -27,19 +27,19 @@ BeforeAll { Describe "Get-EntraBetaGroup" { Context "Test for Get-EntraBetaGroup" { It "Should return specific group" { - $result = Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" + $result = Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccc55' Should -Invoke -CommandName Get-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaGroup -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Get-EntraBetaGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaGroup -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Get-EntraBetaGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should return all group" { @@ -91,13 +91,13 @@ Describe "Get-EntraBetaGroup" { { Get-EntraBetaGroup -Top y } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Result should Contain ObjectId" { - $result = Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" + It "Result should Contain GroupId" { + $result = Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccc55" } - It "Should contain GroupId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" + It "Should contain GroupId in parameters when passed GroupId to it" { + $result = Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" $params = Get-Parameters -data $result.Parameters $params.GroupId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc55" } @@ -108,29 +108,29 @@ Describe "Get-EntraBetaGroup" { $params.Filter | Should -Match "demo" } It "Property parameter should work" { - $result = Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property DisplayName + $result = Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'demo' Should -Invoke -CommandName Get-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Property parameter should work" { - $result = Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property DisplayName + $result = Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'demo' Should -Invoke -CommandName Get-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaGroup" - $result= Get-EntraBetaGroup -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc55" + $result= Get-EntraBetaGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccc55" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaGroup" Should -Invoke -CommandName Get-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { diff --git a/test/module/EntraBeta/Get-EntraBetaGroupAppRoleAssignment.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaGroupAppRoleAssignment.Tests.ps1 new file mode 100644 index 000000000..62bc494fe --- /dev/null +++ b/test/module/EntraBeta/Get-EntraBetaGroupAppRoleAssignment.Tests.ps1 @@ -0,0 +1,133 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @( + [PSCustomObject]@{ + "Id" = "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" + "AppRoleId" = "00001111-aaaa-2222-bbbb-3333cccc4444" + "CreatedDateTime" = "06-05-2024 05:42:01" + "DeletedDateTime" = $null + "PrincipalDisplayName" = "Mock-Group" + "PrincipalId" = "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + "ResourceId" = "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + "ResourceDisplayName" = "Mock-Group" + "PrincipalType" = "PrincipalType" + "AdditionalProperties" = @{} + "Parameters" = $args + } + ) + } + + Mock -CommandName Get-MgBetaGroupAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Get-EntraBetaGroupAppRoleAssignment" { +Context "Test for Get-EntraBetaGroupAppRoleAssignment" { + It "Should return specific Group AppRole Assignment" { + $result = Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" + $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + + Should -Invoke -CommandName Get-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific Group AppRole Assignment with alias" { + $result = Get-EntraBetaGroupAppRoleAssignment -objectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" + $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + + Should -Invoke -CommandName Get-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when ObjectlId is empty" { + { Get-EntraBetaGroupAppRoleAssignment -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" + } + It "Should fail when ObjectlId is invalid" { + { Get-EntraBetaGroupAppRoleAssignment -GroupId ""} | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." + } + It "Should return All Group AppRole Assignment" { + $result = Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" + $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + + Should -Invoke -CommandName Get-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when All is invalid" { + { Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + } + It "Should return top 1 Group AppRole Assignment" { + $result = Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" + $result.ResourceId | Should -Be "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + + Should -Invoke -CommandName Get-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when Top is empty" { + { Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + } + It "Should fail when Top is invalid" { + { Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + } + It "Property parameter should work" { + $result = Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property DisplayName + $result | Should -Not -BeNullOrEmpty + $result.PrincipalDisplayName | Should -Be 'Mock-Group' + + Should -Invoke -CommandName Get-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when Property is empty" { + { Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + } + It "Result should Contain GroupId" { + $result = Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.ObjectId | should -Be "c1NLUiFxZk6cP6Nj0RoIyGV2homdrcZNnMeMGgMswmU" + } + It "Should contain GroupId in parameters when passed Id to it" { + $result = Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $params = Get-Parameters -data $result.Parameters + $params.GroupId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaGroupAppRoleAssignment" + $result = Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error " { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Get-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + + } +} + \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaGroupLifecyclePolicy.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaGroupLifecyclePolicy.Tests.ps1 new file mode 100644 index 000000000..117669427 --- /dev/null +++ b/test/module/EntraBeta/Get-EntraBetaGroupLifecyclePolicy.Tests.ps1 @@ -0,0 +1,106 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @( + [PSCustomObject]@{ + "AlternateNotificationEmails" = "admingroup@contoso.com" + "GroupLifetimeInDays" = 200 + "Id" = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + "ManagedGroupTypes" = "All" + "AdditionalProperties" = @{} + "Parameters" = $args + } + ) + } + Mock -CommandName Get-MgBetaGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Get-EntraBetaGroupLifecyclePolicy" { + Context "Test for Get-EntraBetaGroupLifecyclePolicy" { + It "Retrieve all groupLifecyclePolicies" { + $result = Get-EntraBetaGroupLifecyclePolicy + $result | Should -Not -BeNullOrEmpty + $result.GroupLifetimeInDays | Should -Be 200 + $result.AlternateNotificationEmails | Should -Be "admingroup@contoso.com" + $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result.ManagedGroupTypes | Should -Be "All" + + Should -Invoke -CommandName Get-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { + $result = Get-EntraBetaGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + $result.GroupLifetimeInDays | Should -Be 200 + } + + It "Retrieve properties of an groupLifecyclePolicy" { + $result = Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + $result.ObjectId | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' + $result.GroupLifetimeInDays | Should -Be 200 + $result.AlternateNotificationEmails | Should -Be "admingroup@contoso.com" + $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result.ManagedGroupTypes | Should -Be "All" + + Should -Invoke -CommandName Get-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should fail when GroupLifecyclePolicyId is empty" { + { Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'*" + } + + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string." + } + + It "Should contain GroupLifecyclePolicyId in parameters when passed GroupLifecyclePolicyId to it" { + $result = Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $params = Get-Parameters -data $result.Parameters + $params.GroupLifecyclePolicyId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + } + + It "Property parameter should work" { + $result = Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property Id + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + + Should -Invoke -CommandName Get-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should fail when Property is empty" { + { Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + } + + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaGroupLifecyclePolicy" + $result = Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Get-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaGroupMember.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaGroupMember.Tests.ps1 new file mode 100644 index 000000000..d9ec4c7c1 --- /dev/null +++ b/test/module/EntraBeta/Get-EntraBetaGroupMember.Tests.ps1 @@ -0,0 +1,105 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +BeforeAll { + if ((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null) { + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @( + [PSCustomObject]@{ + "Id" = "bbbbbbbb-1111-2222-3333-cccccccccccc" + "@odata.type" = "#microsoft.graph.user" + "Description" = "test" + "AdditionalProperties" = @{ + "DisplayName" = "demo" + } + } + ) + } + + Mock -CommandName Get-MgBetaGroupMember -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Get-EntraBetaGroupMember" { + Context "Test for Get-EntraBetaGroupMember" { + It "Should return specific group" { + $result = Get-EntraBetaGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Contain 'bbbbbbbb-1111-2222-3333-cccccccccccc' + + Should -Invoke -CommandName Get-MgBetaGroupMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when GroupId is invalid" { + { Get-EntraBetaGroupMember -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." + } + It "Should fail when GroupId is empty" { + { Get-EntraBetaGroupMember -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" + } + + It "Should fail when Top is empty" { + { Get-EntraBetaGroupMember -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + } + + It "Should fail when Top is invalid" { + { Get-EntraBetaGroupMember -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + } + + It "Should return all group" { + $result = Get-EntraBetaGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgBetaGroupMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should fail when All has an argument" { + { Get-EntraBetaGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" + } + It "Should return top group" { + $result = @(Get-EntraBetaGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1) + $result | Should -Not -BeNullOrEmpty + $result | Should -HaveCount 1 + + Should -Invoke -CommandName Get-MgBetaGroupMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Property parameter should work" { + $result = Get-EntraBetaGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -top 1 -Property Id + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + + Should -Invoke -CommandName Get-MgBetaGroupMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should fail when Property is empty" { + { Get-EntraBetaGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + } + + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaGroupMember" + $result = Get-EntraBetaGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Get-MgBetaGroupMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Get-EntraBetaGroupMember -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaGroupOwner.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaGroupOwner.Tests.ps1 index 7527319c6..d73471c9e 100644 --- a/test/module/EntraBeta/Get-EntraBetaGroupOwner.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaGroupOwner.Tests.ps1 @@ -35,6 +35,15 @@ BeforeAll { Describe "Get-EntraBetaGroupOwner" { Context "Test for Get-EntraBetaGroupOwner" { It "Get a group owner by Id" { + $result = Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + $result.DeletedDateTime | should -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Get a group owner by alias" { $result = Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' @@ -43,16 +52,16 @@ Describe "Get-EntraBetaGroupOwner" { Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaGroupOwner -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Get-EntraBetaGroupOwner -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaGroupOwner -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Get-EntraBetaGroupOwner -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Gets all group owners" { - $result = Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All + $result = Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 @@ -63,27 +72,27 @@ Describe "Get-EntraBetaGroupOwner" { } It "Gets two group owners" { - $result = Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 2 + $result = Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 2 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when top is empty" { - { Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when top is invalid" { - { Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top XY} | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top XY} | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should Contain ObjectId" { - $result = Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.ObjectId | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } - It "Should contain GroupId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain GroupId in parameters when passed GroupId to it" { + $result = Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $groupId= $params | ConvertTo-json | ConvertFrom-Json $groupId.Uri -match "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" | Should -BeTrue @@ -92,7 +101,8 @@ Describe "Get-EntraBetaGroupOwner" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaGroupOwner" - $result = Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + + $result = Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaGroupOwner" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -101,7 +111,7 @@ Describe "Get-EntraBetaGroupOwner" { } } It "Property parameter should work" { - $result = Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id + $result = Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' @@ -109,7 +119,7 @@ Describe "Get-EntraBetaGroupOwner" { } It "Should fail when Property is empty" { - { Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" + { Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" } It "Should execute successfully without throwing an error " { @@ -119,7 +129,7 @@ Describe "Get-EntraBetaGroupOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaGroupOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraBetaGroupOwner -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaScopedRoleMembership.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaScopedRoleMembership.Tests.ps1 index 0b96535cf..057d9df07 100644 --- a/test/module/EntraBeta/Get-EntraBetaScopedRoleMembership.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaScopedRoleMembership.Tests.ps1 @@ -31,6 +31,15 @@ BeforeAll { Describe "Get-EntraBetaScopedRoleMembership" { Context "Test for Get-EntraBetaScopedRoleMembership" { It "Should return specific scoped role membership" { + $result = Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" + $result.RoleId | Should -Be "cccccccc-85c2-4543-b86c-cccccccccccc" + $result.AdministrativeUnitId | Should -Be "dddddddd-7902-4be2-a25b-dddddddddddd" + + Should -Invoke -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific scoped role membership with alias" { $result = Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" @@ -39,38 +48,38 @@ Describe "Get-EntraBetaScopedRoleMembership" { Should -Invoke -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaScopedRoleMembership -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Get-EntraBetaScopedRoleMembership -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaScopedRoleMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should fail when ScopedRoleMembershipId is empty" { - { Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId } | Should -Throw "Missing an argument for parameter 'ScopedRoleMembershipId'*" + { Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId } | Should -Throw "Missing an argument for parameter 'ScopedRoleMembershipId'*" } It "Should fail when ScopedRoleMembershipId is invalid" { - { Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "" } | Should -Throw "Cannot bind argument to parameter 'ScopedRoleMembershipId' because it is an empty string." + { Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "" } | Should -Throw "Cannot bind argument to parameter 'ScopedRoleMembershipId' because it is an empty string." } - It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { + It "Should contain AdministrativeUnitId in parameters when passed AdministrativeUnitId to it" { - $result = Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" + $result = Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" $params = Get-Parameters -data $result.Parameters $params.AdministrativeUnitId | Should -Be "dddddddd-1111-2222-3333-eeeeeeeeeeee" } It "Property parameter should work" { - $result = Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Property RoleId + $result = Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Property RoleId $result | Should -Not -BeNullOrEmpty $result.RoleId | Should -Be 'cccccccc-85c2-4543-b86c-cccccccccccc' Should -Invoke -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaScopedRoleMembership" - $result = Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" + $result = Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaScopedRoleMembership" @@ -87,7 +96,7 @@ Describe "Get-EntraBetaScopedRoleMembership" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Debug } | Should -Not -Throw + { Get-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaServicePrincipal.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaServicePrincipal.Tests.ps1 index 676adf0c1..6086ece11 100644 --- a/test/module/EntraBeta/Get-EntraBetaServicePrincipal.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaServicePrincipal.Tests.ps1 @@ -88,6 +88,19 @@ Describe "Get-EntraBetaServicePrincipal" { Should -Invoke -CommandName Get-MgBetaServicePrincipal -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } + It "Should execute successfully with Alias" { + $result = Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc59" + $result.ServicePrincipalNames | Should -Be @('bbbbbbbb-1111-2222-3333-cccccccccc55') + $result.DisplayName | Should -Be "demo1" + $result.AppId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc55" + $result.AppOwnerOrganizationId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc56" + $result.SignInAudience | Should -Be "AzureADMyOrg" + $result.ServicePrincipalType | Should -Be "Application" + + Should -Invoke -CommandName Get-MgBetaServicePrincipal -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } It "Should get all service principal" { $result = Get-EntraBetaServicePrincipal -All @@ -101,7 +114,7 @@ Describe "Get-EntraBetaServicePrincipal" { } It "Should get service principal by ObjectId" { - $result = Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" + $result = Get-EntraBetaServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc59" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc59" $result.ServicePrincipalNames | Should -Be @('bbbbbbbb-1111-2222-3333-cccccccccc55') @@ -114,12 +127,12 @@ Describe "Get-EntraBetaServicePrincipal" { Should -Invoke -CommandName Get-MgBetaServicePrincipal -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaServicePrincipal -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ServicePrincipalId is empty" { + { Get-EntraBetaServicePrincipal -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'*" } - It "Should fail when ObjectId is Invalid" { - { Get-EntraBetaServicePrincipal -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ServicePrincipalId is Invalid" { + { Get-EntraBetaServicePrincipal -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } It "Should get top service principal" { @@ -185,12 +198,12 @@ Describe "Get-EntraBetaServicePrincipal" { } It "Should contain ObjectId in result" { - $result = Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" + $result = Get-EntraBetaServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc59" $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccc59" } It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" + $result = Get-EntraBetaServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc59" $params = Get-Parameters -data $result.Parameters $params.ServicePrincipalId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc59" @@ -198,7 +211,7 @@ Describe "Get-EntraBetaServicePrincipal" { } It "Should contain filter in parameters when passed SearchString to it" { - $result = Get-EntraBetaServicePrincipal -SearchString "demo1" + $result = Get-EntraBetaServicePrincipal -SearchString "demo1" $params = Get-Parameters -data $result.Parameters $params.Filter | Should -Be "publisherName eq 'demo1' or (displayName eq 'demo1' or startswith(displayName,'demo1'))" @@ -207,7 +220,7 @@ Describe "Get-EntraBetaServicePrincipal" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaServicePrincipal" - $result= Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" + $result= Get-EntraBetaServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc59" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaServicePrincipal" Should -Invoke -CommandName Get-MgBetaServicePrincipal -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -217,10 +230,10 @@ Describe "Get-EntraBetaServicePrincipal" { } It "Should fail when Property is empty" { - { Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc59" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Property parameter should work" { - $result = Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" -Property AppDisplayName + $result = Get-EntraBetaServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc59" -Property AppDisplayName $result | Should -Not -BeNullOrEmpty $result.AppDisplayName | Should -Be 'demo1' @@ -234,7 +247,7 @@ Describe "Get-EntraBetaServicePrincipal" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc59" -Debug } | Should -Not -Throw + { Get-EntraBetaServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc59" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 index 38e2390d8..95c6df290 100644 --- a/test/module/EntraBeta/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 @@ -93,7 +93,7 @@ BeforeAll { Describe "Get-EntraBetaServicePrincipalOwnedObject" { Context "Test for Get-EntraBetaServicePrincipalOwnedObject" { It "Should retrieve the owned objects of a service principal" { - $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" + $result = Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" $result | Should -Not -BeNullOrEmpty $result.AdditionalProperties | Should -Not -BeNullOrEmpty $result.displayName | Should -Be "ToGraph_443democc3c" @@ -105,50 +105,62 @@ Describe "Get-EntraBetaServicePrincipalOwnedObject" { Should -Invoke -CommandName Get-MgBetaServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } + It "Should return specific device with Alias" { + $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" + $result | Should -Not -BeNullOrEmpty + $result.AdditionalProperties | Should -Not -BeNullOrEmpty + $result.displayName | Should -Be "ToGraph_443democc3c" + $result.appDisplayName | Should -Be "ToGraph_443democc3c" + $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc58" + $result.appId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc55" + $result.AdditionalProperties.appDisplayName | Should -Be "ToGraph_443democc3c" + $result.AdditionalProperties.tags | Should -Be @('WindowsAzureActiveDirectoryIntegratedApp') - It "Should fail when ObjectId are empty" { - { Get-EntraBetaServicePrincipalOwnedObject -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + Should -Invoke -CommandName Get-MgBetaServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when ServicePrincipalId are empty" { + { Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'*" } - It "Should fail when ObjectId is Invalid" { - { Get-EntraBetaServicePrincipalOwnedObject -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ServicePrincipalId is Invalid" { + { Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." } It "Should return top service principal" { - $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Top 1 + $result = Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Top 1 $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgBetaServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Top are empty" { - { Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is Invalid" { - { Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Top XYZ } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Top XYZ } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Should return all service principal" { - $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -All + $result = Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgBetaServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when All has an argument" { - { Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." + { Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." } It "Should contain Id in result" { - $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" + $result = Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" $result.Id | should -Be "bbbbbbbb-1111-2222-3333-cccccccccc58" Should -Invoke -CommandName Get-MgBetaServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should contain ServicePrincipalId in parameters when passed Id to it" { - $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" + $result = Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" $params = Get-Parameters -data $result.Parameters $params.ServicePrincipalId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccc40" } @@ -156,7 +168,7 @@ Describe "Get-EntraBetaServicePrincipalOwnedObject" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaServicePrincipalOwnedObject" - $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" + $result = Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaServicePrincipalOwnedObject" @@ -167,7 +179,7 @@ Describe "Get-EntraBetaServicePrincipalOwnedObject" { } } It "Property parameter should work" { - $result = Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Property appDisplayName + $result = Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Property appDisplayName $result | Should -Not -BeNullOrEmpty $result.appDisplayName | Should -Be 'ToGraph_443democc3c' @@ -175,7 +187,7 @@ Describe "Get-EntraBetaServicePrincipalOwnedObject" { } It "Should fail when Property is empty" { - { Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" + { Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" } It "Should execute successfully without throwing an error " { # Disable confirmation prompts @@ -184,7 +196,7 @@ Describe "Get-EntraBetaServicePrincipalOwnedObject" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaServicePrincipalOwnedObject -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Debug } | Should -Not -Throw + { Get-EntraBetaServicePrincipalOwnedObject -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccc40" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaUser.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaUser.Tests.ps1 index c65f589b4..07f2beff0 100644 --- a/test/module/EntraBeta/Get-EntraBetaUser.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaUser.Tests.ps1 @@ -55,7 +55,7 @@ BeforeAll { Describe "Get-EntraBetaUser" { Context "Test for Get-EntraBetaUser" { It "Should return specific user" { - $result = Get-EntraBetaUser -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUser -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" Write-Verbose "Result : {$result}" -Verbose $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') @@ -74,12 +74,12 @@ Describe "Get-EntraBetaUser" { } } - It "Should fail when ObjectId is empty string value" { - { Get-EntraBetaUser -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string value" { + { Get-EntraBetaUser -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaUser -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Get-EntraBetaUser -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } It "Should return all contact" { @@ -144,8 +144,8 @@ Describe "Get-EntraBetaUser" { { Get-EntraBetaUser -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaUser -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraBetaUser -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -160,11 +160,19 @@ Describe "Get-EntraBetaUser" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaUser -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Get-EntraBetaUser -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference } } + It "Should execute successfully with Alias" { + $result = Get-EntraBetaUser -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + Write-Verbose "Result : {$result}" -Verbose + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } } } \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaUserExtension.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaUserExtension.Tests.ps1 new file mode 100644 index 000000000..43263c7a2 --- /dev/null +++ b/test/module/EntraBeta/Get-EntraBetaUserExtension.Tests.ps1 @@ -0,0 +1,81 @@ +BeforeAll { + if ((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null) { + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $PSScriptRoot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @{ + "employeeId" = $null + "createdDateTime" = $null + "onPremisesDistinguishedName" = $null + "identities" = @("testuser@contoso.com") + "Parameters" = $args + } + } + + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} +Describe "Get-EntraBetaUserExtension" { + Context "Test for Get-EntraBetaUserExtension" { + It "Should return user extensions" { + $result = Get-EntraBetaUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should execute successfully with Alias" { + $result = Get-EntraBetaUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserExtension" + $result = Get-EntraBetaUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should fail when UserId is empty string value" { + { Get-EntraBetaUserExtension -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." + } + + It "Should fail when UserId is empty" { + { Get-EntraBetaUserExtension -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." + } + + It "Property parameter should work" { + $result = Get-EntraBetaUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property DisplayName + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should fail when Property is empty" { + { Get-EntraBetaUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'.*" + } + + It "Should execute successfully without throwing an error " { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { + Get-EntraBetaUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug + } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Get-EntraBetaUserLicenseDetail.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaUserLicenseDetail.Tests.ps1 index e210d8663..0374aca90 100644 --- a/test/module/EntraBeta/Get-EntraBetaUserLicenseDetail.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaUserLicenseDetail.Tests.ps1 @@ -26,6 +26,18 @@ BeforeAll { Describe "Get-EntraBetaUserLicenseDetail" { Context "Test for Get-EntraBetaUserLicenseDetail" { It "Should return specific User License Detail" { + $result = Get-EntraBetaUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u" + $result.ServicePlans | Should -Be @("COMMON_DEFENDER_PLATFORM_FOR_OFFICE", "Bing_Chat_Enterprise", "MESH_IMMERSIVE_FOR_TEAMS", "PURVIEW_DISCOVERY") + $result.SkuId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" + $result.SkuPartNumber | Should -Be "ENTERPRISEPREMIUM" + $result.AdditionalProperties | Should -BeOfType [System.Collections.Hashtable] + + Should -Invoke -CommandName Get-MgBetaUserLicenseDetail -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific User License Detail alias" { $result = Get-EntraBetaUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty @@ -38,26 +50,26 @@ Describe "Get-EntraBetaUserLicenseDetail" { Should -Invoke -CommandName Get-MgBetaUserLicenseDetail -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty string" { - { Get-EntraBetaUserLicenseDetail -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty string" { + { Get-EntraBetaUserLicenseDetail -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaUserLicenseDetail -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'. Specify a parameter of type 'System.String' and try again." + It "Should fail when UserId is empty" { + { Get-EntraBetaUserLicenseDetail -UserId } | Should -Throw "Missing an argument for parameter 'UserId'. Specify a parameter of type 'System.String' and try again." } It "Should fail when invalid parameter is passed" { { Get-EntraBetaUserLicenseDetail -Power "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'Power'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraBetaUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserLicenseDetail" - $result = Get-EntraBetaUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserLicenseDetail" Should -Invoke -CommandName Get-MgBetaUserLicenseDetail -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -72,7 +84,7 @@ Describe "Get-EntraBetaUserLicenseDetail" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraBetaUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaUserManager.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaUserManager.Tests.ps1 index 1decca415..d54335ca8 100644 --- a/test/module/EntraBeta/Get-EntraBetaUserManager.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaUserManager.Tests.ps1 @@ -88,8 +88,14 @@ BeforeAll { Describe "Get-EntraBetaUserManager" { Context "Test for Get-EntraBetaUserManager" { It "Should return specific user manager" { - $result = Get-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - $result | Should -Not -BeNullOrEmpty + $result = Get-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + + $result | Should -Not -BeNullOrEmpty + $result.ageGroup | Should -BeNullOrEmpty + $result.onPremisesLastSyncDateTime | Should -BeNullOrEmpty + $result.creationType | Should -BeNullOrEmpty + $result.imAddresses | Should -Be @("miriamg@contoso.com") + $result.preferredLanguage | Should -BeNullOrEmpty $result.mail | Should -Be "MiriamG@contoso.com" $result.securityIdentifier | Should -Be "S-1-12-1-649798363-1255893902-1277583799-1163042182" $result.identities | Should -HaveCount 1 @@ -101,7 +107,7 @@ Describe "Get-EntraBetaUserManager" { } It "Should fail when ObjectId is empty" { - { Get-EntraBetaUserManager -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Get-EntraBetaUserManager -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should fail when invalid parameter is passed" { @@ -109,12 +115,12 @@ Describe "Get-EntraBetaUserManager" { } It "Result should Contain ObjectId" { - $result = Get-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result.Id | should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } @@ -122,14 +128,14 @@ Describe "Get-EntraBetaUserManager" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserManager" - $result = Get-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result.Parameters $params.Headers."User-Agent" | Should -Be $userAgentHeaderValue } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserManager" - $result = Get-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Get-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserManager" Should -Invoke -CommandName Get-MgBetaUserManager -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -144,7 +150,7 @@ Describe "Get-EntraBetaUserManager" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Get-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaUserMembership.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaUserMembership.Tests.ps1 index 66da2ee0d..0d3344256 100644 --- a/test/module/EntraBeta/Get-EntraBetaUserMembership.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaUserMembership.Tests.ps1 @@ -33,6 +33,15 @@ BeforeAll { Describe "Get-EntraBetaUserMembership" { Context "Test for Get-EntraBetaUserMembership" { It "Should return specific user membership" { + $result = Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result.AdditionalProperties.DisplayName | Should -Be "Mock-Membership" + $result.AdditionalProperties."@odata.type" | Should -Be "#microsoft.graph.group" + + Should -Invoke -CommandName Get-MgBetaUserMemberOf -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return specific user membership with alias" { $result = Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" @@ -41,58 +50,58 @@ Describe "Get-EntraBetaUserMembership" { Should -Invoke -CommandName Get-MgBetaUserMemberOf -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaUserMembership -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when UserId is empty" { + { Get-EntraBetaUserMembership -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaUserMembership -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is invalid" { + { Get-EntraBetaUserMembership -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should return all user memberships" { - $result = Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All + $result = Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgBetaUserMemberOf -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when All is invalid" { - { Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + { Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" } It "Should return top 1 user memberships" { - $result = Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1 + $result = Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" Should -Invoke -CommandName Get-MgBetaUserMemberOf -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Top is empty" { - { Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } It "Result should Contain ObjectId" { - $result = Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.ObjectId | should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" } - It "Should contain UserId in parameters when passed ObjectId to it" { + It "Should contain UserId in parameters when passed UserId to it" { - $result = Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Property parameter should work" { - $result = Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id + $result = Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb' Should -Invoke -CommandName Get-MgBetaUserMemberOf -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserMembership" - $result = Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserMembership" @@ -108,7 +117,7 @@ Describe "Get-EntraBetaUserMembership" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaUserMembership -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Get-EntraBetaUserMembership -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaUserOwnedDevice.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaUserOwnedDevice.Tests.ps1 index 388aeb1d7..db52434cb 100644 --- a/test/module/EntraBeta/Get-EntraBetaUserOwnedDevice.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaUserOwnedDevice.Tests.ps1 @@ -38,7 +38,7 @@ BeforeAll { Describe "Get-EntraBetaUserOwnedDevice" { Context "Test for Get-EntraBetaUserOwnedDevice" { It "Should return specific user registered device" { - $result = Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" @@ -46,23 +46,23 @@ Describe "Get-EntraBetaUserOwnedDevice" { Should -Invoke -CommandName Get-MgBetaUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Get-EntraBetaUserOwnedDevice -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when UserId is empty" { + { Get-EntraBetaUserOwnedDevice -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } - It "Should fail when ObjectId is invalid" { - { Get-EntraBetaUserOwnedDevice -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is invalid" { + { Get-EntraBetaUserOwnedDevice -UserId ""} | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should return All user registered devices" { - $result = Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All + $result = Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgBetaUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when All is invalid" { - { Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + { Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" } It "Should return top 1 user registered device" { - $result = Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1 + $result = Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" @@ -71,30 +71,30 @@ Describe "Get-EntraBetaUserOwnedDevice" { Should -Invoke -CommandName Get-MgBetaUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Top is empty" { - { Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Property parameter should work" { - $result = Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id + $result = Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb' Should -Invoke -CommandName Get-MgBetaUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserOwnedDevice" - $result = Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserOwnedDevice" @@ -110,7 +110,7 @@ Describe "Get-EntraBetaUserOwnedDevice" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaUserOwnedDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Get-EntraBetaUserOwnedDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Get-EntraBetaUserRegisteredDevice.Tests.ps1 b/test/module/EntraBeta/Get-EntraBetaUserRegisteredDevice.Tests.ps1 index c9b037d32..6fb67c742 100644 --- a/test/module/EntraBeta/Get-EntraBetaUserRegisteredDevice.Tests.ps1 +++ b/test/module/EntraBeta/Get-EntraBetaUserRegisteredDevice.Tests.ps1 @@ -38,7 +38,7 @@ BeforeAll { Describe "Get-EntraBetaUserRegisteredDevice" { Context "Test for Get-EntraBetaUserRegisteredDevice" { It "Should return specific user registered device" { - $result = Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" @@ -46,23 +46,23 @@ Describe "Get-EntraBetaUserRegisteredDevice" { Should -Invoke -CommandName Get-MgBetaUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectlId is empty" { - { Get-EntraBetaUserRegisteredDevice -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when UserId is empty" { + { Get-EntraBetaUserRegisteredDevice -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" } - It "Should fail when ObjectlId is invalid" { - { Get-EntraBetaUserRegisteredDevice -ObjectId ""} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is invalid" { + { Get-EntraBetaUserRegisteredDevice -UserId ""} | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should return All user registered devices" { - $result = Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All + $result = Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $result | Should -Not -BeNullOrEmpty Should -Invoke -CommandName Get-MgBetaUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when All is invalid" { - { Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" + { Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" } It "Should return top 1 user registered device" { - $result = Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1 + $result = Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 1 $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" @@ -71,30 +71,30 @@ Describe "Get-EntraBetaUserRegisteredDevice" { Should -Invoke -CommandName Get-MgBetaUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Top is empty" { - { Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" + { Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" } It "Should fail when Top is invalid" { - { Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" + { Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top xyz } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { - $result = Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + It "Should contain UserId in parameters when passed UserId to it" { + $result = Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result.Parameters $params.UserId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Property parameter should work" { - $result = Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id + $result = Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property Id $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb' Should -Invoke -CommandName Get-MgBetaUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Property is empty" { - { Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" + { Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserRegisteredDevice" - $result = Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraBetaUserRegisteredDevice" @@ -110,12 +110,11 @@ Describe "Get-EntraBetaUserRegisteredDevice" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraBetaUserRegisteredDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Get-EntraBetaUserRegisteredDevice -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference } } } -} - \ No newline at end of file +} \ No newline at end of file diff --git a/test/module/EntraBeta/New-EntraBetaAdministrativeUnitMember.Tests.ps1 b/test/module/EntraBeta/New-EntraBetaAdministrativeUnitMember.Tests.ps1 index 5166c43af..00e76cdfb 100644 --- a/test/module/EntraBeta/New-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/test/module/EntraBeta/New-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -43,7 +43,7 @@ BeforeAll { Describe "New-EntraBetaAdministrativeUnitMember" { Context "Test for New-EntraBetaAdministrativeUnitMember" { It "Should return created administrative unit member" { - $result = New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False + $result = New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result.AdditionalProperties.DisplayName | Should -Be "Mock-Admin-UnitMember" @@ -51,65 +51,70 @@ Describe "New-EntraBetaAdministrativeUnitMember" { Should -Invoke -CommandName New-MGBetaAdministrativeUnitMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when Id is empty" { - {New-EntraBetaAdministrativeUnitMember -Id -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should execute successfully with Alias" { + $result = New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False + $result | Should -Not -BeNullOrEmpty + Should -Invoke -CommandName New-MGBetaAdministrativeUnitMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when AdministrativeUnitId is empty" { + {New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when Id is invalid" { - { New-EntraBetaAdministrativeUnitMember -Id "" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False} | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False} | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should fail when DisplayName is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'DisplayName'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'DisplayName'*" } It "Should fail when DisplayName is invalid" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Cannot bind argument to parameter 'DisplayName' because it is an empty string." + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Cannot bind argument to parameter 'DisplayName' because it is an empty string." } It "Should fail when Description is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'Description'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'Description'*" } It "Should fail when MailNickname is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MailNickname'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MailNickname'*" } It "Should fail when MailNickname is invalid" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "" -SecurityEnabled $False } | Should -Throw "Cannot bind argument to parameter 'MailNickname' because it is an empty string." + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "" -SecurityEnabled $False } | Should -Throw "Cannot bind argument to parameter 'MailNickname' because it is an empty string." } It "Should fail when MailEnabled is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MailEnabled'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MailEnabled'*" } It "Should fail when MailEnabled is invalid" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled xy -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Cannot process argument transformation on parameter 'MailEnabled'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled xy -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Cannot process argument transformation on parameter 'MailEnabled'*" } It "Should fail when SecurityEnabled is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled } | Should -Throw "Missing an argument for parameter 'SecurityEnabled'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled } | Should -Throw "Missing an argument for parameter 'SecurityEnabled'*" } It "Should fail when SecurityEnabled is invalid" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled xy } | Should -Throw "Cannot process argument transformation on parameter 'SecurityEnabled'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled xy } | Should -Throw "Cannot process argument transformation on parameter 'SecurityEnabled'*" } It "Should fail when OdataType is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'OdataType'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'OdataType'*" } It "Should fail when GroupTypes is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -GroupTypes -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'GroupTypes'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -GroupTypes -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'GroupTypes'*" } It "Should fail when MembershipRule is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -MembershipRule -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MembershipRule'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -MembershipRule -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MembershipRule'*" } It "Should fail when MembershipRuleProcessingState is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -MembershipRuleProcessingState -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MembershipRuleProcessingState'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -MembershipRuleProcessingState -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'MembershipRuleProcessingState'*" } It "Should fail when AssignedLabels is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -AssignedLabels -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'AssignedLabels'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -AssignedLabels -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'AssignedLabels'*" } It "Should fail when ProxyAddresses is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -ProxyAddresses -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'ProxyAddresses'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -ProxyAddresses -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False } | Should -Throw "Missing an argument for parameter 'ProxyAddresses'*" } It "Should fail when IsAssignableToRole is empty" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -IsAssignableToRole } | Should -Throw "Missing an argument for parameter 'IsAssignableToRole'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -IsAssignableToRole } | Should -Throw "Missing an argument for parameter 'IsAssignableToRole'*" } It "Should fail when IsAssignableToRole is invalid" { - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -IsAssignableToRole xy } | Should -Throw "Cannot process argument transformation on parameter 'IsAssignableToRole'*" + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -IsAssignableToRole xy } | Should -Throw "Cannot process argument transformation on parameter 'IsAssignableToRole'*" } It "Should contain @odata.type in parameters when passed OdataType to it" { - $result = New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False + $result = New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False $jsonArray = $result.Parameters $hashTable = @{} @@ -128,7 +133,7 @@ Describe "New-EntraBetaAdministrativeUnitMember" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraBetaAdministrativeUnitMember" - $result = New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False + $result = New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraBetaAdministrativeUnitMember" @@ -144,7 +149,7 @@ Describe "New-EntraBetaAdministrativeUnitMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraBetaAdministrativeUnitMember -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False -Debug } | Should -Not -Throw + { New-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -OdataType "Microsoft.Graph.Group" -DisplayName "Mock-Admin-UnitMember" -Description "NewAdministrativeUnitMember" -MailEnabled $True -MailNickname "Mock-Admin-UnitMember" -SecurityEnabled $False -GroupTypes @("Unified","DynamicMembership") -MembershipRule "(user.department -contains 'Marketing')" -MembershipRuleProcessingState "On" -IsAssignableToRole $False -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/New-EntraBetaAttributeSet.Tests.ps1 b/test/module/EntraBeta/New-EntraBetaAttributeSet.Tests.ps1 index a0c7110ce..d1fa542d1 100644 --- a/test/module/EntraBeta/New-EntraBetaAttributeSet.Tests.ps1 +++ b/test/module/EntraBeta/New-EntraBetaAttributeSet.Tests.ps1 @@ -25,6 +25,16 @@ BeforeAll { Describe "New-EntraBetaAttributeSet" { Context "Test for New-EntraBetaAttributeSet" { It "Should create new attribute set" { + $result = New-EntraBetaAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccc55' + $result.Description | should -Be "New AttributeSet" + $result.MaxAttributesPerSet | should -Be 21 + + Should -Invoke -CommandName New-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should create new attribute set with alias" { $result = New-EntraBetaAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccc55' @@ -34,31 +44,31 @@ Describe "New-EntraBetaAttributeSet" { Should -Invoke -CommandName New-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when Id is empty" { - { New-EntraBetaAttributeSet -Id -Description "New AttributeSet" -MaxAttributesPerSet 21 } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when AttributeSetId is empty" { + { New-EntraBetaAttributeSet -AttributeSetId -Description "New AttributeSet" -MaxAttributesPerSet 21 } | Should -Throw "Missing an argument for parameter 'AttributeSetId'*" } It "Should fail when Description is empty" { - { New-EntraBetaAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description -MaxAttributesPerSet 21 } | Should -Throw "Missing an argument for parameter 'Description'*" + { New-EntraBetaAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description -MaxAttributesPerSet 21 } | Should -Throw "Missing an argument for parameter 'Description'*" } It "Should fail when MaxAttributesPerSet is empty" { - { New-EntraBetaAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet } | Should -Throw "Missing an argument for parameter 'MaxAttributesPerSet'*" + { New-EntraBetaAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet } | Should -Throw "Missing an argument for parameter 'MaxAttributesPerSet'*" } It "Should fail when MaxAttributesPerSet is invalid" { - { New-EntraBetaAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet "XYZ" } | Should -Throw "Cannot process argument transformation on parameter 'MaxAttributesPerSet'*" + { New-EntraBetaAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet "XYZ" } | Should -Throw "Cannot process argument transformation on parameter 'MaxAttributesPerSet'*" } It "Result should Contain ObjectId" { - $result = New-EntraBetaAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 + $result = New-EntraBetaAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 $result.ObjectId | should -Be "bbbbbbbb-1111-2222-3333-cccccccccc55" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraBetaAttributeSet" - $result = New-EntraBetaAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 + $result = New-EntraBetaAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraBetaAttributeSet" @@ -76,7 +86,7 @@ Describe "New-EntraBetaAttributeSet" { try { # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraBetaAttributeSet -Id "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 -Debug } | Should -Not -Throw + { New-EntraBetaAttributeSet -AttributeSetId "bbbbbbbb-1111-2222-3333-cccccccccc55" -Description "New AttributeSet" -MaxAttributesPerSet 21 -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/New-EntraBetaGroupAppRoleAssignment.Tests.ps1 b/test/module/EntraBeta/New-EntraBetaGroupAppRoleAssignment.Tests.ps1 new file mode 100644 index 000000000..e89b86f51 --- /dev/null +++ b/test/module/EntraBeta/New-EntraBetaGroupAppRoleAssignment.Tests.ps1 @@ -0,0 +1,111 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @( + [PSCustomObject]@{ + "Id" = "00001111-aaaa-2222-bbbb-3333cccc4444" + "AppRoleId" = "bbbbbbbb-1111-2222-3333-cccccccccccc" + "CreatedDateTime" = "06-05-2024 05:42:01" + "DeletedDateTime" = $null + "PrincipalDisplayName" = "Mock-Group" + "PrincipalId" = "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + "ResourceId" = "aaaaaaaa-bbbb-cccc-1111-222222222222" + "ResourceDisplayName" = "Mock-Group" + "PrincipalType" = "PrincipalType" + "AdditionalProperties" = @{"@odata.context" = "https://graph.microsoft.com/v1.0/`$metadata#groups('aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb')/appRoleAssignments/`$entity"} + "Parameters" = $args + } + ) + } + + Mock -CommandName New-MgBetaGroupAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "New-EntraBetaGroupAppRoleAssignment" { +Context "Test for New-EntraBetaGroupAppRoleAssignment" { + It "Should return created Group AppRole Assignment" { + $result = New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + $result.ResourceId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + + Should -Invoke -CommandName New-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return created Group AppRole Assignment with alias" { + $result = New-EntraBetaGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + $result.Id | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + $result.ResourceId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" + $result.PrincipalId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result.AppRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + + Should -Invoke -CommandName New-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when ObjectlId is empty" { + { New-EntraBetaGroupAppRoleAssignment -GroupId -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'GroupId'*" + } + It "Should fail when ObjectlId is invalid" { + { New-EntraBetaGroupAppRoleAssignment -GroupId "" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." + } + It "Should fail when PrincipalId is empty" { + { New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'PrincipalId'*" + } + It "Should fail when PrincipalId is invalid" { + { New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'PrincipalId' because it is an empty string." + } + It "Should fail when ResourceId is empty" { + { New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ResourceId'*" + } + It "Should fail when ResourceId is invalid" { + { New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Cannot bind argument to parameter 'ResourceId' because it is an empty string." + } + It "Should fail when Id is empty" { + { New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -AppRoleId } | Should -Throw "Missing an argument for parameter 'AppRoleId'*" + } + It "Should fail when Id is invalid" { + { New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -AppRoleId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleId' because it is an empty string." + } + It "Result should Contain GroupId" { + $result = New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result.ObjectId | should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" + } + It "Should contain AppRoleId in parameters when passed Id to it" { + $result = New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $params = Get-Parameters -data $result.Parameters + $params.AppRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraBetaGroupAppRoleAssignment" + $result = New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName New-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error " { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { New-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnit.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnit.Tests.ps1 index 2a130cfac..8f5d6cfb1 100644 --- a/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnit.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnit.Tests.ps1 @@ -14,28 +14,34 @@ BeforeAll { Describe "Remove-EntraBetaAdministrativeUnit" { Context "Test for Remove-EntraBetaAdministrativeUnit" { It "Should return empty object" { + $result = Remove-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaAdministrativeUnit -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return empty object with alias" { $result = Remove-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaAdministrativeUnit -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaAdministrativeUnit -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Remove-EntraBetaAdministrativeUnit -AdministrativeUnitId } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraBetaAdministrativeUnit -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Remove-EntraBetaAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } - It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { + It "Should contain AdministrativeUnitId in parameters when passed AdministrativeUnitId to it" { Mock -CommandName Remove-MgBetaAdministrativeUnit -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + $result = Remove-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $params = Get-Parameters -data $result $params.AdministrativeUnitId | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaAdministrativeUnit" - Remove-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" + Remove-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaAdministrativeUnit" @@ -51,7 +57,7 @@ Describe "Remove-EntraBetaAdministrativeUnit" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Remove-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 index 2c4e8031a..4f2eaed76 100644 --- a/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -14,27 +14,33 @@ BeforeAll { Describe "Remove-EntraBetaAdministrativeUnitMember" { Context "Test for Remove-EntraBetaAdministrativeUnitMember" { It "Should return empty object" { + $result = Remove-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDirectoryAdministrativeUnitMemberByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return empty object with alias" { $result = Remove-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaDirectoryAdministrativeUnitMemberByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaAdministrativeUnitMember -ObjectId -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Remove-EntraBetaAdministrativeUnitMember -AdministrativeUnitId -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraBetaAdministrativeUnitMember -ObjectId "" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee"} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Remove-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee"} | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should fail when MemberId is empty" { - { Remove-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" + { Remove-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" } It "Should fail when MemberId is invalid" { - { Remove-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId ""} | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." + { Remove-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId ""} | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaAdministrativeUnitMember" - Remove-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" + Remove-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaAdministrativeUnitMember" @@ -50,7 +56,7 @@ Describe "Remove-EntraBetaAdministrativeUnitMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaAdministrativeUnitMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" -Debug } | Should -Not -Throw + { Remove-EntraBetaAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "dddddddd-9999-0000-1111-eeeeeeeeeeee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaApplication.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaApplication.Tests.ps1 index 8a33f6c32..10b047a94 100644 --- a/test/module/EntraBeta/Remove-EntraBetaApplication.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaApplication.Tests.ps1 @@ -13,25 +13,30 @@ BeforeAll { Describe "Remove-EntraBetaApplication" { Context "Test for Remove-EntraBetaApplication" { It "Should return empty object" { + $result = Remove-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaApplication -ObjectId "" } | Should -Throw "Cannot bind argument to parameter*" + It "Should fail when ApplicationId is empty" { + { Remove-EntraBetaApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter*" } It "Should fail when invalid parameter is passed" { { Remove-EntraBetaApplication -Power "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'Power'*" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { Mock -CommandName Remove-MgBetaApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + $result = Remove-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-1111-1111-1111-000000000000" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaApplication" - $result = Remove-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + $result = Remove-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaApplication" Should -Invoke -CommandName Remove-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -46,7 +51,7 @@ Describe "Remove-EntraBetaApplication" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" -Debug } | Should -Not -Throw + { Remove-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaDevice.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaDevice.Tests.ps1 new file mode 100644 index 000000000..84f7580f0 --- /dev/null +++ b/test/module/EntraBeta/Remove-EntraBetaDevice.Tests.ps1 @@ -0,0 +1,64 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + Mock -CommandName Remove-MgBetaDevice -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Remove-EntraBetaDevice" { + Context "Test for Remove-EntraBetaDevice" { + It "Should return empty object" { + $result = Remove-EntraBetaDevice -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { + $result = Remove-EntraBetaDevice -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is invalid" { + { Remove-EntraBetaDevice -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." + } + It "Should fail when DeviceId is empty" { + { Remove-EntraBetaDevice -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" + } + It "Should contain DeviceId in parameters when passed DeviceId to it" { + Mock -CommandName Remove-MgBetaDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Remove-EntraBetaDevice -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc + $params = Get-Parameters -data $result + $params.DeviceId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaDevice" + Remove-EntraBetaDevice -DeviceId "bbbbbbbb-1111-2222-3333-cccccccccccc" + + Should -Invoke -CommandName Remove-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Remove-EntraBetaDevice -DeviceId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Remove-EntraBetaDeviceRegisteredOwner.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaDeviceRegisteredOwner.Tests.ps1 new file mode 100644 index 000000000..86f912b28 --- /dev/null +++ b/test/module/EntraBeta/Remove-EntraBetaDeviceRegisteredOwner.Tests.ps1 @@ -0,0 +1,81 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module .\test\module\Common-Functions.ps1 -Force + + Mock -CommandName Remove-MgBetaDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Remove-EntraBetaDeviceRegisteredOwner" { + Context "Test for Remove-EntraBetaDeviceRegisteredOwner" { + It "Should return empty object" { + $result = Remove-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { + $result = Remove-EntraBetaDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is empty" { + { Remove-EntraBetaDeviceRegisteredOwner -DeviceId -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'DeviceId'*" } + } + It "Should fail when DeviceId is invalid" { + { Remove-EntraBetaDeviceRegisteredOwner -DeviceId "" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" } + } + It "Should fail when OwnerId is empty" { + { Remove-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId | Should -Throw "Missing an argument for parameter 'OwnerId'*" } + } + It "Should fail when OwnerId is invalid" { + { Remove-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "" | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string.*" } + } + It "Should contain DeviceId in parameters when passed OwnerId to it" { + Mock -CommandName Remove-MgBetaDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Remove-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $params = Get-Parameters -data $result + $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain DirectoryObjectId in parameters when passed OwnerId to it" { + Mock -CommandName Remove-MgBetaDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Remove-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $params = Get-Parameters -data $result + $params.DirectoryObjectId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + } + + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaDeviceRegisteredOwner" + + $result = Remove-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" + + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaDeviceRegisteredOwner" + + Should -Invoke -CommandName Remove-MgBetaDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Remove-EntraBetaDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Remove-EntraBetaDeviceRegisteredUser.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaDeviceRegisteredUser.Tests.ps1 new file mode 100644 index 000000000..3fa83d4e0 --- /dev/null +++ b/test/module/EntraBeta/Remove-EntraBetaDeviceRegisteredUser.Tests.ps1 @@ -0,0 +1,81 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module .\test\module\Common-Functions.ps1 -Force + + Mock -CommandName Remove-MgBetaDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Remove-EntraBetaDeviceRegisteredUser" { + Context "Test for Remove-EntraBetaDeviceRegisteredUser" { + It "Should return empty object" { + $result = Remove-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { + $result = Remove-EntraBetaDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceId is empty" { + { Remove-EntraBetaDeviceRegisteredUser -DeviceId -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'DeviceId'*" } + } + It "Should fail when DeviceId is invalid" { + { Remove-EntraBetaDeviceRegisteredUser -DeviceId "" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string.*" } + } + It "Should fail when UserId is empty" { + { Remove-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId | Should -Throw "Missing an argument for parameter 'UserId'*" } + } + It "Should fail when UserId is invalid" { + { Remove-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "" | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string.*" } + } + It "Should contain DeviceId in parameters when passed UserId to it" { + Mock -CommandName Remove-MgBetaDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Remove-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $params = Get-Parameters -data $result + $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain DirectoryObjectId in parameters when passed UserId to it" { + Mock -CommandName Remove-MgBetaDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Remove-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $params = Get-Parameters -data $result + $params.DirectoryObjectId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + } + + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaDeviceRegisteredUser" + + Remove-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" + + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaDeviceRegisteredUser" + + Should -Invoke -CommandName Remove-MgBetaDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Remove-EntraBetaDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Remove-EntraBetaGroup.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaGroup.Tests.ps1 index f95401c2a..ec5c72645 100644 --- a/test/module/EntraBeta/Remove-EntraBetaGroup.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaGroup.Tests.ps1 @@ -14,24 +14,31 @@ BeforeAll { Describe "Remove-EntraBetaGroup" { Context "Test for Remove-EntraBetaGroup" { It "Should return empty Id" { + $result = Remove-EntraBetaGroup -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should execute successfully with Alias" { $result = Remove-EntraBetaGroup -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaGroup -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Remove-EntraBetaGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraBetaGroup -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Remove-EntraBetaGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Remove-MgBetaGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaGroup -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result = Remove-EntraBetaGroup -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } @@ -39,7 +46,7 @@ Describe "Remove-EntraBetaGroup" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroup" - $result = Remove-EntraBetaGroup -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result = Remove-EntraBetaGroup -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroup" @@ -57,7 +64,7 @@ Describe "Remove-EntraBetaGroup" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaGroup -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Debug } | Should -Not -Throw + { Remove-EntraBetaGroup -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaGroupAppRoleAssignment.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaGroupAppRoleAssignment.Tests.ps1 new file mode 100644 index 000000000..56e3f7972 --- /dev/null +++ b/test/module/EntraBeta/Remove-EntraBetaGroupAppRoleAssignment.Tests.ps1 @@ -0,0 +1,69 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module .\test\module\Common-Functions.ps1 -Force + + Mock -CommandName Remove-MgBetaGroupAppRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Remove-EntraBetaGroupAppRoleAssignment" { + Context "Test for Remove-EntraBetaGroupAppRoleAssignment" { + It "Should return empty object" { + $result = Remove-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return empty object with Alias" { + $result = Remove-EntraBetaGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when GroupId is empty" { + { Remove-EntraBetaGroupAppRoleAssignment -GroupId -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" } | Should -Throw "Missing an argument for parameter 'GroupId'*" + } + It "Should fail when GroupId is invalid" { + { Remove-EntraBetaGroupAppRoleAssignment -GroupId "" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." + } + It "Should fail when AppRoleAssignmentId is empty" { + { Remove-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId } | Should -Throw "Missing an argument for parameter 'AppRoleAssignmentId'*" + } + It "Should fail when AppRoleAssignmentId is invalid" { + { Remove-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleAssignmentId' because it is an empty string." + } + It "Should contain GroupId in parameters when passed GroupId to it" { + Mock -CommandName Remove-MgBetaGroupAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Remove-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + $params = Get-Parameters -data $result + $params.GroupId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroupAppRoleAssignment" + Remove-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" + + Should -Invoke -CommandName Remove-MgBetaGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error " { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Remove-EntraBetaGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 index 16e14fd08..49733f2c4 100644 --- a/test/module/EntraBeta/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 @@ -14,31 +14,38 @@ BeforeAll { Describe "Remove-EntraBetaGroupLifecyclePolicy" { Context "Test for Remove-EntraBetaGroupLifecyclePolicy" { It "Should return empty Id" { + $result = Remove-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should execute successfully with Alias" { $result = Remove-EntraBetaGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when Id is empty" { - { Remove-EntraBetaGroupLifecyclePolicy -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when GroupLifecyclePolicyId is empty" { + { Remove-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'*" } - It "Should fail when Id is invalid" { - { Remove-EntraBetaGroupLifecyclePolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Remove-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string." } - It "Should contain GroupLifecyclePolicyId in parameters when passed Id to it" { + It "Should contain GroupLifecyclePolicyId in parameters when passed GroupLifecyclePolicyId to it" { Mock -CommandName Remove-MgBetaGroupLifecyclePolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result = Remove-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $params = Get-Parameters -data $result $params.GroupLifecyclePolicyId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroupLifecyclePolicy" - $result = Remove-EntraBetaGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" + $result = Remove-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroupLifecyclePolicy" Should -Invoke -CommandName Remove-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -54,7 +61,7 @@ Describe "Remove-EntraBetaGroupLifecyclePolicy" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Debug } | Should -Not -Throw + { Remove-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaGroupMember.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaGroupMember.Tests.ps1 index 339294eea..feed05675 100644 --- a/test/module/EntraBeta/Remove-EntraBetaGroupMember.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaGroupMember.Tests.ps1 @@ -14,39 +14,39 @@ BeforeAll { Describe "Remove-EntraBetaGroupMember" { Context "Test for Remove-EntraBetaGroupMember" { It "Should return empty object" { - $result = Remove-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Remove-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaGroupMemberByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaGroupMember -ObjectId -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Remove-EntraBetaGroupMember -GroupId -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraBetaGroupMember -ObjectId "" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Remove-EntraBetaGroupMember -GroupId "" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when MemberId is empty" { - { Remove-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" + { Remove-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId } | Should -Throw "Missing an argument for parameter 'MemberId'*" } It "Should fail when MemberId is invalid" { - { Remove-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." + { Remove-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Remove-MgBetaGroupMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Remove-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroupMember" - $result = Remove-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Remove-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroupMember" Should -Invoke -CommandName Remove-MgBetaGroupMemberByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -62,7 +62,7 @@ Describe "Remove-EntraBetaGroupMember" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaGroupMember -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw + { Remove-EntraBetaGroupMember -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -MemberId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaGroupOwner.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaGroupOwner.Tests.ps1 index d85057516..37e1ebe5e 100644 --- a/test/module/EntraBeta/Remove-EntraBetaGroupOwner.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaGroupOwner.Tests.ps1 @@ -14,32 +14,32 @@ BeforeAll { Describe "Remove-EntraBetaGroupOwner" { Context "Test for Remove-EntraBetaGroupOwner" { It "Should return empty object" { - $result = Remove-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Remove-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaGroupOwner -ObjectId -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when GroupId is empty" { + { Remove-EntraBetaGroupOwner -GroupId -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraBetaGroupOwner -ObjectId "" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when GroupId is invalid" { + { Remove-EntraBetaGroupOwner -GroupId "" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." } It "Should fail when OwnerId is empty" { - { Remove-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId } | Should -Throw "Missing an argument for parameter 'OwnerId'*" + { Remove-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId } | Should -Throw "Missing an argument for parameter 'OwnerId'*" } It "Should fail when OwnerId is invalid" { - { Remove-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId ""} | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string." + { Remove-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId ""} | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string." } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Remove-MgBetaGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Remove-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $params = Get-Parameters -data $result $params.GroupId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } @@ -47,14 +47,14 @@ Describe "Remove-EntraBetaGroupOwner" { It "Should contain DirectoryObjectId in parameters when passed OwnerId to it" { Mock -CommandName Remove-MgBetaGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Remove-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbcccc-1111-dddd-2222-eeee3333ffff" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroupOwner" - $result = Remove-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" + $result = Remove-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaGroupOwner" Should -Invoke -CommandName Remove-MgBetaGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -70,7 +70,7 @@ Describe "Remove-EntraBetaGroupOwner" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaGroupOwner -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw + { Remove-EntraBetaGroupOwner -GroupId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -OwnerId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaScopedRoleMembership.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaScopedRoleMembership.Tests.ps1 index 0dcffd74a..8ba287d0a 100644 --- a/test/module/EntraBeta/Remove-EntraBetaScopedRoleMembership.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaScopedRoleMembership.Tests.ps1 @@ -13,35 +13,41 @@ BeforeAll { Describe "Remove-EntraBetaScopedRoleMembership" { Context "Test for Remove-EntraBetaScopedRoleMembership" { + It "Should return empty object" { + $result = Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } It "Should return empty object" { $result = Remove-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaScopedRoleMembership -ObjectId -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when AdministrativeUnitId is empty" { + { Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } - It "Should fail when ObjectId is invalid" { - { Remove-EntraBetaScopedRoleMembership -ObjectId "" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU"} | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when AdministrativeUnitId is invalid" { + { Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId "" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU"} | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should fail when ScopedRoleMembershipId is empty" { - { Remove-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId } | Should -Throw "Missing an argument for parameter 'ScopedRoleMembershipId'*" + { Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId } | Should -Throw "Missing an argument for parameter 'ScopedRoleMembershipId'*" } It "Should fail when ScopedRoleMembershipId is invalid" { - { Remove-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId ""} | Should -Throw "Cannot bind argument to parameter 'ScopedRoleMembershipId' because it is an empty string." + { Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId ""} | Should -Throw "Cannot bind argument to parameter 'ScopedRoleMembershipId' because it is an empty string." } - It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { + It "Should contain AdministrativeUnitId in parameters when passed AdministrativeUnitId to it" { Mock -CommandName Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" + $result = Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" $params = Get-Parameters -data $result $params.AdministrativeUnitId | Should -Be "dddddddd-1111-2222-3333-eeeeeeeeeeee" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaScopedRoleMembership" - Remove-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" + Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaScopedRoleMembership" @@ -57,7 +63,7 @@ Describe "Remove-EntraBetaScopedRoleMembership" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaScopedRoleMembership -ObjectId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Debug } | Should -Not -Throw + { Remove-EntraBetaScopedRoleMembership -AdministrativeUnitId "dddddddd-1111-2222-3333-eeeeeeeeeeee" -ScopedRoleMembershipId "zTVcE8KFQ0W4bI9tvt6kz9Es_cQCeeJLolvVzF_5NRdnAVb9H_8aR410OwBwq86hU" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaUser.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaUser.Tests.ps1 index fde360383..ea63ef91b 100644 --- a/test/module/EntraBeta/Remove-EntraBetaUser.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaUser.Tests.ps1 @@ -13,26 +13,31 @@ BeforeAll { Describe "Remove-EntraBetaUser" { Context "Test for Remove-EntraBetaUser" { It "Should return empty object" { + $result = Remove-EntraBetaUser -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgBetaUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { $result = Remove-EntraBetaUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaUser -ObjectId "" } | Should -Throw "Cannot bind argument to parameter*" + It "Should fail when UserId is empty" { + { Remove-EntraBetaUser -UserId "" } | Should -Throw "Cannot bind argument to parameter*" } It "Should fail when invalid parameter is passed" { { Remove-EntraBetaUser -Power "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'Power'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { + It "Should contain UserId in parameters when passed UserId to it" { Mock -CommandName Remove-MgBetaUser -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Remove-EntraBetaUser -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaUser" - $result = Remove-EntraBetaUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Remove-EntraBetaUser -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaUser" Should -Invoke -CommandName Remove-MgBetaUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -47,7 +52,7 @@ Describe "Remove-EntraBetaUser" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Remove-EntraBetaUser -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Remove-EntraBetaUserManager.Tests.ps1 b/test/module/EntraBeta/Remove-EntraBetaUserManager.Tests.ps1 index ad571bc50..ec9a1e6f0 100644 --- a/test/module/EntraBeta/Remove-EntraBetaUserManager.Tests.ps1 +++ b/test/module/EntraBeta/Remove-EntraBetaUserManager.Tests.ps1 @@ -13,26 +13,31 @@ BeforeAll { Describe "Remove-EntraBetaUserManager" { Context "Test for Remove-EntraBetaUserManager" { It "Should return empty object" { + $result = Remove-EntraBetaUserManager -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Remove-MgBetaUserManagerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return empty object with alias" { $result = Remove-EntraBetaUserManager -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' $result | Should -BeNullOrEmpty Should -Invoke -CommandName Remove-MgBetaUserManagerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Remove-EntraBetaUserManager -ObjectId "" } | Should -Throw "Cannot bind argument to parameter*" + It "Should fail when UserId is empty" { + { Remove-EntraBetaUserManager -UserId "" } | Should -Throw "Cannot bind argument to parameter*" } It "Should fail when invalid parameter is passed" { { Remove-EntraBetaUserManager -Power "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'Power'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { + It "Should contain UserId in parameters when passed UserId to it" { Mock -CommandName Remove-MgBetaUserManagerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Remove-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Remove-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaUserManager" - $result = Remove-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" + $result = Remove-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraBetaUserManager" Should -Invoke -CommandName Remove-MgBetaUserManagerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -47,7 +52,7 @@ Describe "Remove-EntraBetaUserManager" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Remove-EntraBetaUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw + { Remove-EntraBetaUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaAdministrativeUnit.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaAdministrativeUnit.Tests.ps1 index ef718b9af..9cc3e6786 100644 --- a/test/module/EntraBeta/Set-EntraBetaAdministrativeUnit.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaAdministrativeUnit.Tests.ps1 @@ -14,40 +14,40 @@ BeforeAll { Describe "Set-EntraBetaAdministrativeUnit" { Context "Test for Set-EntraBetaAdministrativeUnit" { It "Should return empty object" { - $result = Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -IsMemberManagementRestricted $true + $result = Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -IsMemberManagementRestricted $true $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgBetaAdministrativeUnit -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when Id is empty" { - { Set-EntraBetaAdministrativeUnit -Id -DisplayName "Mock-Admin-Unit" } | Should -Throw "Missing an argument for parameter 'Id'*" + { Set-EntraBetaAdministrativeUnit -AdministrativeUnitId -DisplayName "Mock-Admin-Unit" } | Should -Throw "Missing an argument for parameter 'AdministrativeUnitId'*" } It "Should fail when Id is invalid" { - { Set-EntraBetaAdministrativeUnit -Id "" -Description "NewAdministrativeUnit" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." + { Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "" -Description "NewAdministrativeUnit" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId' because it is an empty string." } It "Should fail when DisplayName is empty" { - { Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName } | Should -Throw "Missing an argument for parameter 'DisplayName'*" + { Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName } | Should -Throw "Missing an argument for parameter 'DisplayName'*" } It "Should fail when Description is empty" { - { Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description } | Should -Throw "Missing an argument for parameter 'Description'*" + { Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description } | Should -Throw "Missing an argument for parameter 'Description'*" } It "Should fail when IsMemberManagementRestricted is empty" { - { Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" --DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -IsMemberManagementRestricted } | Should -Throw "Missing an argument for parameter 'IsMemberManagementRestricted'*" + { Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" --DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -IsMemberManagementRestricted } | Should -Throw "Missing an argument for parameter 'IsMemberManagementRestricted'*" } It "Should fail when IsMemberManagementRestricted is invalid" { - { Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -IsMemberManagementRestricted "" } | Should -Throw "Cannot process argument transformation on parameter 'IsMemberManagementRestricted'.*" + { Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -IsMemberManagementRestricted "" } | Should -Throw "Cannot process argument transformation on parameter 'IsMemberManagementRestricted'.*" } It "Should contain AdministrativeUnitId in parameters when passed ObjectId to it" { Mock -CommandName Update-MgBetaAdministrativeUnit -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" + $result = Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" $params = Get-Parameters -data $result $params.AdministrativeUnitId | Should -Be "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaAdministrativeUnit" - Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" + Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaAdministrativeUnit" @@ -63,7 +63,7 @@ Describe "Set-EntraBetaAdministrativeUnit" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraBetaAdministrativeUnit -Id "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -Debug } | Should -Not -Throw + { Set-EntraBetaAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -DisplayName "Mock-Admin-Unit" -Description "NewAdministrativeUnit" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaApplication.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaApplication.Tests.ps1 index c63a7f373..9d9d2ddb7 100644 --- a/test/module/EntraBeta/Set-EntraBetaApplication.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaApplication.Tests.ps1 @@ -13,25 +13,30 @@ BeforeAll { Describe "Set-EntraBetaApplication"{ Context "Test for Set-EntraBetaApplication" { It "Should return empty object"{ + $result = Set-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" -DisplayName "Mock-App" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Update-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { $result = Set-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" -DisplayName "Mock-App" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraBetaApplication -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when ApplicationId is empty" { + { Set-EntraBetaApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." } It "Should fail when invalid parameter is passed" { { Set-EntraBetaApplication -Power "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'Power'*" } - It "Should contain ApplicationId in parameters when passed ObjectId to it" { + It "Should contain ApplicationId in parameters when passed ApplicationId to it" { Mock -CommandName Update-MgBetaApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Set-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + $result = Set-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-1111-1111-1111-000000000000" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaApplication" - $result = Set-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" + $result = Set-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaApplication" Should -Invoke -CommandName Update-MgBetaApplication -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -46,7 +51,7 @@ Describe "Set-EntraBetaApplication"{ try { # Act & Assert: Ensure the function doesn't throw an exception - {Set-EntraBetaApplication -ObjectId "aaaaaaaa-1111-1111-1111-000000000000" -Debug } | Should -Not -Throw + {Set-EntraBetaApplication -ApplicationId "aaaaaaaa-1111-1111-1111-000000000000" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaApplicationLogo.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaApplicationLogo.Tests.ps1 index a582d707e..3df9232f7 100644 --- a/test/module/EntraBeta/Set-EntraBetaApplicationLogo.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaApplicationLogo.Tests.ps1 @@ -14,22 +14,22 @@ BeforeAll { Describe "Set-EntraBetaApplicationLogo"{ Context "Test for Set-EntraBetaApplicationLogo" { It "Should return empty object"{ - $result = Set-EntraBetaApplicationLogo -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "https://th.bing.com/th?q=Perennial+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" + $result = Set-EntraBetaApplicationLogo -ApplicationId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "https://th.bing.com/th?q=Perennial+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraBetaApplicationLogo -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" + It "Should fail when ApplicationId is empty" { + { Set-EntraBetaApplicationLogo -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" } - It "Should fail when ObjectId is null" { - { Set-EntraBetaApplicationLogo -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ApplicationId is null" { + { Set-EntraBetaApplicationLogo -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should fail when filepath invalid"{ - { Set-EntraBetaApplicationLogo -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "sdd" } | Should -Throw "FilePath is invalid" + { Set-EntraBetaApplicationLogo -ApplicationId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "sdd" } | Should -Throw "FilePath is invalid" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaApplicationLogo" - $result = Set-EntraBetaApplicationLogo -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "https://th.bing.com/th?q=Perennial+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" + $result = Set-EntraBetaApplicationLogo -ApplicationId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "https://th.bing.com/th?q=Perennial+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaApplicationLogo" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -44,7 +44,7 @@ Describe "Set-EntraBetaApplicationLogo"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraBetaApplicationLogo -ObjectId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "https://th.bing.com/th?q=Perennial+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" -Debug } | Should -Not -Throw + { Set-EntraBetaApplicationLogo -ApplicationId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -FilePath "https://th.bing.com/th?q=Perennial+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaAttributeSet.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaAttributeSet.Tests.ps1 index fe688ceae..0efb9b012 100644 --- a/test/module/EntraBeta/Set-EntraBetaAttributeSet.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaAttributeSet.Tests.ps1 @@ -14,39 +14,46 @@ BeforeAll { Describe "Set-EntraBetaAttributeSet" { Context "Test for Set-EntraBetaAttributeSet" { It "Should update attribute set" { + $result = Set-EntraBetaAttributeSet -AttributeSetId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 + $result | Should -Be -NullOrEmpty + + Should -Invoke -CommandName Update-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should update attribute set with alias" { $result = Set-EntraBetaAttributeSet -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 $result | Should -Be -NullOrEmpty Should -Invoke -CommandName Update-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when Id is empty" { - { Set-EntraBetaAttributeSet -Id -Description "Update AttributeSet" -MaxAttributesPerSet 22 } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when AttributeSetId is empty" { + { Set-EntraBetaAttributeSet -AttributeSetId -Description "Update AttributeSet" -MaxAttributesPerSet 22 } | Should -Throw "Missing an argument for parameter 'AttributeSetId'*" } It "Should fail when Description is empty" { - { Set-EntraBetaAttributeSet -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description -MaxAttributesPerSet 22 } | Should -Throw "Missing an argument for parameter 'Description'*" + { Set-EntraBetaAttributeSet -AttributeSetId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description -MaxAttributesPerSet 22 } | Should -Throw "Missing an argument for parameter 'Description'*" } It "Should fail when MaxAttributesPerSet is empty" { - { Set-EntraBetaAttributeSet -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet } | Should -Throw "Missing an argument for parameter 'MaxAttributesPerSet'*" + { Set-EntraBetaAttributeSet -AttributeSetId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet } | Should -Throw "Missing an argument for parameter 'MaxAttributesPerSet'*" } It "Should fail when MaxAttributesPerSet is invalid" { - { Set-EntraBetaAttributeSet -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet "XYZ" } | Should -Throw "Cannot process argument transformation on parameter 'MaxAttributesPerSet'*" + { Set-EntraBetaAttributeSet -AttributeSetId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet "XYZ" } | Should -Throw "Cannot process argument transformation on parameter 'MaxAttributesPerSet'*" } It "Should contain AttributeSetId in parameters when passed Id to it" { Mock -CommandName Update-MgBetaDirectoryAttributeSet -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Set-EntraBetaAttributeSet -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 + $result = Set-EntraBetaAttributeSet -AttributeSetId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 $params = Get-Parameters -data $result $params.AttributeSetId | Should -Be "aaaabbbb-0000-cccc-1111-dddd2222eeee" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaAttributeSet" - $result = Set-EntraBetaAttributeSet -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 + $result = Set-EntraBetaAttributeSet -AttributeSetId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaAttributeSet" Should -Invoke -CommandName Update-MgBetaDirectoryAttributeSet -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -62,7 +69,7 @@ Describe "Set-EntraBetaAttributeSet" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraBetaAttributeSet -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 -Debug } | Should -Not -Throw + { Set-EntraBetaAttributeSet -AttributeSetId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -Description "Update AttributeSet" -MaxAttributesPerSet 22 -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaDevice.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaDevice.Tests.ps1 new file mode 100644 index 000000000..15ac91997 --- /dev/null +++ b/test/module/EntraBeta/Set-EntraBetaDevice.Tests.ps1 @@ -0,0 +1,64 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +BeforeAll { + if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + Mock -CommandName Update-MgBetaDevice -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Set-EntraBetaDevice"{ + Context "Test for Set-EntraBetaDevice" { + It "Should return empty object"{ + $result = Set-EntraBetaDevice -DeviceObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" -AccountEnabled $true + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { + $result = Set-EntraBetaDevice -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" -AccountEnabled $true + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should fail when DeviceObjectId is invalid" { + { Set-EntraBetaDevice -DeviceObjectId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceObjectId' because it is an empty string." + } + It "Should fail when DeviceObjectId is empty" { + { Set-EntraBetaDevice -DeviceObjectId } | Should -Throw "Missing an argument for parameter 'DeviceObjectId'*" + } + It "Should contain DeviceId in parameters when passed DeviceObjectId to it" { + Mock -CommandName Update-MgBetaDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta + + $result = Set-EntraBetaDevice -DeviceObjectId bbbbbbbb-1111-2222-3333-cccccccccccc + $params = Get-Parameters -data $result + $params.DeviceId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaDevice" + Set-EntraBetaDevice -DeviceObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + + Should -Invoke -CommandName Update-MgBetaDevice -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Set-EntraBetaDevice -DeviceObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Set-EntraBetaGroup.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaGroup.Tests.ps1 index 138d01c2d..85e4c5e51 100644 --- a/test/module/EntraBeta/Set-EntraBetaGroup.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaGroup.Tests.ps1 @@ -14,55 +14,62 @@ BeforeAll { Describe "Set-EntraBetaGroup" { Context "Test for Set-EntraBetaGroup" { It "Should return empty object" { + $result = Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Description "Update Group" -DisplayName "Update My Test san" -MailEnabled $false -MailNickname "Update nickname" -SecurityEnabled $true + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + + It "Should execute successfully with Alias" { $result = Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Description "Update Group" -DisplayName "Update My Test san" -MailEnabled $false -MailNickname "Update nickname" -SecurityEnabled $true $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraBetaGroup -Id } | Should -Throw "Missing an argument for parameter 'Id'*" + It "Should fail when GroupId is empty" { + { Set-EntraBetaGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } - It "Should fail when ObjectId is invalid" { - { Set-EntraBetaGroup -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string.*" + It "Should fail when GroupId is invalid" { + { Set-EntraBetaGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string.*" } It "Should fail when Description is empty" { - { Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Description } | Should -Throw "Missing an argument for parameter 'Description'.*" + { Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Description } | Should -Throw "Missing an argument for parameter 'Description'.*" } It "Should fail when DisplayName is empty" { - { Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DisplayName } | Should -Throw "Missing an argument for parameter 'DisplayName'.*" + { Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DisplayName } | Should -Throw "Missing an argument for parameter 'DisplayName'.*" } It "Should fail when MailEnabled is empty" { - { Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -MailEnabled } | Should -Throw "Missing an argument for parameter*" + { Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -MailEnabled } | Should -Throw "Missing an argument for parameter*" } It "Should fail when MailEnabled is invalid" { - { Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -MailEnabled ""} | Should -Throw "Cannot process argument transformation on parameter 'MailEnabled'.*" + { Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -MailEnabled ""} | Should -Throw "Cannot process argument transformation on parameter 'MailEnabled'.*" } It "Should fail when MailNickname is empty" { - { Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -MailNickname } | Should -Throw "Missing an argument for parameter*" + { Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -MailNickname } | Should -Throw "Missing an argument for parameter*" } It "Should fail when SecurityEnabled is empty" { - { Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -SecurityEnabled } | Should -Throw "Missing an argument for parameter*" + { Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -SecurityEnabled } | Should -Throw "Missing an argument for parameter*" } - It "Should contain GroupId in parameters when passed ObjectId to it" { + It "Should contain GroupId in parameters when passed GroupId to it" { Mock -CommandName Update-MgBetaGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result $params.GroupId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaGroup" - $result = Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" + $result = Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaGroup" Should -Invoke -CommandName Update-MgBetaGroup -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -78,7 +85,7 @@ Describe "Set-EntraBetaGroup" { try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraBetaGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw + { Set-EntraBetaGroup -GroupId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaGroupLifecyclePolicy.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaGroupLifecyclePolicy.Tests.ps1 new file mode 100644 index 000000000..b68e04219 --- /dev/null +++ b/test/module/EntraBeta/Set-EntraBetaGroupLifecyclePolicy.Tests.ps1 @@ -0,0 +1,87 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +BeforeAll { + if ((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null) { + Import-Module Microsoft.Graph.Entra.Beta + } + Import-Module (Join-Path $psscriptroot "..\Common-Functions.ps1") -Force + + $scriptblock = { + return @( + [PSCustomObject]@{ + "Id" = "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" + "AlternateNotificationEmails" = "admingroup@contoso.com" + "GroupLifetimeInDays" = "100" + "ManagedGroupTypes" = "All" + "Parameters" = $args + } + ) + } + + Mock -CommandName Update-MgBetaGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Beta +} + +Describe "Set-EntraBetaGroupLifecyclePolicy" { + Context "Test for Set-EntraBetaGroupLifecyclePolicy" { + It "Should return updated GroupLifecyclePolicy" { + $result = Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result | Should -Not -BeNullOrEmpty + $result.Id | should -Be "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" + $result.GroupLifetimeInDays | should -Be "100" + $result.ManagedGroupTypes | should -Be "All" + $result.AlternateNotificationEmails | should -Be "admingroup@contoso.com" + + Should -Invoke -CommandName Update-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should execute successfully with Alias" { + $result = Set-EntraBetaGroupLifecyclePolicy -Id "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result | Should -Not -BeNullOrEmpty + } + It "Should fail when GroupLifecyclePolicyId is invalid" { + { Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "" -GroupLifetimeInDays a -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string.*" + } + It "Should fail when GroupLifecyclePolicyId is empty" { + { Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId -GroupLifetimeInDays -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'.*" + } + It "Should fail when GroupLifetimeInDays is invalid" { + { Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays a -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Cannot process argument transformation on parameter 'GroupLifetimeInDays'.*" + } + It "Should fail when GroupLifetimeInDays is empty" { + { Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'GroupLifetimeInDays'.*" + } + It "Should fail when ManagedGroupTypes is empty" { + { Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 99 -ManagedGroupTypes -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Missing an argument for parameter 'ManagedGroupTypes'.*" + } + It "Should fail when AlternateNotificationEmails is empty" { + { Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 99 -ManagedGroupTypes "Selected" -AlternateNotificationEmails } | Should -Throw "Missing an argument for parameter 'AlternateNotificationEmails'.*" + } + It "Result should Contain ObjectId" { + $result = Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result.ObjectId | should -Be "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" + } + It "Should contain 'User-Agent' header" { + $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaGroupLifecyclePolicy" + $result = Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" + $result | Should -Not -BeNullOrEmpty + + Should -Invoke -CommandName Update-MgBetaGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { + $Headers.'User-Agent' | Should -Be $userAgentHeaderValue + $true + } + } + It "Should execute successfully without throwing an error" { + # Disable confirmation prompts + $originalDebugPreference = $DebugPreference + $DebugPreference = 'Continue' + + try { + # Act & Assert: Ensure the function doesn't throw an exception + { Set-EntraBetaGroupLifecyclePolicy -GroupLifecyclePolicyId "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" -Debug } | Should -Not -Throw + } finally { + # Restore original confirmation preference + $DebugPreference = $originalDebugPreference + } + } + } +} \ No newline at end of file diff --git a/test/module/EntraBeta/Set-EntraBetaServicePrincipal.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaServicePrincipal.Tests.ps1 index 5ddefa317..8cb3b211f 100644 --- a/test/module/EntraBeta/Set-EntraBetaServicePrincipal.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaServicePrincipal.Tests.ps1 @@ -14,21 +14,26 @@ BeforeAll { Describe "Set-EntraBetaServicePrincipal"{ Context "Test for Set-EntraBetaServicePrincipal" { It "Should return empty object"{ - $result = Set-EntraBetaServicePrincipal -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" + $result = Set-EntraBetaServicePrincipal -ServicePrincipalId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is invalid" { - { Set-EntraBetaServicePrincipal -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should return empty object with Alias" { + $result = Set-EntraBetaServicePrincipal -ServicePrincipalId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" + $result | Should -BeNullOrEmpty + + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraBetaServicePrincipal -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" + It "Should fail when ServicePrincipalId is invalid" { + { Set-EntraBetaServicePrincipal -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." + } + It "Should fail when ServicePrincipalId is empty" { + { Set-EntraBetaServicePrincipal -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'*" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaServicePrincipal" - - Set-EntraBetaServicePrincipal -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc | Out-Null + Set-EntraBetaServicePrincipal -ServicePrincipalId bbbbbbbb-1111-2222-3333-cccccccccccc | Out-Null $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaServicePrincipal" Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue @@ -42,7 +47,7 @@ Describe "Set-EntraBetaServicePrincipal"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraBetaServicePrincipal -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -Debug } | Should -Not -Throw + { Set-EntraBetaServicePrincipal -ServicePrincipalId bbbbbbbb-1111-2222-3333-cccccccccccc -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaUser.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaUser.Tests.ps1 index bfec77910..7cc5f64fb 100644 --- a/test/module/EntraBeta/Set-EntraBetaUser.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaUser.Tests.ps1 @@ -13,12 +13,17 @@ BeforeAll { Describe "Set-EntraBetaUser"{ Context "Test for Set-EntraBetaUser" { It "Should return empty object"{ + $result = Set-EntraBetaUser -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DisplayName "Mock-App" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Update-MgBetaUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return empty object with alias"{ $result = Set-EntraBetaUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -DisplayName "Mock-App" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Update-MgBetaUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } It "Should fail when ObjectId is empty" { - { Set-EntraBetaUser -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + { Set-EntraBetaUser -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should fail when invalid parameter is passed" { { Set-EntraBetaUser -Power "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'Power'*" @@ -26,38 +31,13 @@ Describe "Set-EntraBetaUser"{ It "Should contain UserId in parameters when passed ObjectId to it" { Mock -CommandName Update-MgBetaUser -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Set-EntraBetaUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + $result = Set-EntraBetaUser -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' $params = Get-Parameters -data $result $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - } - It "Should contain ExternalUserState, OnPremisesImmutableId, ExternalUserStateChangeDateTime, BusinessPhones, " { - Mock -CommandName Update-MgBetaUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Beta - - # format like "yyyy-MM-dd HH:mm:ss" - $userStateChangedOn = [System.DateTime]::Parse("2015-12-08 15:15:19") - - $result = Set-EntraBetaUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" ` - -UserState "PendingAcceptance" ` - -UserStateChangedOn $userStateChangedOn ` - -ImmutableId "djkjsajsa-e32j2-2i32" ` - -Mobile "123111221" ` - -TelephoneNumber "1234567890" - - $params = Get-Parameters -data $result - - $params.BusinessPhones[0] | Should -Be "1234567890" - - $params.MobilePhone | Should -Be "123111221" - - $params.ExternalUserState | Should -Be "PendingAcceptance" - - $params.OnPremisesImmutableId | Should -Be "djkjsajsa-e32j2-2i32" - - $params.ExternalUserStateChangeDateTime | Should -Be $userStateChangedOn - } + } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaUser" - $result = Set-EntraBetaUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' + $result = Set-EntraBetaUser -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaUser" Should -Invoke -CommandName Update-MgBetaUser -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -72,7 +52,7 @@ Describe "Set-EntraBetaUser"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraBetaUser -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb'-Debug } | Should -Not -Throw + { Set-EntraBetaUser -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb'-Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference diff --git a/test/module/EntraBeta/Set-EntraBetaUserManager.Tests.ps1 b/test/module/EntraBeta/Set-EntraBetaUserManager.Tests.ps1 index 8224c4970..904c11306 100644 --- a/test/module/EntraBeta/Set-EntraBetaUserManager.Tests.ps1 +++ b/test/module/EntraBeta/Set-EntraBetaUserManager.Tests.ps1 @@ -13,26 +13,31 @@ BeforeAll { Describe "Set-EntraBetaUserManager"{ Context "Test for Set-EntraBetaUserManager" { It "Should return empty object"{ + $result = Set-EntraBetaUserManager -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result | Should -BeNullOrEmpty + Should -Invoke -CommandName Set-MgBetaUserManagerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 + } + It "Should return empty object with alias"{ $result = Set-EntraBetaUserManager -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty Should -Invoke -CommandName Set-MgBetaUserManagerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 } - It "Should fail when ObjectId is empty" { - { Set-EntraBetaUserManager -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." + It "Should fail when UserId is empty" { + { Set-EntraBetaUserManager -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." } It "Should fail when invalid parameter is passed" { { Set-EntraBetaUserManager -Power "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'Power'*" } - It "Should contain UserId in parameters when passed ObjectId to it" { + It "Should contain UserId in parameters when passed UserId to it" { Mock -CommandName Set-MgBetaUserManagerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Beta - $result = Set-EntraBetaUserManager -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Set-EntraBetaUserManager -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.UserId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaUserManager" - $result = Set-EntraBetaUserManager -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" + $result = Set-EntraBetaUserManager -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraBetaUserManager" Should -Invoke -CommandName Set-MgBetaUserManagerByRef -ModuleName Microsoft.Graph.Entra.Beta -Times 1 -ParameterFilter { @@ -47,7 +52,7 @@ Describe "Set-EntraBetaUserManager"{ try { # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraBetaUserManager -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw + { Set-EntraBetaUserManager -UserId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Debug } | Should -Not -Throw } finally { # Restore original confirmation preference $DebugPreference = $originalDebugPreference