-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Usability Params for Set-EntraUserExtension
- Loading branch information
1 parent
8cf8c47
commit dd67223
Showing
2 changed files
with
114 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. | ||
# ------------------------------------------------------------------------------ | ||
@{ | ||
SourceName = "Set-AzureADUserExtension" | ||
TargetName = $null | ||
Parameters = $null | ||
Outputs = $null | ||
CustomScript = @' | ||
[CmdletBinding(DefaultParameterSetName = '')] | ||
param ( | ||
[Alias('ObjectId')] | ||
[Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] | ||
[Parameter(ParameterSetName = "SetMultiple", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] | ||
[System.String] $UserId, | ||
[Parameter(ParameterSetName = "SetMultiple", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] | ||
[System.Collections.Generic.Dictionary`2[System.String,System.String]] $ExtensionNameValues, | ||
[Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] | ||
[System.String] $ExtensionValue, | ||
[Parameter(ParameterSetName = "SetSingle", Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] | ||
[System.String] $ExtensionName | ||
) | ||
PROCESS { | ||
$params = @{} | ||
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand | ||
if ($null -ne $PSBoundParameters["UserId"]) | ||
{ | ||
$params["UserId"] = $PSBoundParameters["UserId"] | ||
} | ||
if ($null -ne $PSBoundParameters["ProgressAction"]) | ||
{ | ||
$params["ProgressAction"] = $PSBoundParameters["ProgressAction"] | ||
} | ||
if ($null -ne $PSBoundParameters["WarningVariable"]) | ||
{ | ||
$params["WarningVariable"] = $PSBoundParameters["WarningVariable"] | ||
} | ||
if ($null -ne $PSBoundParameters["ExtensionNameValues"]) | ||
{ | ||
$params["ExtensionNameValues"] = $PSBoundParameters["ExtensionNameValues"] | ||
} | ||
if ($null -ne $PSBoundParameters["ExtensionValue"]) | ||
{ | ||
$params["ExtensionValue"] = $PSBoundParameters["ExtensionValue"] | ||
} | ||
if ($null -ne $PSBoundParameters["PipelineVariable"]) | ||
{ | ||
$params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"] | ||
} | ||
if ($null -ne $PSBoundParameters["ExtensionName"]) | ||
{ | ||
$params["ExtensionName"] = $PSBoundParameters["ExtensionName"] | ||
} | ||
if ($null -ne $PSBoundParameters["OutBuffer"]) | ||
{ | ||
$params["OutBuffer"] = $PSBoundParameters["OutBuffer"] | ||
} | ||
if ($null -ne $PSBoundParameters["ErrorVariable"]) | ||
{ | ||
$params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"] | ||
} | ||
if ($null -ne $PSBoundParameters["ErrorAction"]) | ||
{ | ||
$params["ErrorAction"] = $PSBoundParameters["ErrorAction"] | ||
} | ||
if ($null -ne $PSBoundParameters["InformationVariable"]) | ||
{ | ||
$params["InformationVariable"] = $PSBoundParameters["InformationVariable"] | ||
} | ||
if ($null -ne $PSBoundParameters["InformationAction"]) | ||
{ | ||
$params["InformationAction"] = $PSBoundParameters["InformationAction"] | ||
} | ||
if ($null -ne $PSBoundParameters["WarningAction"]) | ||
{ | ||
$params["WarningAction"] = $PSBoundParameters["WarningAction"] | ||
} | ||
if ($null -ne $PSBoundParameters["OutVariable"]) | ||
{ | ||
$params["OutVariable"] = $PSBoundParameters["OutVariable"] | ||
} | ||
if($PSBoundParameters.ContainsKey("Debug")) | ||
{ | ||
$params["Debug"] = $PSBoundParameters["Debug"] | ||
} | ||
if($PSBoundParameters.ContainsKey("Verbose")) | ||
{ | ||
$params["Verbose"] = $PSBoundParameters["Verbose"] | ||
} | ||
Write-Debug("============================ TRANSFORMATIONS ============================") | ||
$params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug | ||
Write-Debug("=========================================================================`n") | ||
$response = Update-MgUserExtension @params -Headers $customHeaders | ||
$response | ForEach-Object { | ||
if($null -ne $_) { | ||
Add-Member -InputObject $_ -MemberType AliasProperty -Name UserId -Value Id | ||
} | ||
} | ||
$response | ||
} | ||
'@ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ Sets a user extension. | |
|
||
```powershell | ||
Set-EntraUserExtension | ||
-ObjectId <String> | ||
-UserId <String> | ||
[<CommonParameters>] | ||
``` | ||
|
||
|
@@ -41,7 +41,7 @@ The `Set-EntraUserExtension` cmdlet updates a user extension in Microsoft Entra | |
```powershell | ||
Connect-Entra -Scopes 'User.ReadWrite.All' | ||
$params = @{ | ||
ObjectId = '[email protected]' | ||
UserId = '[email protected]' | ||
ExtensionName = 'extension_e5e29b8a85d941eab8d12162bd004528_extensionAttribute8' | ||
ExtensionValue = 'New Value' | ||
} | ||
|
@@ -50,15 +50,15 @@ Set-EntraUserExtension @params | |
|
||
This example shows how to update the value of the extension attribute for a specified user. | ||
|
||
- `-ObjectId` parameter specifies the user Id. | ||
- `-UserId` parameter specifies the user Id. | ||
- `-ExtensionName` parameter specifies the name of an extension. | ||
- `-ExtensionValue` parameter specifies the extension name values. | ||
|
||
## Parameters | ||
|
||
### -ObjectId | ||
### -UserId | ||
|
||
Specifies the ID of an object. | ||
Specifies the ID of the user. | ||
|
||
```yaml | ||
Type: System.String | ||
|