none
Powershell MA 5.5 for Office 365 importing ProxyAddresses or Licenses to connector space invalid-attribute-value error RRS feed

  • Question

  • Hi,

    Im using Granfeldt PowerShell MA 5.5 on Office 365.

    Trying to import some multivalued attributes from O365 into PowerShell MA CS. For example ProxyAddresses or Licenses attribute from O365.

    The Get-Schema.ps1 and Import.ps1 Should look like this by the specs.

     Get-Schema.ps1

    $Obj|Add-Member-TypeNoteProperty-Name"ProxyAddresses|String[]"-Value("","")

    Import.ps1

        $obj.Add("ProxyAddresses",$User.ProxyAddresses)

    Im getting Full Import(Stage Only) - invalid-attribute-value.

    I konw the attributes are multivalued and it should be string[]. Maybe theres something missing or O365 multivalued attributes are somehow different. Cant figure it out. Other single valued attributes import into connector space fine.

    Please help.

    Monday, September 22, 2014 5:38 PM

Answers

  • The PSMA is just doing a reflection on the object value returned so what you're seeing in the log is the type that the .NET framework sees.

    For the license type, I seem to remember that O365 presents this as an array, so maybe you could do something like this to extract the value from the Microsoft.Online.Administration.UserLicense object -

    $obj.add("license", ( $_.licensetype | select -first 1 ) )

    If you want to make sure that a value is a multivalue, you can add a comma before the value, like this

    $.obj.add("proxyaddresse", ( ,$_.proxyaddresses ) )

    The proxyAddress looks to be order from what I can see?


    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | facebook https://www.facebook.com/TheIdentityManagementExplorer | twitter at https://twitter.com/#!/MrGranfeldt

    • Marked as answer by Test3245 Wednesday, September 24, 2014 9:51 PM
    Wednesday, September 24, 2014 6:47 AM

