1
votes

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"

Output

enter image description here

Any idea on this?

1
of course it failed, there is no the path if you run from azure portal. You should run it from your local pc which can target the path you specified. - Ivan Yang
@IvanYang Means there is no way to do in azure portal - Sumit Garg
You can explain more clearly, like after add-type cmdlet, what do your want to do next? - Ivan Yang
I need to run this through using azure portal. How can I do? - Sumit Garg
@IvanYang I want to send the mail using exchange services instead of SMTP - Sumit Garg

1 Answers

1
votes

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.

enter image description here

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:

enter image description here