Logo

Documentation home for Transend tools

Import-M365Users

SYNOPSIS

Imports users into a Microsoft 365 tenant.

SYNTAX

Help (Default)

Import-M365Users [-ShowPrereqs] [<CommonParameters>]

Action

Import-M365Users -ConfigNode <String> -Csv <String> [-TranslationCsv <String>] [-IgnoreErrors]
 [-SkipValidation] [-ValidateOnly] [<CommonParameters>]

DESCRIPTION

Use the Import-M365Users cmdlet to import users into a Microsoft 365 tenant.

See the Notes section for cmdlet requirements.

EXAMPLES

Example 1: Validation only

Import-M365Users -ConfigNode Target -Csv 'users.csv' -ValidateOnly

This example validates all data for the users in the users.csv file but does not perform the operation. This is a recommended first step so any warnings can be addressed first.

Example 2: Basic import

Import-M365Users -ConfigNode Target -Csv 'users.csv'

This example imports all users from the users.csv file.

Example 3: Advanced import with translation

Import-M365Users -ConfigNode Target -Csv 'users.csv' -TranslationCsv 'translations.csv'

This example imports all users from the users.csv file. Data is translated according to the mappings provided in the translations.csv file.

PARAMETERS

-ConfigNode

The config.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

-Csv

The path to a CSV file containing objects to import. See the Notes section for the required format.

Type: String
Parameter Sets: Action
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-IgnoreErrors

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

-ShowPrereqs

Prints the cmdlet prerequisites.

Type: SwitchParameter
Parameter Sets: Help
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SkipValidation

Skips the property validation stage of the import. Data supplied in the via the -Csv parameter will be used as-is, which may lead to runtime errors.

Type: SwitchParameter
Parameter Sets: Action
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TranslationCsv

The path to the CSV file containing translation mappings. The file must use SourceName;TargetName as the field identifiers.

Type: String
Parameter Sets: Action
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ValidateOnly

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.Void

NOTES

Required PowerShell modules

  • ExchangeOnlineManagement

Required config.psd1 configurations

  • M365ClientId
  • M365ClientSecret
  • M365SharePointDomain
  • M365Tenant

Optional config.psd1 configurations

  • M365CloudEnvironment
  • StageIntermissionSeconds

Required APIs

  • Microsoft Graph

Required scopes

  • Directory.Read.All (Application)
  • Directory.ReadWrite.All (Application)

Required CSV format

Property Required Multivalue Notes
InScope True False Allowed values: Yes, True, No and False
Type True False Allowed values: UserMailbox and UserNonMailbox
DisplayName True False  
FirstName True False  
LastName True False  
LoginId True False  
CountryCode True False  
Enable True False Allowed values: Yes, True, No and False
Password True False Leave blank to generate a random password
LicensesToAdd True True Does not apply to UserNonMailbox
EmailAddress True False Does not apply to UserNonMailbox
EmailAliasesToAdd False True Does not apply to UserNonMailbox
MailboxForwardAndStoreAddressesToAdd False True Cannot be used with MailboxForwardOnlyAddressesToAdd, Does not apply to UserNonMailbox
MailboxForwardOnlyAddressesToAdd False True Cannot be used with MailboxForwardAndStoreAddressesToAdd, Does not apply to UserNonMailbox
MailboxFullAccessDelegatesToAdd False True Does not apply to UserNonMailbox
MailboxSendAsDelegatesToAdd False True Does not apply to UserNonMailbox
MailboxOnBehalfOfDelegatesToAdd False True Does not apply to UserNonMailbox
CalendarActAsDelegatesToAdd False True Automatically grants MailboxOnBehalfOfDelegatesToAdd, Does not apply to UserNonMailbox
CalendarLimitedActAsDelegatesToAdd False True Does not apply to UserNonMailbox
CalendarEditorDelegatesToAdd False True Does not apply to UserNonMailbox
CalendarReviewerDelegatesToAdd False True Does not apply to UserNonMailbox
CalendarLimitedReviewerDelegatesToAdd False True Does not apply to UserNonMailbox
CalendarAvailabilityDelegatesToAdd False True Does not apply to UserNonMailbox
  • CSV fields should be separated by semicolons. For example, InScope;Type....

  • Multivalue fields should be separated by commas. For example, value1,value2....

  • LicensesToAdd should contain SKUs of the licenses you want to add. SKUs can be retrieved using Export-M365OrgLicenses.

TMCTools configuration options