All replies

  • Could you turn on logging and post import log?

    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | facebook https://www.facebook.com/TheIdentityManagementExplorer | twitter at https://twitter.com/#!/MrGranfeldt

    Monday, September 22, 2014 9:46 PM
  • Hi,

    Enabled logging and took one person from start of log and bit from the end. Values ProxyAddresses and Licenses are still  

    System.Collections.Generic.List`1[System.String]

    and

    System.Collections.Generic.List`1[Microsoft.Online.Administration.UserLicense]

    Is it the Powershell framework on O365 that does represent data in the form like that? Errors still the same for all entries "invalid-attribute-value"

    23.09.2014 7:36:47: Enter InvokeBeginImportWorker->OpenImportConnection
    23.09.2014 7:36:47: Getting schema
    23.09.2014 7:36:47: Type: user
    23.09.2014 7:36:47: Anchor attribute: Id
    23.09.2014 7:36:47: Attribute: Id
    23.09.2014 7:36:47: Attribute: Licenses
    23.09.2014 7:36:47: Attribute: mail
    23.09.2014 7:36:47: Attribute: IsLicensed
    23.09.2014 7:36:47: Attribute: LastName
    23.09.2014 7:36:47: Attribute: immutableId
    23.09.2014 7:36:47: Attribute: ProxyAddresses
    23.09.2014 7:36:47: Attribute: FirstName
    23.09.2014 7:36:47: Attribute: UsageLocation
    23.09.2014 7:36:47: Attribute: DisplayName
    23.09.2014 7:36:47: Enter InvokeBeginImportWorker->OpenImportConnection->InitializeConfigParameters
    23.09.2014 7:36:47: Password: *** secret ***
    23.09.2014 7:36:47: Schema Script: G:\PSMA\Get-Schema.ps1
    23.09.2014 7:36:47: Username: user.name@somewhere.com
    23.09.2014 7:36:47: Domain (impersonate): 
    23.09.2014 7:36:47: Username (impersonate): 
    23.09.2014 7:36:47: Import Script: G:\PSMA\Import.ps1
    23.09.2014 7:36:47: Export Script: G:\PSMA\Export.ps1
    23.09.2014 7:36:47: Use paged import: 0
    23.09.2014 7:36:47: Password Management Script: G:\PSMA\password.ps1
    23.09.2014 7:36:47: Export simple objects: 1
    23.09.2014 7:36:47: Leave InvokeBeginImportWorker->OpenImportConnection->InitializeConfigParameters
    23.09.2014 7:36:47: Should impersonate: False
    23.09.2014 7:36:47: Enter InvokeBeginImportWorker->OpenImportConnection->OpenRunspace
    23.09.2014 7:36:48: Runspace state: BeforeOpen
    23.09.2014 7:36:48: Opening Runspace
    23.09.2014 7:36:48: Leave InvokeBeginImportWorker->OpenImportConnection->OpenRunspace
    23.09.2014 7:36:48: Resetting pipeline results and counters
    23.09.2014 7:36:48: OpenImportRunStep Type: Full
    23.09.2014 7:36:48: OpenImportRunStep Size: 100
    23.09.2014 7:36:48: OpenImportRunStep CustomData: 
    23.09.2014 7:36:48: Leave InvokeBeginImportWorker->OpenImportConnection
    23.09.2014 7:36:48: Enter InvokeImportEntryWorker->GetImportEntries
    23.09.2014 7:36:48: Setting custom data: 
    23.09.2014 7:36:48: Setting page token: 
    23.09.2014 7:36:48: Invoking import script: G:\PSMA\Import.ps1
    23.09.2014 7:36:48: Should impersonate: False
    23.09.2014 7:37:06: Page token returned: ''
    23.09.2014 7:37:06: Custom data returned: ''
    23.09.2014 7:37:06: Object(s) in pipeline: 1
    23.09.2014 7:37:06: Non-paged import; setting MoreToImport to false
    23.09.2014 7:37:06: Start connector space object
    23.09.2014 7:37:06: DN: Some.one@somwhere.com
    23.09.2014 7:37:06: Change Type: Add/replace
    23.09.2014 7:37:06: Anchor Id: Some.one@somwhere.com
    23.09.2014 7:37:06: Processing attribute: ProxyAddresses
    23.09.2014 7:37:06: ProxyAddresses (type String, multi-value): System.Collections.Generic.List`1[System.String]
    23.09.2014 7:37:06: Adding multivalue: ProxyAddresses
    23.09.2014 7:37:06: Type: System.Collections.Generic.List`1[System.String]
    23.09.2014 7:37:06: Processing attribute: Id
    23.09.2014 7:37:06: Control value Id: Some.one@somwhere.com
    23.09.2014 7:37:06: Processing attribute: objectClass
    23.09.2014 7:37:06: Control value objectClass: user
    23.09.2014 7:37:06: Processing attribute: Licenses
    23.09.2014 7:37:06: Licenses (type String, multi-value): System.Collections.Generic.List`1[Microsoft.Online.Administration.UserLicense]
    23.09.2014 7:37:06: Adding multivalue: Licenses
    23.09.2014 7:37:06: Type: System.Collections.Generic.List`1[Microsoft.Online.Administration.UserLicense]
    23.09.2014 7:37:06: Processing attribute: FirstName
    23.09.2014 7:37:06: FirstName (type String, single-value): Some
    23.09.2014 7:37:06: Processing attribute: LastName
    23.09.2014 7:37:06: LastName (type String, single-value): One
    23.09.2014 7:37:06: Processing attribute: mail
    23.09.2014 7:37:06: mail (type String, single-value): Some.one@somwhere.com
    23.09.2014 7:37:06: Processing attribute: IsLicensed
    23.09.2014 7:37:06: IsLicensed (type Boolean, single-value): True
    23.09.2014 7:37:06: Processing attribute: immutableId
    23.09.2014 7:37:06: Skipping immutableId since value is (null)
    23.09.2014 7:37:06: Processing attribute: UsageLocation
    23.09.2014 7:37:06: UsageLocation (type String, single-value): US
    23.09.2014 7:37:06: Processing attribute: DisplayName
    23.09.2014 7:37:06: DisplayName (type String, single-value): Some One [student 134549]
    23.09.2014 7:37:06: End connector space object
    23.09.2014 7:37:06: Start connector space object
    
    23.09.2014 7:37:34: Custom data: 
    23.09.2014 7:37:34: Connector space object(s) returned: 100
    23.09.2014 7:37:34: Leave InvokeImportEntryWorker->GetImportEntries
    23.09.2014 7:37:34: Enter InvokeImportEntryWorker->GetImportEntries
    23.09.2014 7:37:34: Total connector space object(s) left: 1
    23.09.2014 7:37:34: Custom data: 
    23.09.2014 7:37:34: Connector space object(s) returned: 100
    23.09.2014 7:37:34: Leave InvokeImportEntryWorker->GetImportEntries
    23.09.2014 7:37:34: Enter CloseImportConnection
    23.09.2014 7:37:34: Enter CloseImportConnection->CloseRunspace
    23.09.2014 7:37:34: Closing Runspace
    23.09.2014 7:37:34: Leave CloseImportConnection
    23.09.2014 7:37:34: CustomData: 
    23.09.2014 7:37:34: Close reason: Normal
    23.09.2014 7:37:34: Leave CloseImportConnection


    • Edited by Test3245 Tuesday, September 23, 2014 8:03 AM typo
    Tuesday, September 23, 2014 8:01 AM
  • The PSMA is just doing a reflection on the object value returned so what you're seeing in the log is the type that the .NET framework sees.

    For the license type, I seem to remember that O365 presents this as an array, so maybe you could do something like this to extract the value from the Microsoft.Online.Administration.UserLicense object -

    $obj.add("license", ( $_.licensetype | select -first 1 ) )

    If you want to make sure that a value is a multivalue, you can add a comma before the value, like this

    $.obj.add("proxyaddresse", ( ,$_.proxyaddresses ) )

    The proxyAddress looks to be order from what I can see?


    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | facebook https://www.facebook.com/TheIdentityManagementExplorer | twitter at https://twitter.com/#!/MrGranfeldt

    • Marked as answer by Test3245 Wednesday, September 24, 2014 9:51 PM
    Wednesday, September 24, 2014 6:47 AM
  • Hi,

                    Thank you Søren! I got some good clues for the right direction from your answer. If anyone would be looking same answers the correct solution would be down below. I hope it would be help for someone else too.

    Get-Shema.ps1

    $obj = New-Object -Type PSCustomObject

    $obj | Add-Member -Type NoteProperty -Name "Anchor-Id|String" -Value 1

    $obj | Add-Member -Type NoteProperty -Name "objectClass|String" -Value "user"

    $Obj | Add-Member -Type NoteProperty -Name "IsLicensed|Boolean" -Value $true

    $Obj | Add-Member -Type NoteProperty -Name "FirstName|String" -Value ""

    $Obj | Add-Member -Type NoteProperty -Name "LastName|String" -Value ""

    $Obj | Add-Member -Type NoteProperty -Name "mail|String" -Value ""

    $Obj | Add-Member -Type NoteProperty -Name "immutableId|String" -Value ""

    $Obj | Add-Member -Type NoteProperty -Name "DisplayName|String" -Value ""

    $Obj | Add-Member -Type NoteProperty -Name "UsageLocation|String" -Value ""

    $Obj | Add-Member -Type NoteProperty -Name "ProxyAddresses|String[]" -Value ("","")

    $Obj | Add-Member -Type NoteProperty -Name "Licenses|String[]" -Value ("","")

    $obj

     

    Import.ps1

    #Always pass objects as hash table in pipeline

    foreach ($User in $Users)

    {

        $obj = @{}

        $obj.Add("Id", $User.UserPrincipalName)

        $obj.Add("objectClass", "user")

        $obj.Add("IsLicensed", $User.IsLicensed)

        $obj.Add("FirstName", $User.FirstName)

        $obj.Add("LastName", $User.LastName)

        $obj.Add("mail", $User.UserPrincipalName)

        $obj.Add("immutableId", $User.immutableId)

        $obj.Add("DisplayName", $User.DisplayName)

        $obj.Add("UsageLocation", $User.UsageLocation)

        $obj.Add("ProxyAddresses", ($User.ProxyAddresses -ne ""))

        $obj.add("Licenses", ($User.Licenses.AccountSkuId))

        $obj

    }

    Marti

    Wednesday, September 24, 2014 10:03 PM