Imports users into a Microsoft 365 tenant.
Import-M365Users -ConfigNode <String> -Csv <String> [-TranslationCsv <String>] [-IgnoreErrors]
[-SkipValidation] [-ValidateOnly] [<CommonParameters>]
Import-M365Users [-ShowPrereqs] [<CommonParameters>]
Use the Import-M365Users
cmdlet to import users
into a Microsoft 365 tenant.
Description
This example validates all data for the users in the users.csv
file but does not perform the import. This is a recommended first step so any
warnings can be addressed prior to import.
Tenant configuration
Tenant | Direction | APIs | Scopes |
---|---|---|---|
Microsoft 365 | Target | Microsoft Graph | Directory.Read.All, Directory.ReadWrite.All |
TMCTools
@{
Target = @{
M365ClientId = '11111111-2222-3333-4444-555555555555'
M365ClientSecret = 'abcDeFghij1lMn23OpQrStUVwx4YzAbCD5EfghIJkLM='
M365Tenant = 'target.org'
}
}
Import-M365Users -ConfigNode Target -Csv 'users.csv' -ValidateOnly
Description
This example imports all users from the users.csv
file, validating all data prior to import.
Tenant configuration
Tenant | Direction | APIs | Scopes |
---|---|---|---|
Microsoft 365 | Target | Microsoft Graph | Directory.Read.All, Directory.ReadWrite.All |
TMCTools
@{
Target = @{
M365ClientId = '11111111-2222-3333-4444-555555555555'
M365ClientSecret = 'abcDeFghij1lMn23OpQrStUVwx4YzAbCD5EfghIJkLM='
M365Tenant = 'target.org'
}
}
Import-M365Users -ConfigNode Target -Csv 'users.csv'
Description
This example imports all users from the users.csv
file, validating all data prior to import. Data is translated according to the
mappings provided in the translations.csv
file.
Tenant configuration
Tenant | Direction | APIs | Scopes |
---|---|---|---|
Microsoft 365 | Target | Microsoft Graph | Directory.Read.All, Directory.ReadWrite.All |
TMCTools
@{
Target = @{
M365ClientId = '11111111-2222-3333-4444-555555555555'
M365ClientSecret = 'abcDeFghij1lMn23OpQrStUVwx4YzAbCD5EfghIJkLM='
M365Tenant = 'target.org'
}
}
Import-M365Users -ConfigNode Target -Csv 'users.csv' -TranslationCsv 'translations.csv'
The TMCTools.psd1
configuration node to use.
Type: String
Parameter Sets: Action
Aliases:
Accepted values: Source, Target
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The path to a CSV file containing users to import.
Type: String
Parameter Sets: Action
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Validation errors stop execution prior to the import by default. Use
-IgnoreErrors
to proceed with error records omitted.
Note that global errors are not impacted by this option.
Type: SwitchParameter
Parameter Sets: Action
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prints the cmdlet prerequisites.
Type: SwitchParameter
Parameter Sets: Help
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Skips the property validation stage of the import.
Type: SwitchParameter
Parameter Sets: Action
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The path to the CSV file containing translation mappings. The file must use
SourceName;TargetName
as the field identifiers.
The following fields can be translated:
Type: String
Parameter Sets: Action
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Validation and import are both performed by default. Use -ValidateOnly
to
perform the validation but skip the import.
It is recommended to run a -ValidateOnly
pass first to identify potential
issues prior to importing data. Note that records with validation errors will
fail to import unless -IgnoreErrors
is used, but records with validation
warnings proceed without the data triggering the warning. A -ValidateOnly
pass
allows you to inspect these warnings before data is written and make any
necessary changes.
Type: SwitchParameter
Parameter Sets: Action
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Install-Module ExchangeOnlineManagement -Scope CurrentUser
.Required CSV format
*InScope | *Type | *CountryCode | *DisplayName | *EmailAddress | *Enable | *FirstName | *LastName | *LoginId | #CalendarActAsDelegatesToAdd | #CalendarAvailabilityDelegatesToAdd | #CalendarEditorDelegatesToAdd | #CalendarLimitedActAsDelegatesToAdd | #CalendarLimitedReviewerDelegatesToAdd | #CalendarReviewerDelegatesToAdd | #EmailAliasesToAdd | #ForwardingAddressesToAdd | ForwardingType | #LicensesToAdd | #MailboxFullAccessDelegatesToAdd | #MailboxOnBehalfOfDelegatesToAdd | #MailboxSendAsDelegatesToAdd | Password |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Yes | UserMailbox | US | Mailbox User1 | user1@example.org | Yes | Mailbox | User1 | user1@example.org | delegate1@example.org | delegate2@example.org | delegate3@example.org | delegate4@example.org | delegate5@example.org | delegate6@example.org | user1@alias.org | forward@external.org | ForwardOnly | 3b555118-da6a-4418-894f-7df1e2096870 | delegate7@example.org | delegate8@example.org | delegate9@example.org | p@ssword1 |
Yes | UserNonMailbox | US | NonMailbox User2 | Yes | NonMailbox | User2 | user2@example.org | p@ssword2 |
CSV Notes
CSV fields should be separated by semicolons. For example,
InScope;Type...
.
Required fields are prefixed with an asterisk (*) in the example table for emphasis. Do not include the asterisk in the CSV file.
Multivalue fields are prefixed with a number sign (#) in the example table for
emphasis. Do not include the number sign in the CSV file. Multiple values in a
multivalue field should be separated by commas. For example,
value1,value2...
.
A UserNonMailbox
user is one you intend to create without a license that
includes Exchange Online. Because this type of user is not mail-enabled, none
of the CSV fields related to email apply.
The Enable
field maps to the Microsoft Entra ID Account enabled
property.
CalendarActAsDelegatesToAdd
implies MailboxOnBehalfOfDelegatesToAdd
.
ForwardingType
can be StoreAndForward
or ForwardOnly
.
LicensesToAdd
should contain SKUs of the licenses you want to add. SKUs can
be retrieved using Export-M365OrgLicenses
.
If the Password
field is left blank, a random password will be generated.
this password will be available for harvesting from the logs directory.