Setup
...
Microsoft Exchange Online
Test Exchange Online Connectivity
6 min
appendix a test script for exchange guid c# script to test exchange online connectivity and retrieve the exchange guid //@import system management automation; using system; using innovation activate; using innovation activate resources; using system management automation; class script scriptbase { public void main() { string upn = "user\@tenant onmicrosoft com"; guid guid = getexchangeonlineguid(upn,true); trace writeline($"{guid}"); } public guid getexchangeonlineguid(string upn, boolean returnerror) { exchangeresourceonline eol = evaluator getobject("=//resources/exchange servers/office365") as exchangeresourceonline; try { foreach (psobject o in eol exec("get mailbox", "identity", upn)) { guid guid = (guid)o properties\["exchangeguid"] value; return guid; } } catch (exception ex) { if (returnerror) throw new exception($"error retrieving exchangeguid for {upn}", ex); } return guid empty; } } appendix b orchestrator certificate test task activate task for testing certificate availability in orchestrator \<innovation activate > \<task name="test certificate available" description="" status="a" version="1"> \<parameter name="arguments" description="task arguments for the task" type="task arguments" flags="required" version="2" owner="9cea3147 e9ba 49db a1b3 867ee9beff14" ownerpriority="100">\<!\[cdata\[\<?xml version="1 0" encoding="utf 8"?>\<arguments summary="test certificate available">\</arguments>]]>\</parameter> \<parameter name="script" description="" type="script" flags="none" version="10" owner="9cea3147 e9ba 49db a1b3 867ee9beff14">\<!\[cdata\[//@import system security cryptography; using system; using innovation activate; using system security cryptography x509certificates; class script scriptbase { 	public void main() 	{ 	 // get certificate thumbprint from exchange server configuration 	 string thumbprint = evaluator getstring("=//resources/exchange servers/office365/pscertificate"); 	 if (string isnullorempty(thumbprint)) 	 { 	 logerror("thumbprint has not been configured in =//resources/exchange servers/office365/pscertificate"); 	 return; 	 } 	 // test in current user personal store (most common) 	 bool foundincurrentuser = testcertificate(thumbprint, storelocation currentuser, storename my); 	 // test in local machine personal store 	 bool foundinlocalmachine = testcertificate(thumbprint, storelocation localmachine, storename my); 	 // display results 	 logaudit($"certificate search results for thumbprint {thumbprint}"); 	 logaudit($"found in current user store {foundincurrentuser}"); 	 logaudit($"found in local machine store {foundinlocalmachine}"); 	 if (foundincurrentuser || foundinlocalmachine) 	 { 	 logaudit("certificate found and accessible"); 	 } 	 else 	 { 	 logerror("certificate not found in common locations"); 	 } 	} 	public bool testcertificate(string thumbprint, storelocation location, storename storename) 	{ 	 try 	 { 	 using (x509store store = new x509store(storename, location)) 	 { 	 store open(openflags readonly); 	 // remove any spaces or formatting from thumbprint 	 string cleanthumbprint = thumbprint replace(" ", "") toupper(); 	 x509certificate2collection certificates = store certificates find( 	 x509findtype findbythumbprint, 	 cleanthumbprint, 	 false); // false = include invalid certificates 	 if (certificates count > 0) 	 { 	 x509certificate2 cert = certificates\[0]; 	 logaudit($"found certificate in {location}/{storename} "); 	 logaudit($" subject {cert subject}"); 	 logaudit($" issuer {cert issuer}"); 	 logaudit($" valid from {cert notbefore}"); 	 logaudit($" valid to {cert notafter}"); 	 logaudit($" has private key {cert hasprivatekey}"); 	 return true; 	 } 	 return false; 	 } 	 } 	 catch (exception ex) 	 { 	 logaudit($"error accessing {location}/{storename} {ex message}"); 	 return false; 	 } 	} }]]>\</parameter> \<parameter name="web wizard" description="options for the web site" type="xml" flags="required" version="3" owner="9cea3147 e9ba 49db a1b3 867ee9beff14">\<!\[cdata\[\<?xml version="1 0" encoding="utf 8"?>\<form>\<wizard startpage="common/genericconfirm" title="#todo menu item" icon2="images/group gif">\<page name="common/genericconfirm">\<title>test certificate available\</title>\<logo> /images/big group gif\</logo>\<message>\<!\[cdata\[\<p>this task will confirm that the certificate for exchange online authentication is available to orchestrator \</p>] ]>\</message>\</page>\</wizard>\<view>\</view>\</form>]]>\</parameter> \<parameter name="workflow" description="" type="workflow" flags="none" version="1" owner="9cea3147 e9ba 49db a1b3 867ee9beff14">\<!\[cdata\[\<?xml version="1 0" encoding="utf 16"?>\<workflow>\<execute script="script" />\</workflow>]]>\</parameter> \</task> \</innovation activate> appendix c certificate availability test powershell $thumbprint = "your cert thumbprint" $store = new object system security cryptography x509certificates x509store("my", "localmachine") $store open("readonly") $cert = $store certificates | where object { $ thumbprint eq $thumbprint } if ($cert) { write output "certificate found $($cert subject)" } else { write output "certificate not found in localmachine\my store" } $store close() appendix d certificate availability test c# //@import system security cryptography; using innovation activate; using system; using system security cryptography x509certificates; class script scriptbase { public void main() { string thumbprint = "your cert thumbprint"; // replace with actual thumbprint x509store store = new x509store(storename my, storelocation localmachine); try { store open(openflags readonly); x509certificate2collection certcollection = store certificates find( x509findtype findbythumbprint, thumbprint, validonly false ); if (certcollection count > 0) { x509certificate2 cert = certcollection\[0]; trace writeline($"certificate found {cert subject}, {cert hasprivatekey}"); } else { trace writeline("certificate not found in localmachine\\\my store "); } } finally { store close(); } } }