-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathaadb2c-create-user-attr.ps1
29 lines (22 loc) · 1.06 KB
/
aadb2c-create-user-attr.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
param (
[Parameter(Mandatory=$False)][Alias('o')][string]$AppDisplayName = "b2c-extensions-app", # use this for default
[Parameter(Mandatory=$True)][Alias('n')][string]$attributeName = "",
[Parameter(Mandatory=$False)][Alias('d')][string]$dataType = "String" # String, Boolean, Date
)
$appExt = Get-AzureADApplication -SearchString $AppDisplayName
New-AzureADApplicationExtensionProperty -ObjectID $appExt.objectId -DataType $dataType -Name $attributeName -TargetObjects @("User")
<#
# list all current extension attributes
Get-AzureADExtensionProperty
#>
<#
# remove a specific attribute
$fullAttrName = "extension_" + $appExt.AppId.Replace("-","") + "_$attributeName"
$attrObj = Get-AzureADExtensionProperty | where {$_.Name -eq $fullAttrName}
Remove-AzureADApplicationExtensionProperty -ObjectId $appExt.objectId -ExtensionPropertyId $attrObj.ObjectId
#>
<#
# set/get a users extension attribute
Set-AzureADUserExtension -ObjectId $User.ObjectId -ExtensionName $attrName -ExtensionValue "001002003"
Get-AzureADUserExtension -ObjectId $User.ObjectId
#>