diff --git a/src/Identity.Governance/Identity.Governance/custom/New-MgEntitlementManagementConnectedOrganization.ps1 b/src/Identity.Governance/Identity.Governance/custom/New-MgEntitlementManagementConnectedOrganization.ps1 new file mode 100644 index 00000000000..0336b6524e9 --- /dev/null +++ b/src/Identity.Governance/Identity.Governance/custom/New-MgEntitlementManagementConnectedOrganization.ps1 @@ -0,0 +1,140 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create new connectedOrganization +.Description +Create a new connected organization, for use in an Azure AD Entitlement Management policy. +.Example +PS C:\> New-MgEntitlementManagementConnectedOrganization -DomainName microsoft.com + +Id +-- +a19c861f-c110-423c-a8bb-b54230a036c9 + +.Outputs +Microsoft.Graph.PowerShell.Models.IMicrosoftGraphConnectedOrganization +.Link +https://docs.microsoft.com/en-us/powershell/module/microsoft.graph.identity.governance/new-mgentitlementmanagementconnectedorganization +#> +function New-MgEntitlementManagementConnectedOrganization { +[OutputType([Microsoft.Graph.PowerShell.Models.IMicrosoftGraphConnectedOrganization])] +[CmdletBinding(DefaultParameterSetName='CreateWithDomainIdentitySource', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +[Microsoft.Graph.PowerShell.Profile('v1.0-beta')] +param( + + [Parameter(ParameterSetName='CreateWithDomainIdentitySource')] + [Microsoft.Graph.PowerShell.Category('Body')] + [System.String] + # The description of the connected organization. + ${Description}, + + [Parameter(ParameterSetName='CreateWithDomainIdentitySource')] + [Microsoft.Graph.PowerShell.Category('Body')] + [System.String] + # The display name of the connected organization. + ${DisplayName}, + + [Parameter(Mandatory = $True, ParameterSetName='CreateWithDomainIdentitySource')] + [Microsoft.Graph.PowerShell.Category('Body')] + [System.String] + # The domain name of the connected organization identity source. + ${DomainName}, + + [Parameter(ParameterSetName='CreateWithDomainIdentitySource')] + [Microsoft.Graph.PowerShell.Category('Body')] + [System.String] + # connectedOrganizationState + ${State}, + + [Parameter(DontShow)] + [Microsoft.Graph.PowerShell.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Graph.PowerShell.Category('Runtime')] + [Microsoft.Graph.PowerShell.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Graph.PowerShell.Category('Runtime')] + [Microsoft.Graph.PowerShell.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Graph.PowerShell.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Graph.PowerShell.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Graph.PowerShell.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + +} + +process { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + + if ($DomainName -ne $null -and $DomainName.Length -gt 0) { + $dis = new-object Microsoft.Graph.PowerShell.Models.MicrosoftGraphIdentitySource + $dis.AdditionalProperties['@odata.type'] = "microsoft.graph.domainidentitysource" + if ($null -eq $DisplayName -or $DisplayName.Length -eq 0) { + $dis.AdditionalProperties['displayName'] = $DomainName + } else { + $dis.AdditionalProperties['displayName'] = $DisplayName + } + + $dis.AdditionalProperties['domainName'] = $DomainName + + # automatic conversion of single object into array of 1 element + $PSBoundParameters['IdentitySources'] = $dis + + $null = $PSBoundParameters.Remove("DomainName") + + if ($null -eq $DisplayName -or $DisplayName.Length -eq 0) { + $PSBoundParameters['DisplayName'] = $DomainName + } + } + + Microsoft.Graph.Identity.Governance.private\New-MgEntitlementManagementConnectedOrganization_CreateExpanded @PSBoundParameters +} + +end { + +} +} diff --git a/src/Identity.Governance/Identity.Governance/custom/Split-MgEntitlementManagementConnectedOrganization.ps1 b/src/Identity.Governance/Identity.Governance/custom/Split-MgEntitlementManagementConnectedOrganization.ps1 new file mode 100644 index 00000000000..137cee7ef8e --- /dev/null +++ b/src/Identity.Governance/Identity.Governance/custom/Split-MgEntitlementManagementConnectedOrganization.ps1 @@ -0,0 +1,73 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Split elements of a connectedOrganization +.Description +Split elements of one or more Azure AD entitlement management connected organizations, returned by Get-MgEntitlementManagementConnectedOrganization, to simplify reporting. +.Inputs +Microsoft.Graph.PowerShell.Models.IMicrosoftGraphConnectedOrganization + +.Link +https://docs.microsoft.com/en-us/powershell/module/microsoft.graph.identity.governance/split-mgentitlementmanagementconnectedorganization +#> +function Split-MgEntitlementManagementConnectedOrganization { +[CmdletBinding(DefaultParameterSetName='SplitByIdentitySource', PositionalBinding=$false, ConfirmImpact='Medium')] +[Microsoft.Graph.PowerShell.Profile('v1.0-beta')] +param( + + [Parameter(ValueFromPipeline=$true,ParameterSetName='SplitByIdentitySource')] + [Microsoft.Graph.PowerShell.Models.IMicrosoftGraphConnectedOrganization[]] + # The connected organization. + ${ConnectedOrganization}, + + [Parameter(Mandatory=$true, ParameterSetName='SplitByIdentitySource')] + [switch] + ${ByIdentitySource} + +) + +begin { + +} + +process { + if ($ByIdentitySource) { + + if ($null -ne $ConnectedOrganization.IdentitySources) { + foreach ($is in $ConnectedOrganization.IdentitySources) { + # identity sources, as an abstract class, does not have any properties + + $aObj = [pscustomobject]@{ + ConnectedOrganizationId = $ConnectedOrganization.Id + } + + $addl = $is.AdditionalProperties + foreach ($k in $addl.Keys) { + $isk = $k + $aObj | Add-Member -MemberType NoteProperty -Name $isk -Value $addl[$k] -Force + } + + write-output $aObj + } + } + } +} + +end { + +} +}