I figured this out. Switched to importing the module as described in the blog below, removed the codeblock and invoke commands, and it worked.
https://www.codeisahighway.com/how-to-use-office-365-exchange-powershell-module-in-azure-automation/
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://redacted/powershell -Authentication Kerberos -Credential $Credential1
Import-Module (Import-PSSession -Session $Session -DisableNameChecking -AllowClobber) -Global
New-RemoteMailbox -Name ($FirstName + " " + $LastName) -FirstName $FirstName -LastName $LastName -Password $SecurePassword -UserPrincipalName $LogonName -PrimarySMTP $LogonName -OnPremisesOrganizationalUnit $OU -Archive
Set-User -Identity $LogonName -StreetAddress $StreetAddress -City $City -StateOrProvince $State -PostalCode $Zip -Office $OfficeLocation -Phone $PhoneNumber -Title $Title -Department $Department -Company $Company -CountryOrRegion "United States"
Set-RemoteMailbox -Identity $LogonName -EmailAddressPolicyEnabled $true