Avatar of CMDAI
CMDAI

asked on 

Microsoft's Azure, how to export all users including employee ID field

Is there any way to export all users with the employee ID field? The closest I could find is using the option "Bulk Operations" > "download users" but employee ID   does not get included in the download.

User generated image
Azure

Avatar of undefined
Last Comment
Saif Shaikh
Avatar of Andrei Fomitchev
Andrei Fomitchev
Flag of United States of America image

You can get Employer Id with:
    import-csv -path C:\userNames.csv |
         ForEach-Object{
             $Name = $_.Name
            Get-MsolUser -All |
                 Where-Object {$_.Name -eq $Name} |
                 Select-Object @{n=Name;e={$Name}},@{n=ObjectID;e={$_.ObjectID}}
     } | Export-CSV --Path C:\namesWithIDs.csv -NoTypeInformation

userNames.csv can be exported as described here:
https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/users-bulk-download
Avatar of CMDAI
CMDAI

ASKER

I just did a little crash course in something called CloudShell and powershell :)
Manged get the file loaded up.

I get this delimiter error I am stuck on


 import-csv -path \home\user1\userNames.csv |
>>          ForEach-Object{
>>              $Name = $_.Name
>>             Get-MsolUser -All |
>>                  Where-Object {$_.Name -eq $Name} |
>>                  Select-Object @{n=Name;e={$Name}},@{n=ObjectID;e={$_.ObjectID}}
>>      } | Export-CSV --Path \home\user1\namesWithIDs.csv -NoTypeInformation
Export-Csv:
Line |
   7 |       } | Export-CSV --Path \home\user1\namesWithIDs.csv -NoTypeInform …
     |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot bind parameter 'Delimiter'. Cannot convert value "\home\user1\namesWithIDs.csv" to type "System.Char". Error: "String must be exactly one character long."
Avatar of Saif Shaikh
Saif Shaikh
Flag of India image

Hi,
You need to quote your path.
import-csv -path '\home\user1\userNames.csv'


OR

import-csv -path "\home\user1\userNames.csv"
Avatar of CMDAI
CMDAI

ASKER

I tried with quotes, got exactly same error
Avatar of CMDAI
CMDAI

ASKER

I found the error, There was a double dash in --Path

But I got a different error now:

Line |
   6 |                    Select-Object @{n=Name;e={$Name}},@{n=ObjectID;e={$ …
     |                                      ~~~~
     | The term 'Name' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.



from my understanding that because there is name field in exported csv


userPrincipalName           :[removed]
displayName                 :[removed]
surname                     :[removed]
mail                        :[removed]
givenName                   :[removed]
id                          : 3eee5211-9999-49d4-8ef9-32120434aaaa
userType                    : Member
jobTitle                    : QC Executive
department                  : QC
accountEnabled              : True
usageLocation               : SG
streetAddress               :
state                       :
country                     :
officeLocation              :
city                        :
postalCode                  :
telephoneNumber             :
mobilePhone                 :
alternateEmailAddress       :
ageGroup                    :
consentProvidedForMinor     :
legalAgeGroupClassification :
companyName                 :
creationType                :
directorySynced             :
invitationState             :
identityIssuer              : [removed]
createdDateTime             : 9/24/2020 3:26:50 AM
ASKER CERTIFIED SOLUTION
Avatar of Saif Shaikh
Saif Shaikh
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Azure
Azure

Microsoft Azure is a cloud computing platform and infrastructure for building, deploying and managing applications and services through datacenters. It provides both platform-as-a-service (PaaS) and infrastructure-as-a-service (IaaS) services and supports many different programming languages, tools and frameworks, including both Microsoft-specific and third-party software and systems. Cloud Services is a PaaS environment and can be used to create scalable applications and services; there are specific software development kits (SDKs) provided by Microsoft for Python, Java, Node.js and .NET. Azure also has file and storage services, data management, analytics and DNS services.

11K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo