Last active
April 21, 2021 20:32
-
-
Save davejlong/713d61e03fe679afc9e31654a4036a2e to your computer and use it in GitHub Desktop.
Revisions
-
davejlong revised this gist
Apr 21, 2021 . 1 changed file with 36 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,40 @@ ### # Author: Dave Long <[email protected]> # Date: 2021-04-21 # # Imports users from Microsoft 365 into Atera Contacts ### $AteraCustomerID = "<ATERA CUSTOMER ID>" $AteraAPIKey = "<ATERA API KEY>" ## Uncomment the below lines if you do not have PSAtera and Exchange Online PowerShell V2 Module installed # [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityPotocol -bor 3072 # Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force # Install-Module -Name PSAtera -Force # Install-Module -Name AzureAD -Force # Load in the necessary modules Import-Module -Name PSAtera Import-Module -Name AzureAD # Configure PSAtera Set-AteraAPIKey -APIKey $AteraAPIKey # Connect to Azure AD Connect-AzureAD # Get a list of all users $Users = Get-AzureADUser foreach($User in $Users) { if ($User.Mail -eq "") { return } $ContactInfo = @{ CustomerID = $AteraCustomerID Email = $User.Mail FirstName = $User.GivenName LastName = $User.SurName JobTitle = $User.JobTitle Phone = $User.TelephoneNumber } New-AteraContact @ContactInfo } -
davejlong created this gist
Jan 7, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ Import-Module PSAtera Import-Module AzureAD # Set the Customer ID in the variable below. ID can be found in the URL when you visit the customer page $CustomerID = 19 Connect-AzureAD Get-AzureADUser | Where-Object UserType -eq Member | ForEach-Object { New-AteraContact -CustomerID $CustomerID -FirstName $_.GivenName -LastName $_.Surname -JobTitle $_.JobTitle -Email $_.Mail -Phone $_.TelephoneNumber }