<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Master &#38; CmdR</title>
	<atom:link href="https://masterandcmdr.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://masterandcmdr.com</link>
	<description>Cloudy with a chance of Hybrid</description>
	<lastBuildDate>Tue, 04 Jul 2023 15:41:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>

<image>
	<url>https://masterandcmdr.com/wp-content/uploads/2018/12/cloudy-square.png?w=32</url>
	<title>Master &#38; CmdR</title>
	<link>https://masterandcmdr.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">155420626</site><cloud domain='masterandcmdr.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<atom:link rel="search" type="application/opensearchdescription+xml" href="https://masterandcmdr.com/osd.xml" title="Master &#38; CmdR" />
	<atom:link rel='hub' href='https://masterandcmdr.com/?pushpress=hub'/>
	<item>
		<title>Cannot Delete a Mailbox with Retention Policies Enabled</title>
		<link>https://masterandcmdr.com/2020/04/24/cannot-delete-a-mailbox-with-retention-policies-enabled/</link>
					<comments>https://masterandcmdr.com/2020/04/24/cannot-delete-a-mailbox-with-retention-policies-enabled/#comments</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Sat, 25 Apr 2020 01:44:05 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[legal hold]]></category>
		<category><![CDATA[Retention]]></category>
		<category><![CDATA[Retention Policies]]></category>
		<category><![CDATA[security and compliance]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4381</guid>

					<description><![CDATA[I ran into a weird issue this week where I was trying to forcibly remove a deleted (inactive) mailbox, and was getting the following error: &#8220;The user mailbox couldn&#8217;t be permanently deleted. The user mailbox has at least one type of hold or hold policy applied to it.&#8221; The annoying thing about it was that &#8230; <a href="https://masterandcmdr.com/2020/04/24/cannot-delete-a-mailbox-with-retention-policies-enabled/" class="more-link">Continue reading <span class="screen-reader-text">Cannot Delete a Mailbox with Retention Policies&#160;Enabled</span></a>]]></description>
										<content:encoded><![CDATA[
<p>I ran into a weird issue this week where I was trying to forcibly remove a deleted (inactive) mailbox, and was getting the following error:</p>



<p><em>&#8220;The user mailbox couldn&#8217;t be permanently deleted. The user mailbox has at least one type of hold or hold policy applied to it.&#8221;</em></p>



<figure class="wp-block-image size-large"><img width="1024" height="195" data-attachment-id="4388" data-permalink="https://masterandcmdr.com/image-2-2/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png" data-orig-size="1899,363" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-2" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=685" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=1024" alt="" class="wp-image-4388" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=1024 1024w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=300 300w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=768 768w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=1440 1440w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png 1899w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>The annoying thing about it was that this mailbox fell under a retention policy in the Security &amp; Compliance Center &#8211; which are great, don&#8217;t get me wrong &#8211; but one of my biggest concerns with using these retention policies is that you can&#8217;t easily tell which mailboxes fall under this hold:</p>



<figure class="wp-block-image size-large"><img width="545" height="147" data-attachment-id="4384" data-permalink="https://masterandcmdr.com/image/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image.png" data-orig-size="545,147" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image.png?w=545" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image.png?w=545" alt="" class="wp-image-4384" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image.png 545w, https://masterandcmdr.com/wp-content/uploads/2020/04/image.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image.png?w=300 300w" sizes="(max-width: 545px) 100vw, 545px" /></figure>



<p>I found a few blog posts out there that mentioned different approaches of identifying these mailboxes with PowerShell, but none of them were working for me &#8211; all I was getting was that the policy applied to &#8216;All&#8217;. Not very useful at all!</p>



<p>I tried several approaches including trying to exclude the mailbox from the retention policy (didn’t work), applying litigation hold and removing it (no dice), and then I was going to attempt to restore the mailbox, remove it from the policy, and then delete it again – thankfully, I found a better way! There’s an <strong><em>-IgnoreLegalHold </em></strong>switch you can use, which will still allow you to delete the offending mailboxes:</p>



<figure class="wp-block-image size-large"><img width="851" height="68" data-attachment-id="4390" data-permalink="https://masterandcmdr.com/image-4/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png" data-orig-size="851,68" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-4" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png?w=685" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png?w=851" alt="" class="wp-image-4390" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png 851w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png?w=300 300w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png?w=768 768w" sizes="(max-width: 851px) 100vw, 851px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="78" data-attachment-id="4385" data-permalink="https://masterandcmdr.com/image-1/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png" data-orig-size="1469,113" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-1" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=685" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=1024" alt="" class="wp-image-4385" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=1024 1024w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=300 300w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=768 768w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=1440 1440w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png 1469w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now, you&#8217;d think I was done, but not quite! Two of the four mailboxes hadn&#8217;t been properly deleted from the Deleted Users container in Azure AD, so Exchange would not allow me to delete the mailboxes:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="149" data-attachment-id="4389" data-permalink="https://masterandcmdr.com/image-3/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png" data-orig-size="1846,270" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-3" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=685" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=1024" alt="" class="wp-image-4389" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=1024 1024w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=300 300w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=768 768w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=1440 1440w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png 1846w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Thankfully, this one is a bit easier &#8211; I&#8217;ve had to do this one quite often. Start out by searching for your deleted users &#8211; in this case I used a search string, because as you can sort of see from the screenshot below, I had two identical users in Azure AD &#8211; same Display name, same User Principal Name, and of course&#8230; Different Object Ids.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="99" data-attachment-id="4391" data-permalink="https://masterandcmdr.com/image-5/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png" data-orig-size="1086,105" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-5" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=685" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=1024" alt="" class="wp-image-4391" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=1024 1024w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=300 300w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=768 768w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png 1086w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now that I had my object Ids, I could safely go in and remove them &#8211; it&#8217;s always a good idea to use the Object Ids or Exchange GUIDs, because you know you&#8217;re targeting the object directly, and there&#8217;s no chance of an ambiguous name coming back and biting you in the butt. Measure twice and cut once!</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="747" height="40" data-attachment-id="4392" data-permalink="https://masterandcmdr.com/image-6/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png" data-orig-size="747,40" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-6" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png?w=685" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png?w=747" alt="" class="wp-image-4392" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png 747w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png?w=300 300w" sizes="(max-width: 747px) 100vw, 747px" /></figure>



<p>After about 10 minutes or so, I was able to delete both of those mailboxes in Exchange Online:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="877" height="42" data-attachment-id="4393" data-permalink="https://masterandcmdr.com/image-7/" data-orig-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png" data-orig-size="877,42" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-7" data-image-description="" data-image-caption="" data-medium-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png?w=300" data-large-file="https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png?w=685" src="https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png?w=877" alt="" class="wp-image-4393" srcset="https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png 877w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png?w=150 150w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png?w=300 300w, https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png?w=768 768w" sizes="(max-width: 877px) 100vw, 877px" /></figure>



<p>Definitely a bit of a puzzler, but all sorted out now with another tool in my PowerShell toolbelt – hope this helps someone who is scratching their head trying to figure it out!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2020/04/24/cannot-delete-a-mailbox-with-retention-policies-enabled/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4381</post-id>
		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image-2.png?w=1024" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image.png?w=545" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image-4.png?w=851" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image-1.png?w=1024" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image-3.png?w=1024" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image-5.png?w=1024" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image-6.png?w=747" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2020/04/image-7.png?w=877" medium="image" />
	</item>
		<item>
		<title>Force Teams to Sign Out</title>
		<link>https://masterandcmdr.com/2019/03/27/force-teams-to-sign-out/</link>
					<comments>https://masterandcmdr.com/2019/03/27/force-teams-to-sign-out/#comments</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Thu, 28 Mar 2019 04:48:32 +0000</pubDate>
				<category><![CDATA[Azure AD]]></category>
		<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Force Signout]]></category>
		<category><![CDATA[Logoff]]></category>
		<category><![CDATA[Teams]]></category>
		<category><![CDATA[Token Lifetime]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4264</guid>

					<description><![CDATA[Token Resistance I ran into an interesting scenario yesterday during a tenant migration where users from tenant A were successfully migrated to Tenant B, but their accounts remained logged into Teams &#8211; even changing the user account names to their onmicrosoft.com domain and removing their Teams license wouldn&#8217;t force them to log out… talk about &#8230; <a href="https://masterandcmdr.com/2019/03/27/force-teams-to-sign-out/" class="more-link">Continue reading <span class="screen-reader-text">Force Teams to Sign&#160;Out</span></a>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><span style="color:#2e75b5;font-family:Calibri;font-size:14pt;">Token Resistance</span></h2>



<p><span style="font-family:Calibri Light;">I ran into an interesting scenario yesterday during a tenant migration where users from tenant A were successfully migrated to Tenant B, but their accounts remained logged into Teams &#8211; even changing the user account names to their onmicrosoft.com domain and removing their Teams license wouldn&#8217;t force them to log out… talk about a token that won&#8217;t quit!<br>
</span></p>



<p><span style="font-family:Calibri Light;">The goal here was that the users would log out of Teams &#8211; and since their old UPNs were changed behind the scenes &#8211; when they tried to log back in using their regular username and password, they&#8217;d be passed into the new tenant instead of remaining in the old one. However, this was not happening, and users were remaining signed in to the old tenant &#8211; very frustrating!<br>
</span></p>



<h2 class="wp-block-heading"><span style="color:#2e75b5;font-family:Calibri;font-size:14pt;">Initiate Sign-out (the Ctrl-Alt-Del of the cloud)</span></h2>



<p><span style="font-family:Calibri Light;">Now, you should normally be able to force this logout by going to the admin portal, clicking on the user account, then the OneDrive tab, and using the <strong><em>Initiate sign-out </em></strong>option:<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/6aaa6-032819_0448_forceteamst1.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">In fact, this was a step that was already tried by the team working on the migration (and it didn&#8217;t work), before the question even made it across my inbox to see if there was a way I could help force the logout and get this migration wrapped up successfully. This was indeed puzzling, as my expectation was that initiating a one-time sign-out like this would indeed work across <strong><em>all</em></strong> sessions, the way it promised, so I needed to do some testing, and some research!<br>
</span></p>



<p><span style="font-family:Calibri Light;">First off, it turns out that the sign-out option does work &#8211; it just takes a while. In my initial testing, web sessions, Office clients, mobile clients, etc. will log out within 5-15 minutes, as promised. However, the Teams client holds on to that token a lot longer after it&#8217;s been invalidated and will not sign out until after an hour. Now, that&#8217;s not horrible, but it&#8217;s still not going to give me the controlled experience that I was looking for, so I needed to dive a little deeper &#8211; especially as I wanted PowerShell options… no way would I click through hundreds of users to make this happen!<br>
</span></p>



<h2 class="wp-block-heading"><span style="color:#1e4e79;font-family:Calibri;font-size:16pt;">Force Kick &#8211; the Way of the Shell</span></h2>



<p><span style="font-family:Calibri Light;">To do this through PowerShell, you first need to have the Azure AD Preview module installed &#8211; if you don&#8217;t have it on your system already, open an admin shell and install it by using the <strong><em>Install-Module AzureADPreview </em></strong>command. After that, you can go ahead and connect to Azure AD using <strong><em>Connect-AzureAD</em></strong>, and logging in as normal.<br>
</span></p>



<p><span style="font-family:Calibri Light;">First thing to do is find your user, and see when their current access token is valid from, like so:<br>
</span></p>



<pre class="wp-block-code"><code>Get-AzureADUser -SearchString "Lester Tester" | Select *token*</code></pre>



<p><span style="font-family:Calibri Light;">This will return the <strong><em>RefreshTokensValidFromDateTime</em></strong>, which essentially tells you that any token issued AFTER this date/time is valid &#8211; note that the time is in UTC, so you&#8217;ll need to adjust for your own time zone.<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/4601f-032819_0448_forceteamst2.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">So far this is just informational, but still useful &#8211; especially if you want to find any users you might have missed, or who still have old tokens sticking around. Now, to revoke this access token, simply use the following command:<br>
</span></p>



<pre class="wp-block-code"><code>Get-AzureADUser -SearchString "Lester Tester" | Revoke-AzureADUserAllRefreshToken</code></pre>



<p><span style="font-family:Calibri Light;">This command won&#8217;t return anything in the Shell, but if you run the Get-AzureADUser command from above one more time, you should see that your refresh token validation date has been set to the current date and time (again, don&#8217;t forget you need to convert from UTC to your own time zone &#8211; very annoying!!).<br>
</span></p>



<p><span style="font-family:Calibri Light;">Now that we have the PowerShell basics down, we can easily take this command and scale it out to as many users as we want by filtering on an available attribute &#8211; let&#8217;s take for instance, the Test family in my tenant:<br>
</span></p>



<pre class="wp-block-code"><code>Get-AzureADUser | ? {$_.DisplayName -match "Test"}  | Select DisplayName,RefreshTokensValidFromDateTime</code></pre>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/fc460-032819_0448_forceteamst3.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">Once you have your filter working the way you want, just go ahead and re-run that command and pipe it out to the Revoke command:<br>
</span></p>



<pre class="wp-block-code"><code>Get-AzureADUser | ? {$_.DisplayName -match "Test"} | Revoke-AzureADUserAllRefreshToken</code></pre>



<p><span style="font-family:Calibri Light;">If you run your Get command again, you can see that all our users in scope have had their old tokens invalidated:<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/30f7a-032819_0448_forceteamst4.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">Now we have a process set that we can scale out and revoke the tokens for hundreds or even thousands of users if we need to. However, that still didn&#8217;t solve our timing problem, so I logged in to the Azure AD portal to see if there was somewhere else that I could make this sign-out happen when I wanted it to, and not after an hour (or whenever Teams felt like letting go of its token). Unfortunately, there is not any other magic kill switch in the Azure AD portal, but I did discover something interesting &#8211; both running the initiate sign-out option, and revoking the access token through PowerShell do the exact same thing, but with different actors initiating the change:<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/be4d7-032819_0448_forceteamst5.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">Sadly, this doesn&#8217;t really get us any closer to the final answer &#8211; it simply tells me that either method is essentially doing the same thing behind the scenes, and you should have the exact same experience in both cases. Now let&#8217;s see what we can do about that delay!<br>
</span></p>



<h2 class="wp-block-heading"><span style="color:#1e4e79;font-family:Calibri;font-size:16pt;">Tweaking that Token</span></h2>



<p><span style="font-family:Calibri Light;">I knew that some time back, Microsoft had introduced the option to <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes">configure token lifetimes</a>, so I wanted to see if there was a way I could shorten that process, and get these Teams users logged out when I wanted, not lingering around on the old tenant the way they were. If you check the link above, you can find a lot of interesting info about this whole process, but here&#8217;s a handy reference to the defaults, and what they can be changed to:<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/6e4ef-032819_0448_forceteamst6.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">Seeing that I could get my tokens down as low as 10 minutes was starting to sound a lot more interesting to me, so I wanted to build this out and do some more testing. Here&#8217;s what I did:<br>
</span></p>



<p><span style="font-family:Calibri Light;">Start by checking to see which policies you have in place by using <strong><em>Get-AzureADPolicy</em></strong>. If your tenant is like mine, it probably looks like this:<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/29d1f-032819_0448_forceteamst7.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">By default, there are no Token Lifetime Policies in place, so we&#8217;re going to go ahead and create one.<br></span></p>



<pre class="wp-block-code"><code>New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"00:10:00","MaxInactiveTime":"00:10:00"}}') -DisplayName "OrganizationDefaultPolicyScenario" -IsOrganizationDefault $true -Type "TokenLifetimePolicy"</code></pre>



<p><span style="font-family:Calibri Light;">Voila:<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/a27ab-032819_0448_forceteamst8.png" alt="" /></figure>



<p><span style="font-family:Calibri Light;">Make note of your policy ID so that you can use it to target this policy if you want to update it (using <strong><em>Set-AzureADPolicy</em></strong>) or delete it (using <strong><em>Remove-AzureADPolicy</em></strong>). Now that our Access Token Lifetime and Max Inactive Time were both set to 10 minutes, I tested again revoking an access token with a user that was signed into Outlook on the Web, Teams in a different browser, the Teams desktop client, and Teams on a mobile device.<br>
</span></p>



<p><span style="font-family:Calibri Light;">Here&#8217;s how they behaved:<br>
</span></p>



<ol class="wp-block-list"><li><span style="font-family:Calibri Light;">Outlook on the Web: <strong>logged out immediately</strong><br>
</span></li><li><span style="font-family:Calibri Light;">Teams Web &amp; Mobile: <strong>logged out about 2 minutes later</strong><br>
</span></li><li><span style="font-family:Calibri Light;">Teams Desktop: <strong>logged out in less than 5 minutes</strong><br>
</span></li></ol>



<p><span style="font-family:Calibri Light;">Sweet, sweet victory!<br>
</span></p>



<figure class="wp-block-image"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/b7045-032819_0448_forceteamst9.png" alt="" /></figure>



<h2 class="wp-block-heading"><span style="color:#1e4e79;font-family:Calibri;font-size:16pt;">Final thoughts<br>
</span></h2>



<p><span style="font-family:Calibri Light;">After all this fun, here&#8217;s a couple of things to keep in mind:<br>
</span></p>



<p> You can revert your settings to default by either deleting the policy you created, or by using the following PowerShell command: </p>



<pre class="wp-block-code"><code>New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"00:10:00","MaxInactiveTime":"00:10:00"}}') -DisplayName "OrganizationDefaultPolicyScenario" -IsOrganizationDefault $true -Type "TokenLifetimePolicy"
</code></pre>



<p><span style="font-family:Calibri Light;">If for some reason you need to keep your existing policy in place, just target it using the <strong><em>Set-AzureADPolicy </em></strong>command, and update the pieces you need to change &#8211; worst-case scenario, delete the policy and create it fresh using the command above. <a href="https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/Changes-to-the-Token-Lifetime-Defaults-in-Azure-AD/ba-p/245304">(more info here)</a></span></p>



<p>I&#8217;m not 100% sure of the impact of running your long term with your access tokens refreshing this quickly &#8211; I assume that if Microsoft is allowing you to change the token lifetimes down to 10 minutes, that it&#8217;s acceptable to do so. I did run for a couple of hours like this without any adverse side effects, but that&#8217;s in my test tenant, not a production environment. If I needed to fulfill the scenario that started this whole thing, I&#8217;d probably change my token lifetime policy a day or two before my migration cutover so that all the users would be revoked immediately upon cutover. After that, I&#8217;d personally set it back to defaults unless I had a compelling reason to keep the lifetime shorter.</p>



<p>Also, I wouldn&#8217;t waste too much time with this, as they&#8217;ve already announced that they&#8217;re deprecating this feature and instead moving it to a conditional access policy. No clue what that looks like yet but know that it&#8217;s coming.</p>



<p><span style="font-family:Calibri Light;"><br> </span> </p>



<p><span style="font-family:Calibri Light;">All in all, an intriguing problem, and a fun trip to the solution &#8211; hope this helps someone else! Feel free to leave a comment below if you have any questions, or to let me know if any of this was helpful. <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br>
</span></p>



<p><span style="font-family:Calibri Light;">&nbsp;</span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2019/03/27/force-teams-to-sign-out/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4264</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2019/03/29967-teams-loves-powershell-e1553750321171.jpg" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/29967-teams-loves-powershell-e1553750321171.jpg" medium="image">
			<media:title type="html">Teams loves PowerShell</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/6aaa6-032819_0448_forceteamst1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/4601f-032819_0448_forceteamst2.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/fc460-032819_0448_forceteamst3.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/30f7a-032819_0448_forceteamst4.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/be4d7-032819_0448_forceteamst5.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/6e4ef-032819_0448_forceteamst6.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/29d1f-032819_0448_forceteamst7.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/a27ab-032819_0448_forceteamst8.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/b7045-032819_0448_forceteamst9.png" medium="image" />
	</item>
		<item>
		<title>PowerShell: Manage Privileged Roles (PIM)</title>
		<link>https://masterandcmdr.com/2019/02/12/powershell-manage-privileged-roles-pim/</link>
					<comments>https://masterandcmdr.com/2019/02/12/powershell-manage-privileged-roles-pim/#comments</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Tue, 12 Feb 2019 23:57:00 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Azure AD Premium]]></category>
		<category><![CDATA[AzureAD]]></category>
		<category><![CDATA[Office365]]></category>
		<category><![CDATA[PIM]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4223</guid>

					<description><![CDATA[Edit: The PIM PowerShell module has been deprecated now, and you need to use the Graph API to elevate PIM roles.  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; I&#8217;ve done some work recently with Azure AD Privileged Identity Management, and I wanted to find a way to streamline the request process for an administrator who needs to run some PowerShell scripts or &#8230; <a href="https://masterandcmdr.com/2019/02/12/powershell-manage-privileged-roles-pim/" class="more-link">Continue reading <span class="screen-reader-text">PowerShell: Manage Privileged Roles&#160;(PIM)</span></a>]]></description>
										<content:encoded><![CDATA[<p><strong>Edit: </strong><strong>The PIM PowerShell module has been deprecated now, and you need to use the <a href="https://learn.microsoft.com/en-us/azure/active-directory/privileged-identity-management/pim-how-to-activate-role#activate-a-role-using-microsoft-graph-api">Graph API to elevate PIM roles</a>. </strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</strong></p>
<p><span style="font-family: Calibri Light">I&#8217;ve done some work recently with <a href="https://docs.microsoft.com/en-us/azure/active-directory/privileged-identity-management/pim-configure">Azure AD Privileged Identity Management</a>, and I wanted to find a way to streamline the request process for an administrator who needs to run some PowerShell scripts or commands so that the whole request/approval process can be simplified and streamlined.<br />
</span></p>
<p><span style="color: #2e75b5;font-family: Calibri;font-size: 14pt">Enabling Privileged Identity Management<br />
</span></p>
<p><span style="font-family: Calibri Light">Note that if you haven&#8217;t activated or configured PIM for your tenant yet, you need to have Azure AD Premium P2 to enable and use this feature.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/8b760-031219_2356_powershellm1.png" alt="" /></p>
<p><span style="font-family: Calibri Light">If you don&#8217;t have Azure AD P2 on your tenant, you can add a 30 day trial that will allow you to configure PIM and start checking out the functionality. You&#8217;ll need to assign the AAD P2 license to everyone that needs to interact with PIM &#8211; both approvers and requesters. After you&#8217;ve activated AAD P2, come back and refresh the PIM sign-up blade, and complete the sign up process.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/a2a63-031219_2356_powershellm2.png" alt="" /></p>
<p><span style="color: #2e75b5;font-family: Calibri;font-size: 14pt">Activating a Privileged Role &#8211; GUI Style<br />
</span></p>
<p><span style="font-family: Calibri Light">Once you roles have been assigned and configured, you would typically need to navigate to the Azure Portal (<a href="https://portal.azure.com/">https://portal.azure.com/#blade/Microsoft_Azure_PIM/CommonMenuBlade/QuickStart</a>), then to the PIM blade, and then click on your eligible roles, and then click through the Activation process.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/7bb9a-031219_2356_powershellm3.png" alt="" /></p>
<p><span style="font-family: Calibri Light">After the request has been submitted, you need to wait for approval &#8211; or you can start working if auto-approval is configured for that role.<br />
</span></p>
<h2><span style="color: #2e75b5;font-size: 14pt">PowerShell and the PIM Module<br />
</span></h2>
<p><span style="font-family: Calibri Light">Thankfully, we can use PowerShell to automate this request process &#8211; it takes a few moments to install the PIM PowerShell module due to it being published on the <a href="https://www.powershellgallery.com/packages/Microsoft.Azure.ActiveDirectory.PIM.PSModule">PowerShell Gallery</a>.<br />
</span></p>
<p><span style="font-family: Calibri Light">From an admin prompt, run the following command:</span></p>
<p><span style="color: blue;font-family: Lucida Console;font-size: 9pt"><span style="background-color: white">Install-Module <span style="color: blueviolet">Microsoft.Azure.ActiveDirectory.PIM.PSModule</span></span><br />
</span></p>
<p><span style="font-family: Calibri Light">Once the module is installed, you can view all your available commands using Get-Command:</span></p>
<p><span style="color: blue;font-family: Lucida Console;font-size: 9pt"><span style="background-color: white">Get-Command <span style="color: navy">-Module <span style="color: blueviolet">Microsoft.Azure.ActiveDirectory.PIM.PSModule</span></span></span><br />
</span></p>
<p><span style="font-family: Calibri Light">There&#8217;s not that many commands included in the module, but we still have all we need for this little task of ours:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/dff9a-031219_2356_powershellm4.png" alt="" /></p>
<p><span style="color: #666666;font-family: Calibri Light"><span style="background-color: white">Now that you&#8217;re all ready to go, connect to the PIM Service using <strong>Connect-PimService. </strong>The connect command supports both the <strong><em>-credentials</em></strong> and the <strong><em>-username</em></strong> switch. </span><br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light"><span style="background-color: white">Using <strong><em>-credentials</em></strong> allows you to capture and store the admin creds and connect using basic authentication:</span><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/7b975-031219_2356_powershellm5.png" alt="" /></p>
<p><span style="color: #666666;font-family: Calibri Light"><span style="background-color: white">The &#8211;<strong><em>username</em></strong> switch will start the connection process using modern authentication.</span><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/88314-031219_2356_powershellm6.png" alt="" /></p>
<p><span style="color: #666666;font-family: Calibri Light"><span style="background-color: white">Don&#8217;t forget that you&#8217;ll need to use the Modern Auth path if you have MFA enabled on your account, but you can still use basic auth if there&#8217;s no MFA in the picture. </span><br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light"><span style="background-color: white">Now that we&#8217;re connected, get a list of all the privileged roles assigned to you by running <strong><em>Get-PrivilegedRoleAssignment</em></strong>.</span><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/ee93d-031219_2356_powershellm7.png" alt="" /></p>
<p><span style="color: #2e75b5;font-family: Calibri;font-size: 14pt">Putting it all together<br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">Ok, now we have all the pieces we need, let&#8217;s apply this process to a real-world scenario. Let&#8217;s say I have a number of Exchange scripts that I use on a regular basis, and I don&#8217;t want to go in to the Azure Portal to request elevation every time I need to run a script. Simply incorporate the following commands into your Exchange scripts:</span><br />
</span></p>
<p><span style="color: darkgreen;font-family: Lucida Console;font-size: 9pt"><span style="background-color: white"># Connect to the PIM Service</span><br />
</span></p>
<p><span style="color: blue;font-family: Lucida Console;font-size: 9pt"><span style="background-color: white">Connect-PimService</span><br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">Connecting like this will open an interactive auth window for you to type in your username and password (Modern Auth) &#8211; don&#8217;t forget to add the <strong><em>-username</em></strong> or <strong><em>-credentials</em></strong> if you want to reduce the typing you need to do when authenticating.</span><br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">From the list above, we already know that the role ID for Exchange Administrator is 29232cdf-9323-42fd-ade2-1d097af3e4de, so we&#8217;re going to use that in our elevation request:</span><br />
</span></p>
<p><span style="color: blue;font-family: Lucida Console;font-size: 9pt"><span style="background-color: white">Enable-PrivilegedRoleAssignment <span style="color: navy">-RoleId <span style="color: blueviolet">29232cdf-9323-42fd-ade2-1d097af3e4de <span style="color: navy">-Reason <span style="color: darkred">&#8220;I need to update transport rules&#8221; </span></span></span></span></span><br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">You can easily update this command to use target whatever RoleId you need to activate, and even provide your reason at the same time. Since we&#8217;re activating an admin role, you&#8217;ll be prompted for MFA (another setting you can configure in PIM):</span><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/fe288-031219_2356_powershellm8.png" alt="" /></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">If you&#8217;re curious to check, you can now verify that your role has been assigned, and you can <a href="https://masterandcmdr.com/powershell-connect-to-exchange-online-mfa-style/">initiate your Exchange connection</a>:</span><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/82f7e-031219_2356_powershellm9.png" alt="" /></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">When you&#8217;re finished running your scripts, you can easily disable your Role Assignment like so:</span><br />
</span></p>
<p><span style="color: blue;font-family: Lucida Console;font-size: 9pt"><span style="background-color: white">Disable-PrivilegedRoleAssignment <span style="color: navy">-RoleId <span style="color: blueviolet">29232cdf-9323-42fd-ade2-1d097af3e4de </span></span></span><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/7261a-031219_2356_powershellm10.png" alt="" /></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">You don&#8217;t have to add the disconnect piece if you don&#8217;t want to, since your admin access should be configured to age out automatically &#8211; I just like the idea of holding to the Just In Time ideology, and disabling my elevated role as soon as I&#8217;m finished my tasks. This reduces your risk even further, as your admin access will only be assigned for the duration of your scripts, and then your account goes back to normal right afterwards. </span><br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"><span style="background-color: white">Nice and clean, nice and quick! <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span><br />
</span></p>
<p><span style="color: #666666;font-family: Calibri Light;font-size: 11pt"> </span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2019/02/12/powershell-manage-privileged-roles-pim/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4223</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2019/03/32e0d-powershell-party.png" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/32e0d-powershell-party.png" medium="image">
			<media:title type="html">Powershell-Party</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/8b760-031219_2356_powershellm1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/a2a63-031219_2356_powershellm2.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/7bb9a-031219_2356_powershellm3.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/dff9a-031219_2356_powershellm4.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/7b975-031219_2356_powershellm5.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/88314-031219_2356_powershellm6.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/ee93d-031219_2356_powershellm7.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/fe288-031219_2356_powershellm8.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/82f7e-031219_2356_powershellm9.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/7261a-031219_2356_powershellm10.png" medium="image" />
	</item>
		<item>
		<title>Calgary Azure Meetup</title>
		<link>https://masterandcmdr.com/2019/02/02/calgary-azure-meetup/</link>
					<comments>https://masterandcmdr.com/2019/02/02/calgary-azure-meetup/#respond</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Sat, 02 Feb 2019 19:07:35 +0000</pubDate>
				<category><![CDATA[Azure AD]]></category>
		<category><![CDATA[Office 365]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[AzureAD]]></category>
		<category><![CDATA[Meetup]]></category>
		<category><![CDATA[Office365]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4208</guid>

					<description><![CDATA[I had a great time presenting at the 10th Calgary meetup recently hosted at our Calgary office &#8211; I always find these user groups to be an awesome chance to meet other professionals in the industry, and to hear some of the cool things that other folks are working on. Presenting like this is one &#8230; <a href="https://masterandcmdr.com/2019/02/02/calgary-azure-meetup/" class="more-link">Continue reading <span class="screen-reader-text">Calgary Azure Meetup</span></a>]]></description>
										<content:encoded><![CDATA[<p><span style="font-family:Calibri Light;">I had a great time presenting at the <a href="https://www.meetup.com/Calgary-Azure-Meetup/events/257862883/">10th Calgary meetup</a> recently hosted at our Calgary office &#8211; I always find these user groups to be an awesome chance to meet other professionals in the industry, and to hear some of the cool things that other folks are working on.<br />
</span></p>
<p><img class="" src="https://masterandcmdr.com/wp-content/uploads/2019/03/63a08-031219_1907_calgaryazur1.png" alt="" width="870" height="364" /></p>
<p><span style="font-family:Calibri Light;">Presenting like this is one of the things I love most about being an MVP &#8211; we work in an industry full of smart people, and I often learn new things even while talking about technology I already know! There was a great turnout, lots of great questions and feedback &#8211; overall, a really fun night <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
</span></p>
<p><span style="font-family:Calibri Light;">I promised I&#8217;d post a link to my presentation if anyone is interested &#8211; here it is:<br />
</span></p>
<p><a href="https://1drv.ms/p/s!Am-o8KtTO4XtjfR43gfETCeiaHYm-A"><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/61c2e-031219_1907_calgaryazur3.png" alt="" border="0" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2019/02/02/calgary-azure-meetup/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4208</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2019/02/5c0dd-2019-03-12_11-41-34.jpg" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/02/5c0dd-2019-03-12_11-41-34.jpg" medium="image">
			<media:title type="html">Azure Active Directory</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/63a08-031219_1907_calgaryazur1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/61c2e-031219_1907_calgaryazur3.png" medium="image" />
	</item>
		<item>
		<title>PowerShell: Bulk Forwarding Script</title>
		<link>https://masterandcmdr.com/2019/01/13/powershell-bulk-forwarding-script/</link>
					<comments>https://masterandcmdr.com/2019/01/13/powershell-bulk-forwarding-script/#comments</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Mon, 14 Jan 2019 07:51:26 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Exchange Online]]></category>
		<category><![CDATA[EXO]]></category>
		<category><![CDATA[forwarding]]></category>
		<category><![CDATA[o365]]></category>
		<category><![CDATA[smtp]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4317</guid>

					<description><![CDATA[Here&#8217;s another handy script in my migration toolbelt &#8211; one of my very frequent tasks during different types of migration projects is to configure forwarding on mailboxes. Often times you might be forwarding in one direction for the duration of the backend migration, and then after cutover, you might need to remove that forwarding and &#8230; <a href="https://masterandcmdr.com/2019/01/13/powershell-bulk-forwarding-script/" class="more-link">Continue reading <span class="screen-reader-text">PowerShell: Bulk Forwarding&#160;Script</span></a>]]></description>
										<content:encoded><![CDATA[<p><span style="font-family:Calibri Light;font-size:11pt;">Here&#8217;s another handy script in my migration toolbelt &#8211; one of my very frequent tasks during different types of migration projects is to configure forwarding on mailboxes. Often times you might be forwarding in one direction for the duration of the backend migration, and then after cutover, you might need to remove that forwarding and start forwarding in the other direction (source to target, cut-over, target to source).<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Like most things, if I end up having to do it more than once or twice, I&#8217;m going to script it and keep that script close for whenever I need to reuse it. I always find it helpful to keep a repository of all my migration scripts as I find I&#8217;m often going back to them and pulling sections forward into new scripts.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Start by building yourself a CSV file &#8211; you only need two columns: <strong>UserPrincipalName </strong>and <strong>ForwardingAddress.</strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/4140b-033119_0750_powershellb1.png" alt="" /></p>
<p><span style="font-family:Calibri Light;">This script has only one required parameter, and that&#8217;s the CSV file &#8211; if you run the script without any other switches, it&#8217;ll import your user list, check their forwarding information and report it back to you.<br />
</span></p>
<p><span style="font-family:Calibri Light;">Getting info only: <strong><em>.Bulk-Forwarding.ps1 -CSV c:scriptsusers.csv </em></strong><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-family:Calibri Light;">(make sure you update the paths as necessary so the script can find your CSV file.)<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/d1977-033119_0750_powershellb2.png" alt="" /></p>
<p><span style="font-family:Calibri Light;">The other two switches available to you are <strong><em>-SetForwarding, </em></strong>and <strong><em>-RemoveForwarding, </em></strong>which do exactly what it sounds like they do &#8211; set or remove the SMTP forwarding from a user&#8217;s account.<br />
</span></p>
<p><span style="font-family:Calibri Light;">Setting forwarding: <strong><em>.Bulk-Forwarding.ps1 -CSV c:scriptsusers.csv -SetForwarding</em></strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/4c6f0-033119_0750_powershellb3.png" alt="" /></p>
<p><span style="font-family:Calibri Light;">And then finally, to remove the forwarding: <strong><em>.Bulk-Forwarding.ps1 -CSV c:scriptsusers.csv -RemoveForwarding</em></strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/beaf0-033119_0750_powershellb4.png" alt="" /></p>
<p><span style="font-family:Calibri Light;"> Not overly complicated, but robust enough to do the job, and a great timesaver! If you&#8217;re interested, head over to GitHub and <a href="https://github.com/remydahl/office365/blob/master/Bulk-Forwarding.ps1">download the script</a> &#8211; feel free to check out the other scripts I have posted there as well. If you have any questions, leave a comment below, or even just to let me know this was helpful.<br />
</span></p>
<p><span style="font-family:Calibri Light;">Good luck; have fun!<br />
</span></p>
<p><span style="font-family:Calibri Light;"><img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
</span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2019/01/13/powershell-bulk-forwarding-script/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4317</post-id>
		<media:content>
			<media:title type="html">PowerShell: Add Multiple Domains to Office 365</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/4140b-033119_0750_powershellb1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/d1977-033119_0750_powershellb2.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/4c6f0-033119_0750_powershellb3.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/beaf0-033119_0750_powershellb4.png" medium="image" />
	</item>
		<item>
		<title>Run Multiple Teams Clients Simultaneously</title>
		<link>https://masterandcmdr.com/2018/12/06/run-multiple-teams-clients-simultaneously/</link>
					<comments>https://masterandcmdr.com/2018/12/06/run-multiple-teams-clients-simultaneously/#respond</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Thu, 06 Dec 2018 20:25:55 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[multiple accounts]]></category>
		<category><![CDATA[MultiTeams]]></category>
		<category><![CDATA[Teams]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4139</guid>

					<description><![CDATA[I am unapologetically a huge fan of Teams. I use it constantly, and have almost completely stopped using Skype for Business for my day to day work &#8211; apart from a few outliers, and a few features that haven&#8217;t quite hit parity between the two… I&#8217;m all in! That said, one of my biggest frustrations &#8230; <a href="https://masterandcmdr.com/2018/12/06/run-multiple-teams-clients-simultaneously/" class="more-link">Continue reading <span class="screen-reader-text">Run Multiple Teams Clients&#160;Simultaneously</span></a>]]></description>
										<content:encoded><![CDATA[<p><span style="font-family:Calibri Light;font-size:11pt;">I am unapologetically a huge fan of Teams. I use it constantly, and have almost completely stopped using Skype for Business for my day to day work &#8211; apart from a few outliers, and a few features that haven&#8217;t quite hit parity between the two… I&#8217;m all in!<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">That said, one of my biggest frustrations in using Teams on a day to day basis is my inability to log in to multiple clients / Teams tenants at the same time &#8211; switching back and forth is time consuming and annoying, not to mention the further annoyance of missing out on notifications from one or the other when you&#8217;re switched.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Looking around on the web, I can see that I&#8217;m not the only one with <a href="https://microsoftteams.uservoice.com/forums/555103-public/suggestions/17750851-i-want-to-use-multiple-teams-accounts-at-the-same">this frustration</a> &#8211; fellow MVPs <a href="https://www.allabout365.com/2017/09/multiple-teams-accounts/">Steve Goodman</a> and <a href="https://tomtalks.blog/2017/11/microsoft-teams-guest-access-chrome-web-apps/">Tom Arbuthnot</a> have suggested some pretty cool solutions to the problem, so feel free to go down that route if you want to manually create the Chromium/Electron web apps yourself. Alternately, you can go the route of using multiple browsers, or even <a href="http://windowspbx.blogspot.com/2017/09/microsoft-teams-user-tips-18-keep.html">multiple Chrome &#8220;people&#8221;</a> to have separate identities.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">As much as I love the idea of having separate apps for my different Teams Identities, I&#8217;d prefer a more integrated approach if possible, so I don&#8217;t have to keep an eye on a bunch of different windows and screen clutter, etc.<br />
</span></p>
<h2><span style="color:blue;font-family:Calibri;font-size:14pt;text-decoration:underline;">Meet Franz.</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">I&#8217;m not even sure where how I first stumbled across Franz, but it&#8217;s quickly become one of those apps that I can&#8217;t imagine living without! Franz essentially performs those web connections for you, and allows you to maintain multiple different accounts across a fairly large amount of services that you might want to connect to. For example, I am currently logged in to four different Teams tenants at the same time. :O<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">On top of the different Teams tenants I connect to, I also have my WhatsApp and Discord accounts added, which is pure win in my books!<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple1.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Installing the app is as easy as you&#8217;d imagine it to be &#8211; once you have it installed, you&#8217;ll be prompted to add your first service, and then you can add as many others as you&#8217;d like. You can see that there are both a lot of services to choose from, and you can request missing services you&#8217;d like added as well:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple2.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Yammer is still missing, but I&#8217;ve requested it be added &#8211; I might not use it as much as I&#8217;d like to, but it sure would be useful to have it all in one spot.<br />
</span></p>
<h2><span style="color:#2e75b5;font-family:Calibri;font-size:14pt;">Pros &amp; Cons<br />
</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">Lots to love, and nothing to hate… that&#8217;s for sure.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;"><strong>Pros:</strong><br />
</span></p>
<ul>
<li><span style="font-family:Calibri Light;font-size:11pt;">All my accounts are in one app, and I don&#8217;t have the pain of trying to maintain separate browser windows, etc.<br />
</span></li>
<li><span style="font-family:Calibri Light;font-size:11pt;">Notifications work great across all the services I&#8217;m connected to.<br />
</span></li>
<li><span style="font-family:Calibri Light;font-size:11pt;">My taskbar icon is badged when I have a notification (like you&#8217;d expect), and<br />
</span></li>
<li><span style="font-family:Calibri Light;font-size:11pt;">Connections are sticky enough that I don&#8217;t have to log in constantly.<br />
</span></li>
<li><span style="font-family:Calibri Light;font-size:11pt;">Since it&#8217;s a web/modern auth connection under the hood, MFA works correctly, and I&#8217;m prompted to authenticate when necessary.<br />
</span></li>
<li>
<div><span style="font-family:Calibri Light;font-size:11pt;">My accounts are neatly stacked, and notification badges show up on the appropriate service, making it easy to switch between them and reply to messages.<br />
</span></div>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple3.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></li>
<li>
<div><span style="font-family:Calibri Light;font-size:11pt;">Guest accounts!! This deserves its own section, so I&#8217;ll get into it below.<br />
</span></div>
</li>
</ul>
<p><span style="font-family:Calibri Light;font-size:11pt;"><strong>Cons:</strong><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Not really much in the way of cons, but there&#8217;s a couple of things I notice that are worth mentioning.<br />
</span></p>
<ul>
<li><span style="font-family:Calibri Light;font-size:11pt;">Incoming calls can be a bit confusing, and it doesn&#8217;t always ring through the web client &#8211; I keep my main Teams client running anyway, and answer calls on there. I haven&#8217;t needed to take calls on my other logons yet, so it hasn&#8217;t been a problem for me.<br />
</span></li>
<li><span style="font-family:Calibri Light;font-size:11pt;">Remember that you&#8217;re essentially accessing each of these services through the web client &#8211; every now and again I get prompted to &#8220;download the app&#8221; which wants to of course download the app for whatever service your connected to. Nothing much to do about that, again, just recognize that it&#8217;s a web application and you&#8217;ll be fine.<br />
</span></li>
</ul>
<h2><span style="color:#2e75b5;font-family:Calibri;font-size:14pt;">Adding Teams Guest Accounts<br />
</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">Ok, I didn&#8217;t actually even realize this was possible until I was writing this post &#8211; now that I know I can do this, I love it even more! I&#8217;ve been logging in to my individual Teams accounts but hadn&#8217;t even thought of maintaining a separate connection for each tenant that account is a guest on.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Setup is just as easy as it should be &#8211; simply add a new Teams service in Franz, log in with your regular Office 365 credentials, and then click on the little drop-down beside your picture in the top right of your screen:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple4.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Switch over to whichever Guest tenant you want to set this service to and then (if you&#8217;re like me) give it a name and a logo to differentiate it from your other Teams logons. Since each connection is being maintained individually, you&#8217;ll be able to switch between your main and Guest tenants quickly and easily.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Chalk up another win for Franz!<br />
</span></p>
<p><a href="https://meetfranz.com/"><img src="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple5.png" alt="" border="0" /></a><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;"> </span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2018/12/06/run-multiple-teams-clients-simultaneously/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4139</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2018/12/franz-teams.jpg" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/12/franz-teams.jpg" medium="image">
			<media:title type="html">Franz-Teams</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple2.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple3.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple4.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/12/120618_2025_runmultiple5.png" medium="image" />
	</item>
		<item>
		<title>Mitigating Azure MFA Outages</title>
		<link>https://masterandcmdr.com/2018/11/29/mitigating-azure-mfa-outages/</link>
					<comments>https://masterandcmdr.com/2018/11/29/mitigating-azure-mfa-outages/#respond</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Fri, 30 Nov 2018 01:39:19 +0000</pubDate>
				<category><![CDATA[Azure AD]]></category>
		<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Break Glass]]></category>
		<category><![CDATA[cloud app security]]></category>
		<category><![CDATA[Conditional Access]]></category>
		<category><![CDATA[Global Admin]]></category>
		<category><![CDATA[MFA]]></category>
		<category><![CDATA[outage]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4070</guid>

					<description><![CDATA[With the recent MFA outages (twice in the last two weeks), the question has come up in conversation several times &#8211; what do we do when MFA is down, and when our users can&#8217;t log in? As you might expect, there are several approaches you can take that allow you to maintain the balance between &#8230; <a href="https://masterandcmdr.com/2018/11/29/mitigating-azure-mfa-outages/" class="more-link">Continue reading <span class="screen-reader-text">Mitigating Azure MFA&#160;Outages</span></a>]]></description>
										<content:encoded><![CDATA[<p><span style="font-size:11pt;">With the recent MFA outages (twice in the last two weeks), the question has come up in conversation several times &#8211; what do we do when MFA is down, and when our users can&#8217;t log in?<br />
</span></p>
<p><span style="font-size:11pt;">As you might expect, there are several approaches you can take that allow you to maintain the balance between security and allowing your users to keep working, even when the service is not functioning properly.<br />
</span></p>
<h2><span style="color:#2e75b5;font-family:Calibri;font-size:14pt;">Option 1: <a href="https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/directory-emergency-access"><span style="color:blue;text-decoration:underline;">Configure a global admin &#8220;break glass&#8221; account</span></a>.<br />
</span></h2>
<p><span style="font-size:11pt;">This is a great option, and endorsed by Microsoft as a best practice for overall tenant management and security &#8211; just keep a couple of things in mind:<br />
</span></p>
<ol>
<li>
<div><span style="font-size:11pt;">Make sure that this account is properly locked down and not tied to a specific individual. If you can lock it down as tight as Microsoft recommends (credentials kept separate, locked in a fireproof safe) then great &#8211; if not, at least make sure that you make the password suitably difficult, and keep these credentials on lockdown.<br />
</span></div>
</li>
<li>
<div><span style="font-size:11pt;">Set this account to use your <strong><em>@domain.onmicrosoft.com</em></strong> account &#8211; if you&#8217;re using ADFS or PTA, and you&#8217;re unable to authenticate back on premises because of issues with your federated domain, setting it up this way will allow you to log back in to your tenant using Microsoft authentication, rather than your on prem infrastructure (which might be down as well).<br />
</span></div>
</li>
<li><span style="font-size:11pt;">Exclude this admin account from MFA Policies. There are additional ways that you can lock down this emergency account, such as creating a Conditional Access Policy that ensures that this account can only be used from a domain joined PC, on your corporate network, etc. Just remember that you might still be painting yourself into a corner if the Conditional Access service goes down and you have no way of validating your access conditions. You always have to choose to balance between how much controls you put in place, and how much of a back door you want to leave behind &#8211; your security and risk posture is really going to be the deciding factor here.<br />
</span></li>
</ol>
<h3><span style="color:#5b9bd5;font-family:Calibri;font-size:12pt;">Exclude your emergency account from MFA Policies<br />
</span></h3>
<p><span style="font-size:11pt;">Let&#8217;s say for instance that I have my baseline policy enabled: <strong>Require MFA for admins</strong> (because I do). Automatically all my global admins are required to use MFA, and my security posture has gotten a bit stronger, along with my <a href="https://securescore.office.com/">Secure Score</a>.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga1.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;">However, since I want to make sure my emergency account is able to access the system even if MFA is down, I simply set an exclusion on the policy so that this account does not require MFA.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga2.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;">Like I mentioned before, you can configure other conditional access policies that might further limit this account &#8211; maybe you might want to ensure that it&#8217;s only logging on from a trusted location, trusted machine, etc. In this case, I simply have this account excluded from the policy, and I use my own security rigor to control access to this account.<br />
</span></p>
<h3><span style="color:#5b9bd5;font-family:Calibri;font-size:12pt;">Audit access to this account and configure alerts<br />
</span></h3>
<p><span style="font-size:11pt;">Ensure that you are <a href="https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/concept-sign-ins">auditing this account&#8217;s access</a> on a regular basis to ensure that it&#8217;s not being misused (or maybe even to ensure it&#8217;s not being used at all). If you have access to <a href="https://www.microsoft.com/en-us/cloud-platform/cloud-app-security">Cloud App Security</a> (requires EM+S E5 licensing on your tenant), you can configure an activity policy that will alert specified people any time this account is used, like so:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga3.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;">Click the button to <strong>Edit and preview results</strong> in order to test your filters and ensure they&#8217;re working properly.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga4.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;">Once you are satisfied that your activity filters are catching the required account logon activities, configure an alert to send an alert email or text message:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga5.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;">Creating your emergency access / break glass admin account is going to cover a number of scenarios, and not just the MFA service being down. The point of having this account, of course, is that you can log in to Azure AD and disable your conditional access policy which requires MFA, and get users logging back in again.<br />
</span></p>
<h2><span style="color:#2e75b5;font-family:Calibri;font-size:14pt;">Option 2: Create an MFA exclusion group<br />
</span></h2>
<p><span style="font-size:11pt;">Another option that addresses the specific scenario of quickly and easily allowing your users to log in to Office 365 without requiring MFA is to create a security group on prem, sync it up to Azure AD, and set it as an exclusion on your MFA Policy.<br />
</span></p>
<p><span style="font-size:11pt;">For example, I&#8217;ve created two groups in Active Directory named <strong>MFA_Enabled</strong> and <strong>MFA_Disabled</strong> to keep things simple:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga6.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;">These two groups are used when I create my MFA Conditional Access Policy &#8211; one to target specific users for MFA, and the other for my MFA exclusion group.<br />
</span></p>
<p><span style="font-size:11pt;"><strong>Conditional Access Policy: Include Users and groups</strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga7.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;"><strong>Conditional Access Policy: Exclude users and groups</strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga8.png" alt=""><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-size:11pt;">Once you have this set up, you can keep your <strong>MFA_Disabled</strong> group empty, and just have it ready in case something like this happens again. As soon as you get a report that MFA is down, and your users are impacted, you can simply move your affected users (or all of them if you prefer) to the <strong>MFA_Disabled</strong> group and run a quick sync in AAD Connect.<br />
</span></p>
<p><span style="font-size:11pt;">If you like, you can even use a simple script like this to move your users from the MFA Enabled to the Disabled group:<br />
</span></p>
<p style="margin-left:27pt;"><span style="color:orangered;font-size:9pt;"><span style="background-color:white;">$mfaEnabled <span style="color:#979797;">= <span style="color:blue;">Get-ADGroupMember <span style="color:navy;">-Identity <span style="color:darkred;">&#8220;MFA_Enabled&#8221;</span></span></span></span></span><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="color:darkblue;background-color:white;">foreach</span><span style="background-color:white;"> (<span style="color:orangered;">$m <span style="color:darkblue;">in <span style="color:orangered;">$mfaEnabled</span>){</span></span></span></span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Remove-ADGroupMember <span style="color:navy;">-Identity <span style="color:blueviolet;">MFA_Enabled <span style="color:navy;">-Members <span style="color:orangered;">$m<span style="color:#979797;">.</span>SamAccountName <span style="color:navy;">-Confirm:<span style="color:orangered;">$false</span></span></span></span></span></span></span></span></span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Write-Host <span style="color:darkred;">&#8220;Moving </span>$(<span style="color:orangered;">$m<span style="color:#979797;">.</span>name)<span style="color:darkred;"> to the MFA_Disabled group&#8221; <span style="color:navy;">-ForegroundColor <span style="color:blueviolet;">Yellow</span></span></span></span></span></span></span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Add-ADGroupMember <span style="color:navy;">-Identity <span style="color:blueviolet;">MFA_Disabled <span style="color:navy;">-Members <span style="color:orangered;">$m<span style="color:#979797;">.</span>SamAccountname</span></span></span></span></span></span><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"> } </span><br />
</span></p>
<p><span style="font-size:11pt;">And then just do the reverse to bring them back in to the MFA Enabled group:<br />
</span></p>
<p style="margin-left:27pt;"><span style="color:orangered;font-size:9pt;"><span style="background-color:white;">$mfaDisabled <span style="color:#979797;">= <span style="color:blue;">Get-ADGroupMember <span style="color:navy;">-Identity <span style="color:darkred;">&#8220;MFA_Disabled&#8221;</span></span></span></span></span><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="color:darkblue;background-color:white;">foreach</span><span style="background-color:white;"> (<span style="color:orangered;">$u <span style="color:darkblue;">in <span style="color:orangered;">$mfaUsers</span>){</span></span></span></span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Remove-ADGroupMember <span style="color:navy;">-Identity <span style="color:darkred;">&#8220;MFA_Disabled&#8221; <span style="color:navy;">-Members <span style="color:orangered;">$u<span style="color:#979797;">.</span>SamAccountName <span style="color:navy;">-Confirm:<span style="color:orangered;">$false</span></span></span></span></span></span></span></span></span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Write-Host <span style="color:darkred;">&#8220;Moving </span>$(<span style="color:orangered;">$u<span style="color:#979797;">.</span>name)<span style="color:darkred;"> to the MFA_Enabled group&#8221; <span style="color:navy;">-ForegroundColor <span style="color:blueviolet;">Green</span></span></span></span></span></span></span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Add-ADGroupMember <span style="color:navy;">-Identity <span style="color:darkred;">&#8220;MFA_Enabled&#8221; <span style="color:navy;">-Members <span style="color:orangered;">$u<span style="color:#979797;">.</span>SamAccountname</span></span></span></span></span></span><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-size:9pt;"><span style="background-color:white;"> } </span><br />
</span></p>
<p><span style="font-size:11pt;">Now obviously you need to be running these cmdlets from a system with access to your Active Directory, with admin rights to move users from one group to another. You can also make this part of a more complete script by adding logging, parameters to -enableMFA or -disableMFA, etc. These are just simple building blocks to get you started. <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
</span></p>
<p><span style="font-size:11pt;">When you&#8217;re done, initiate a quick sync using the following command from your AAD Connect server:<br />
</span></p>
<p style="margin-left:27pt;"><span style="color:blue;font-size:9pt;"><span style="background-color:white;">Start-ADSyncSyncCycle <span style="color:navy;">-PolicyType <span style="color:blueviolet;">Delta </span></span></span><br />
</span></p>
<p><span style="font-size:11pt;">Within a few minutes you can easily exclude some or all of your users from MFA, and just as quickly re-enable it for them, even if you can&#8217;t log into the portal yourself. Since this action is completely triggered from your server on prem, I believe it gives you an avenue to very quickly re-establish access should another MFA outage occur.<br />
</span></p>
<p><span style="font-size:11pt;">Hopefully this helps give you some ideas around how best to manage and control access to your Office 365 tenant, even when certain parts of it are outside of your control (looking at you, MFA!) &#8211; good luck!<br />
</span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2018/11/29/mitigating-azure-mfa-outages/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4070</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2018/11/azuread.jpg" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/azuread.jpg" medium="image">
			<media:title type="html">azureAD</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga2.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga3.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga4.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga5.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga6.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga7.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/113018_0138_mitigatinga8.png" medium="image" />
	</item>
		<item>
		<title>Export Sent Items using eDiscovery</title>
		<link>https://masterandcmdr.com/2018/11/23/export-sent-items-using-ediscovery/</link>
					<comments>https://masterandcmdr.com/2018/11/23/export-sent-items-using-ediscovery/#respond</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Sat, 24 Nov 2018 01:29:01 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[eDiscovery]]></category>
		<category><![CDATA[security and compliance]]></category>
		<category><![CDATA[Sent Items]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4022</guid>

					<description><![CDATA[Security &#38; Compliance &#8211; eDiscovery for the win I recently ran into a situation where I needed to export all the Sent Items from a number of mailboxes within a very specific date range &#8211; we needed to export these items so that they could be ingested into a journaling mailbox later. Since you can&#8217;t &#8230; <a href="https://masterandcmdr.com/2018/11/23/export-sent-items-using-ediscovery/" class="more-link">Continue reading <span class="screen-reader-text">Export Sent Items using&#160;eDiscovery</span></a>]]></description>
										<content:encoded><![CDATA[<h2><span style="color:#2e75b5;font-size:14pt;">Security &amp; Compliance &#8211; eDiscovery for the win<br />
</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">I recently ran into a situation where I needed to export all the Sent Items from a number of mailboxes within a very specific date range &#8211; we needed to export these items so that they could be ingested into a journaling mailbox later.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Since you can&#8217;t directly export a mailbox from Exchange Online, the best way to make this happen is to do an eDiscovery search from within the Security and Compliance Center. Once you have your search parameters defined, you can export them all as a single PST, or as multiple PSTs (one per mailbox). Since we would later be ingesting these sent items into a Proofpoint journaling archive, this was the option I chose.<br />
</span></p>
<h2><span style="color:#2e75b5;font-size:14pt;">Required Permissions<br />
</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">In order to perform these searches, you need to be at least an eDiscovery Manager &#8211; I went with eDiscovery Administrator in this instance, as it gave me all the permissions I needed. The eDiscovery Manager role would work fine if someone else were assigning cases to me to work with, but since I was doing the whole thing here, I just went with the greater permissions level.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Start out by giving yourself (or the account that needs to perform this export) permissions in the Security &amp; Compliance Center:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti1.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Click on the eDiscovery Manager role to edit it:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti2.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">As I mentioned above, you can assign the eDiscovery Manager role to the person who needs to be able to perform these searches if you want to keep the permissions as contained as possible &#8211; since I was the only one working on eDiscovery in my tenant, and it was ok for me to see all eDiscovery cases, I just went with the eDiscovery Administrator.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Here&#8217;s the breakdown of the differences between the two roles:<br />
</span></p>
<p style="margin-left:27pt;"><span style="font-family:Calibri Light;font-size:11pt;"><em>Members (of this role group) can also create and manage eDiscovery cases, add and remove members to a case, create and edit Content Searches associated with a case, and access case data in Office 365 Advanced eDiscovery. </em><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-family:Calibri Light;font-size:11pt;"><em>An eDiscovery Administrator is a member of the eDiscovery Manager role group who has been assigned additional permissions. In addition to the tasks that an eDiscovery Manager can perform, an eDiscovery Administrator can: </em><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-family:Calibri Light;font-size:11pt;"><em>• View all eDiscovery cases in the organization. </em><br />
</span></p>
<p style="margin-left:27pt;"><span style="font-family:Calibri Light;font-size:11pt;"><em>• Manage any eDiscovery case after they add themselves as a member of the case. </em><br />
</span></p>
<p><span style="color:#595959;font-size:9pt;"><em>From &lt;<a href="https://docs.microsoft.com/en-us/office365/securitycompliance/permissions-in-the-security-and-compliance-center">https://docs.microsoft.com/en-us/office365/securitycompliance/permissions-in-the-security-and-compliance-center</a>&gt; </em></span><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">So just remember &#8211; an eDiscovery <strong>manager</strong> can manage cases they&#8217;re assigned to, but an eDiscovery <strong>administrator</strong> can assign themselves to any case an manage it. Now that we&#8217;ve gotten that out of the way, let&#8217;s move on.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">While editing the role group, click <strong>Edit </strong>to add someone as a Manager or Administrator:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti3.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">On the next screen that opens up, click on the <strong>Choose eDiscovery Administrator</strong> link to add someone to this role group:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti4.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Pick your user from the GAL, and select their name to add them to the list:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti5.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Click <strong>Done, and then Save:</strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti6.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<h2><span style="color:#2e75b5;font-size:14pt;">Creating a new eDiscovery search:<br />
</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">Now that you have the permissions you need to run your search, head over to Search and Investigation &#8211; Content Search:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti7.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">You can obviously create and edit searches both through the GUI and the Shell &#8211; we&#8217;ll start with the GUI, and head over to the Shell afterwards.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Click on <strong>+New search:</strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti8.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Clicking on New Search will open your search query window so you can start editing directly &#8211; a Guided Search will open a wizard to walk you through your options, and searching by ID List requires you to upload a list of Exchange IDs to search against. For what we need to achieve here, we&#8217;re just going to be doing a regular search, and applying some logic and filters to get exactly what we need to export (Sent Items within a date range).<br />
</span></p>
<h2><span style="color:#2e75b5;font-size:14pt;">Refining your search query:<br />
</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">Now that we have a new search created, we need to go ahead and refine our search query to get the results we need. In the query window, start by removing the keywords condition, and then adding a new one:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti9.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">For this search, we&#8217;re going to use two conditions: <strong>Sender</strong> and <strong>Sent</strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti10.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;"><em>(For a full description of all the keyword queries and search conditions available, <a href="https://docs.microsoft.com/en-us/office365/securitycompliance/keyword-queries-and-search-conditions?redirectSourcePath=%252fen-us%252farticle%252fKeyword-queries-and-search-conditions-for-Content-Search-c4639c2e-7223-4302-8e0d-b6e10f1c3be3">check out the Microsoft Docs here</a>.)</em><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">The <strong>Sent</strong> field is going to give us our date range option, and our <strong>Sender </strong>field is going to identify the emails that have been sent by those specific people.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti11.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">The <strong>Sender </strong>field does not allow for you to add multiple people at once &#8211; which is why we&#8217;ll be switching to PowerShell shortly &#8211; you can easily add people one at a time by typing their names in, resolving them in the GAL, and then clicking on their names to add them. If you need to search against multiple people, this is going to drive you crazy, so we&#8217;re going to update that through PowerShell instead.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">The last thing to do before saving your search query is to choose the locations you want to search against:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti12.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">You obviously have a number of options here, depending on what it is you&#8217;re trying to get done &#8211; since this scenario requires a specific scope, we&#8217;re going to narrow this down to only searching in specific user&#8217;s mailboxes. Click on the <strong>Choose users, groups, or teams</strong> option to select your mailbox locations:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti13.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">Next, click <strong>Choose users, groups, or teams:</strong><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti14.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">Once again, you can type people&#8217;s names in individually and select them from the list &#8211; but that&#8217;s not the kind of people we are, is it now? <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti15.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">I&#8217;m just going to go ahead and set my first location, and then edit the list through PowerShell. Click <strong>Choose</strong>, <strong>Done</strong>, then <strong>Save.</strong><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">Lastly, click <strong>Save &amp; Run</strong>, and let&#8217;s head over to PowerShell:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti16.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:10pt;">You&#8217;ll be prompted to name your search at this point &#8211; just go ahead and give it something easy to recognize so you can find it through PowerShell later.<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti17.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<h2><span style="color:#2e75b5;font-size:14pt;">Need more Power(Shell)!<br />
</span></h2>
<p><span style="font-family:Calibri Light;font-size:11pt;">Ok, now that our search is running, let&#8217;s bring it up in PowerShell and edit it &#8211; note that you could easily have created your search from within PowerShell if you wanted to, and in fact you might find that way easier… up to you. Start by <a href="https://masterandcmdr.com/powershell-connect-to-the-security-compliance-center/">getting connected to the Security &amp; Compliance Center admin shell</a>.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">From here on in, I don&#8217;t have a shiny script that will do this all for you, but I&#8217;ll show you the commands that I run to give myself some more control over the whole process here.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Let&#8217;s start out by creating a variable with the name of our Compliance search:<br />
</span></p>
<p><span style="color:orangered;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">$cSearch <span style="color:#979797;">= <span style="color:darkred;">&#8220;Sent Items &#8211; November 13th to 23rd&#8221; </span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Next, I want to confirm what my current search parameters are, so I have a baseline to go back to if I mess up, and also just to see what the language looks like:<br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Write-Host <span style="color:darkred;">&#8220;Original Search Query:&#8221; <span style="color:navy;">-ForegroundColor <span style="color:blueviolet;">Yellow</span></span></span></span><br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;">Get-ComplianceSearch <span style="color:navy;">-Identity <span style="color:orangered;">$cSearch <span style="color:#979797;">| <span style="color:blue;">Select <span style="color:navy;">-ExpandProperty <span style="color:blueviolet;">ContentMatchQuery </span><br />
</span></span></span></span></span></span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">This is what we get:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti18.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">The <strong>(c:c)</strong> is the equivalent of an AND operator, and then we have our <strong>from</strong> field, and the <strong>sent </strong>field &#8211; identifying the date range and the senders in question.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Ok, now we want to go in and add a bunch of users &#8211; in this case, I&#8217;ve created a CSV file that contains two columns: <strong>DisplayName</strong> and <strong>UserPrincipalName</strong>. I used these ones specifically so I can target these users for different things. Let&#8217;s go ahead and import those users as a variable:<br />
</span></p>
<p><span style="color:orangered;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">$cUsers <span style="color:#979797;">= <span style="color:blue;">Import-Csv <span style="color:blueviolet;">.Desktopcompliance-users.csv </span></span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Now that we have our users ready to go, we can start editing our query:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti19.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Since we know we want to keep our date range as is, we&#8217;re going to store it in a variable so we can build on it:<br />
</span></p>
<p><span style="color:orangered;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">$daterange <span style="color:#979797;">= <span style="color:darkred;">&#8220;(c:c)(sent=2018-11-13..2018-11-23)&#8221; </span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Now comes the fun part &#8211; we&#8217;re going to run a foreach loop on our <strong>$cUsers </strong>variable, and add each user to the query &#8211; many thanks to my homie and partner in crime <a href="https://www.linkedin.com/in/brendan-pruden-24729832/">Brendan</a> for helping me with my string manipulation here:<br />
</span></p>
<p><span style="color:darkgreen;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;"># Update Search Query to include emails sent by specific users:</span><br />
</span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;"><br />
<span style="color:darkblue;">foreach</span> (<span style="color:orangered;">$c <span style="color:darkblue;">in <span style="color:orangered;">$cUsers</span>){<span style="color:orangered;">$query <span style="color:#979797;">= <span style="color:orangered;">$daterange <span style="color:#979797;">+= <span style="color:darkred;">&#8220;(from=&#8221;&#8221;</span>$(<span style="color:orangered;">$c<span style="color:#979797;">.</span>DisplayName)<span style="color:darkred;">&#8220;&#8221;)&#8221;</span>}</span></span></span></span></span></span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">And then I&#8217;ll just check to see how my query has changed:<br />
</span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;"><br />
<span style="color:blue;">Write-Host <span style="color:darkred;">&#8220;Updated Search Query:&#8221; <span style="color:navy;">-ForegroundColor <span style="color:blueviolet;">Magenta</span></span></span></span></span><br />
</span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;"><br />
<span style="color:orangered;">$query </span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Voila!<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti20.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Now, you&#8217;re obviously not going to necessarily use PowerShell if you really only needed to add three users &#8211; but this will definitely come in handy if you&#8217;re adding tens or hundreds of users to your query.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Next, let&#8217;s update our Compliance Search with our new query, and get it started:<br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Set-ComplianceSearch <span style="color:navy;">-Identity <span style="color:orangered;">$cSearch <span style="color:navy;">-ContentMatchQuery <span style="color:orangered;">$query <span style="color:#979797;">| <span style="color:blue;">Start-ComplianceSearch</span></span></span></span></span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">So far so good… however, you&#8217;ll remember that we want to find all the sent items in a set of mailboxes, and when we set this search up, we only added a single mailbox to the search locations.<br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Get-ComplianceSearch <span style="color:navy;">-Identity <span style="color:orangered;">$cSearch <span style="color:#979797;">| <span style="color:blue;">Select <span style="color:blueviolet;">ExchangeLocation </span></span></span></span></span></span><br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti21.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Let&#8217;s go back and fix that now:<br />
</span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:darkblue;background-color:white;">foreach</span><span style="background-color:white;"> (<span style="color:orangered;">$c <span style="color:darkblue;">in <span style="color:orangered;">$cUsers</span>){</span></span></span></span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Write-Host <span style="color:darkred;">&#8220;Adding </span>$(<span style="color:orangered;">$c<span style="color:#979797;">.</span>DisplayName)<span style="color:darkred;"> to the Exchange Search Scope&#8221;</span></span></span></span></span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;"><span style="color:blue;">Set-ComplianceSearch <span style="color:navy;">-Identity <span style="color:orangered;">$cSearch <span style="color:navy;">-AddExchangeLocation <span style="color:orangered;">$c<span style="color:#979797;">.</span>UserPrincipalName</span></span></span></span></span></span><br />
</span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;"> }</span><br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Start-ComplianceSearch <span style="color:navy;">-Identity <span style="color:orangered;">$cSearch </span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">You can re-run your <strong>get-</strong> command to make sure that your search has updated correctly:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti22.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">As before, you can start your search using the following command:<br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Start-ComplianceSearch <span style="color:navy;">-Identity <span style="color:orangered;">$cSearch</span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">And then use this one to check on the status of the search:<br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Get-ComplianceSearch <span style="color:navy;">-Identity <span style="color:orangered;">$cSearch <span style="color:#979797;">| <span style="color:blue;">Select <span style="color:blueviolet;">Status </span></span></span></span></span></span><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Now we can go back into the Security &amp; Compliance Center and see what we find &#8211; note that our query has updated with all the changes we&#8217;ve been making in the shell:<br />
</span></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti23.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Now that you&#8217;ve gotten your search results, you can go ahead and export them all to a single PST, export to a PST per mailbox, or just export the individual emails &#8211; depending on your requirements. As you can see, there&#8217;s a fair amount you can do from within the Security &amp; Compliance Center, and using PowerShell gives you even greater control and flexibility in structuring your queries however you want.<br />
</span></p>
<p><span style="font-family:Calibri Light;font-size:11pt;">Hope this helped &#8211; peace out!<br />
</span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2018/11/23/export-sent-items-using-ediscovery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4022</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2018/11/powershell-azure-e1543000740820.jpg" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/powershell-azure-e1543000740820.jpg" medium="image">
			<media:title type="html">PowerShell-Azure</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti2.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti3.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti4.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti5.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti6.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti7.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti8.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti9.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti10.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti11.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti12.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti13.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti14.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti15.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti16.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti17.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti18.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti19.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti20.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti21.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti22.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112418_0128_exportsenti23.png" medium="image" />
	</item>
		<item>
		<title>PowerShell: Connect to the Security &#038; Compliance Center</title>
		<link>https://masterandcmdr.com/2018/11/22/powershell-connect-to-the-security-compliance-center/</link>
					<comments>https://masterandcmdr.com/2018/11/22/powershell-connect-to-the-security-compliance-center/#comments</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Thu, 22 Nov 2018 23:25:18 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[Exchange Online]]></category>
		<category><![CDATA[MFA]]></category>
		<category><![CDATA[Modern Auth]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[security and compliance]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=3994</guid>

					<description><![CDATA[I had to recently do some eDiscovery work in the Security and Compliance Center (I&#8217;ll post about that next, there was some cool PowerShell in there too 🙂 ), and as I often do, I turn to PowerShell to automate the process &#8211; or at least make it easier for me to do more things &#8230; <a href="https://masterandcmdr.com/2018/11/22/powershell-connect-to-the-security-compliance-center/" class="more-link">Continue reading <span class="screen-reader-text">PowerShell: Connect to the Security &#38; Compliance&#160;Center</span></a>]]></description>
										<content:encoded><![CDATA[<p>I had to recently do some eDiscovery work in the Security and Compliance Center (I&#8217;ll post about that next, there was some cool PowerShell in there too <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> ), and as I often do, I turn to PowerShell to automate the process &#8211; or at least make it easier for me to do more things without the limitations of having to click around in the GUI.</p>
<p>Of course, first things first is getting connected &#8211; Microsoft has made the connectivity easy using the <a href="https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/mfa-connect-to-exchange-online-powershell?view=exchange-ps">Exchange Online Modern Auth PowerShell Module</a>, which allows you to connect to both an Exchange Online admin session, as well as to the Security &amp; Compliance Center using <strong>Connect-IPPSSession.</strong></p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2018/11/112318_2325_powershellc1.png" alt="" /><span style="font-family:Calibri Light;font-size:11pt;"><br />
</span></p>
<p>Mind you, if you&#8217;ve seen any of my stuff before, you know I&#8217;m going to want to find a way to connect using PowerShell ISE &#8211; because that&#8217;s just how I roll!</p>
<p>As before, I was able to update my Exchange Online connection script to target the <strong><em>protection.outlook.com</em></strong> URI instead of the Exchange Online admin URI, like so:</p>
<p><span style="color:darkgreen;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">#Connect to the Security &amp; Compliance Center</span><br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Write-Host <span style="color:darkred;">&#8220;Connecting to the Security and Compliance Center&#8221; <span style="color:navy;">-ForegroundColor <span style="color:blueviolet;">Green</span></span></span></span><br />
</span></p>
<p><span style="color:orangered;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">$UPN <span style="color:#979797;">= <span style="color:blue;">Read-Host <span style="color:darkred;">&#8220;Enter the UPN of the user you want to connect with&#8221;</span></span></span></span><br />
</span></p>
<p><span style="font-family:Lucida Console;font-size:9pt;"><span style="color:blue;background-color:white;">Import-Module</span><span style="background-color:white;"> $((<span style="color:blue;">Get-ChildItem <span style="color:navy;">-Path</span> $(<span style="color:orangered;">$env:LOCALAPPDATA<span style="color:#979797;">+<span style="color:darkred;">&#8220;Apps2.0&#8221;</span>) <span style="color:navy;">-Filter <span style="color:blueviolet;">Microsoft.Exchange.Management.ExoPowershellModule.dll <span style="color:navy;">-Recurse</span> )<span style="color:#979797;">.</span>FullName<span style="color:#979797;">|<span style="color:blue;">?</span>{<span style="color:orangered;">$_ <span style="color:#979797;">-notmatch <span style="color:darkred;">&#8220;_none_&#8221;</span>}|<span style="color:blue;">select <span style="color:navy;">-First <span style="color:purple;">1</span>)</span></span></span></span></span></span></span></span></span></span></span><br />
</span></p>
<p><span style="color:orangered;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">$EXOSession <span style="color:#979797;">= <span style="color:blue;">New-ExoPSSession <span style="color:navy;">-ConnectionUri <span style="color:darkred;">&#8220;<a href="https://ps.compliance.protection.outlook.com/PowerShell-LiveId">https://ps.compliance.protection.outlook.com/PowerShell-LiveId</a>&#8221; <span style="color:navy;">-UserPrincipalName <span style="color:orangered;">$UPN</span></span></span></span></span></span></span><br />
</span></p>
<p><span style="color:blue;font-family:Lucida Console;font-size:9pt;"><span style="background-color:white;">Import-PSSession <span style="color:orangered;">$EXOSession </span></span><br />
</span></p>
<p>You&#8217;ll notice we&#8217;re using the same module we use to connect to Exchange Online using MFA &#8211; I&#8217;ve simply updated the connection string to go to the Security &amp; Compliance Center instead of Exchange Online. Apart from that, it&#8217;s more or less the same. As before, I still pass along a connection to Azure AD in case I want to be able to manage those attributes at the same time. You can also modify this to connect to the ExO (Exchange Online) shell at the same time if you like, or just keep them separate &#8211; up to you.</p>
<p>I&#8217;ve also updated the script to check for an existing connection to the Security &amp; Compliance Center, as I like to be able to run my scripts multiple times without re-authenticating &#8211; <a href="https://github.com/remydahl/office365/blob/master/Connect-ComplianceCenter.ps1">head on over to GitHub</a> and grab yourself a copy if you&#8217;d like.</p>
<p>Thanks for reading!</p>
<p><span style="font-family:Calibri Light;font-size:11pt;"> </span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2018/11/22/powershell-connect-to-the-security-compliance-center/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3994</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2018/11/powershell-azure-e1543000740820.jpg" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/powershell-azure-e1543000740820.jpg" medium="image">
			<media:title type="html">PowerShell-Azure</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/112318_2325_powershellc1.png" medium="image" />
	</item>
		<item>
		<title>PowerShell: Reset WAP Configuration</title>
		<link>https://masterandcmdr.com/2018/10/26/powershell-reset-wap-configuration/</link>
					<comments>https://masterandcmdr.com/2018/10/26/powershell-reset-wap-configuration/#respond</comments>
		
		<dc:creator><![CDATA[Jeremy Dahl]]></dc:creator>
		<pubDate>Sat, 27 Oct 2018 06:20:10 +0000</pubDate>
				<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ADFS]]></category>
		<category><![CDATA[Not Trusted]]></category>
		<category><![CDATA[WAP]]></category>
		<guid isPermaLink="false">http://masterandcmdr.com/?p=4306</guid>

					<description><![CDATA[I was working on a project where we were both upgrading ADFS and migrating it from Azure to AWS &#8211; it was way more difficult than it should have been, and ADFS sure did not play nicely on AWS. Maybe it&#8217;s gotten better now, but it was overall quite the headache &#8211; the WAP servers &#8230; <a href="https://masterandcmdr.com/2018/10/26/powershell-reset-wap-configuration/" class="more-link">Continue reading <span class="screen-reader-text">PowerShell: Reset WAP&#160;Configuration</span></a>]]></description>
										<content:encoded><![CDATA[<p>I was working on a project where we were both upgrading ADFS and migrating it from Azure to AWS &#8211; it was way more difficult than it should have been, and ADFS sure did not play nicely on AWS. Maybe it&#8217;s gotten better now, but it was overall quite the headache &#8211; the WAP servers kept losing their trust to the ADFS server, and needed to be reset constantly!</p>
<p>It was happening so many times that I ended up writing a script to automate the process &#8211; I figured it might be useful (or at least components of it), so I&#8217;m sharing it here. I drew heavily from <a href="https://blogs.technet.microsoft.com/rmilne/2015/04/20/adfs-2012-r2-web-application-proxy-re-establish-proxy-trust/">Rhoderick&#8217;s process</a> &#8211; I just put it all together so I could simply run the script whenever I needed to reset the configuration in one simple step.</p>
<p>Start by getting your ADFS certificate thumbnail, and storing it as a variable &#8211; remember that you should have the same third-party certificate installed on all your STS and WAP servers, so once you&#8217;ve gotten this variable set once you should be good to go until you have to renew your certificate. Your ADFS certificate will be installed in your local computer store, and will more than likely be named something like <strong><em>sts.domain.com:</em></strong></p>
<p>[powershell]<br />
Get-ChildItem -Path &quot;Cert:LocalMachineMy&quot;<br />
[/powershell]</p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/be150-033119_0619_powershellr1.png" alt="" /></p>
<p>Now that we have our thumbprint, we&#8217;re going to store it in a variable &#8211; we&#8217;ll also capture our admin credentials at the same time so that we&#8217;re ready to use those when we need to reconfigure the Web Application Proxy.</p>
<p>[powershell]<br />
$creds = Get-Credential<br />
$cert = &quot;C9ADFCB04C432C4C0F213BA6DECBDB107B76F102&quot;<br />
[/powershell]</p>
<p>The next piece of the puzzle here is to reset the reg key needed to tell the Web Application Proxy that it hasn&#8217;t been configured yet &#8211; a key value of 1 means <strong><em>Configured</em></strong>, while a key value of 1 means <strong><em>Not Configured.</em></strong></p>
<p>[powershell]<br />
# Set variables for updating the registry, in order to reset the WAP Config status<br />
$regpath = &quot;HKLM:SOFTWAREMicrosoftADFS&quot;<br />
$keyname = &quot;ProxyConfigurationStatus&quot;<br />
$keyvalue = &quot;1&quot;<br />
&amp;nbsp;<br />
# Reset WAP Configuration Status<br />
New-ItemProperty -Path $regpath -Name $keyname -Value $keyvalue -PropertyType DWORD -Force<br />
[/powershell]</p>
<p>If you want to check what the current status of the key is, simply uncomment and run this line:</p>
<p>[powershell]<br />
# Use this key to check the value of the registry key above.<br />
# Get-ItemProperty -Path $regpath -Name $keyname<br />
[/powershell]</p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/4d0d0-033119_0619_powershellr2.png" alt="" /></p>
<p>This next step is my own personal housekeeping step &#8211; every time the WAP service resets, it creates a new &#8220;ADFS Proxy Trust&#8221; certificate, causing your certificate store to get cluttered. This next step simply deletes them all &#8211; there&#8217;s no problem doing this, as when you complete the script to re-install the web application proxy, it creates a new one.</p>
<p>[powershell]<br />
# Remove all old WAP certificates from the local store &#8211; a new one will be generated once trust is established<br />
Set-Location Cert:LocalMachineMy<br />
Get-ChildItem | where {$_.Subject -match &quot;CN=ADFS ProxyTrust&quot;} | Remove-Item<br />
Set-Location C:<br />
[/powershell]</p>
<p>All clean!</p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/a9eab-033119_0619_powershellr3.png" alt="" /></p>
<p>The final step now is to install the Web Application Proxy &#8211; make sure to replace the Federation Service Name with your own STS server:</p>
<p>[powershell]<br />
# Re-establish Federation Trust with the sts service.<br />
Install-WebApplicationProxy -CertificateThumbprint $cert -FederationServiceName sts.masterandcmdr.com -FederationServiceTrustCredential $creds<br />
[/powershell]</p>
<p><img src="https://masterandcmdr.com/wp-content/uploads/2019/03/63c4d-033119_0619_powershellr4.png" alt="" /></p>
<p>If all goes well, you should have a nice minty fresh WAP server ready to go, trusting the world as it once did!</p>
<p>If you found this useful, feel free to let me know &#8211; head over to <a href="https://github.com/remydahl/office365/blob/master/Reset-WAPConfig.ps1" target="_blank" rel="noopener noreferrer">Github</a> if you&#8217;d like to download the whole thing and use it for yourself.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://masterandcmdr.com/2018/10/26/powershell-reset-wap-configuration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4306</post-id>
		<media:thumbnail url="https://masterandcmdr.com/wp-content/uploads/2018/11/powershell-azure-e1543000740820.jpg" />
		<media:content url="https://masterandcmdr.com/wp-content/uploads/2018/11/powershell-azure-e1543000740820.jpg" medium="image">
			<media:title type="html">PowerShell-Azure</media:title>
		</media:content>

		<media:content url="https://1.gravatar.com/avatar/7f49c028bc5da75518e297bd2ccd55265cf6420a14d748b0849eddc80078ec6d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jeremydahl</media:title>
		</media:content>

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/be150-033119_0619_powershellr1.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/4d0d0-033119_0619_powershellr2.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/a9eab-033119_0619_powershellr3.png" medium="image" />

		<media:content url="https://masterandcmdr.com/wp-content/uploads/2019/03/63c4d-033119_0619_powershellr4.png" medium="image" />
	</item>
	</channel>
</rss>
