Code That I am running on azure portal
Write-Output "Starting"
$assemblyPath = "C:\Modules\Global\Azure\Compute\Microsoft.Exchange.WebServices.dll"
dir $assemblyPath
Write-Output "1"
Add-Type -Path $assemblyPath
Write-Output "2"
To load the .dll assembly, you could refer to the steps.
1.Navigate to your automation account in the portal-> Modules -> Add Module, compress the Microsoft.ApplicationInsights.dll file to Microsoft.ApplicationInsights.zip, then upload. After uploading, you will find it in the portal.
2.Change the $assemblyPath, your complete command should be as below, it will work fine.
Write-Output "Starting"
$assemblyPath = "C:\Modules\User\Microsoft.ApplicationInsights\Microsoft.ApplicationInsights.dll"
dir $assemblyPath
Write-Output "1"
Add-Type -Path $assemblyPath
Write-Output "2"
Output:
add-typecmdlet, what do your want to do next? - Ivan Yang