<?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/"
	>

<channel>
	<title>PowerShell Archives - Apostolidis Cloud Corner</title>
	<atom:link href="https://www.cloudcorner.gr/category/microsoft/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.cloudcorner.gr/category/microsoft/powershell/</link>
	<description>Remarks from a Cloud Architect encounters</description>
	<lastBuildDate>Fri, 26 Apr 2024 07:43:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.cloudcorner.gr/wp-content/uploads/2021/04/cropped-cloudcorner2-32x32.png</url>
	<title>PowerShell Archives - Apostolidis Cloud Corner</title>
	<link>https://www.cloudcorner.gr/category/microsoft/powershell/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Monitor &#038; Dependencies agents at once!</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/monitor-dependencies-agents-at-once/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/monitor-dependencies-agents-at-once/#respond</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Fri, 26 Apr 2024 07:30:11 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[dependency agent]]></category>
		<category><![CDATA[dependency analysis]]></category>
		<category><![CDATA[log analytics]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[service map]]></category>
		<guid isPermaLink="false">https://www.cloudcorner.gr/?p=4192</guid>

					<description><![CDATA[<p>Download the two agents from the links below: The Monitor agent needs extravtion. To extract use the command: MMASetup-&#60;platform>.exe /c</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/monitor-dependencies-agents-at-once/">Monitor &amp; Dependencies agents at once!</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Download the two agents from the links below:</p>



<ul class="wp-block-list">
<li><a href="https://go.microsoft.com/fwlink/?LinkId=828603">https://go.microsoft.com/fwlink/?LinkId=828603</a></li>



<li><a href="https://aka.ms/dependencyagentwindows">https://aka.ms/dependencyagentwindows</a></li>
</ul>



<p>The Monitor agent needs extravtion. To extract use the command: MMASetup-&lt;platform>.exe /c /t:&lt;Full Path></p>



<p>e.g.: MMASetup-AMD64.exe /c /t:C:\Temp</p>



<p>Add all files to a network share like: <a href="file://server/share/">\\server\share\</a></p>



<p>φτιάξε ένα bat or cmd file, π.χ. setupagents.bat με το παρακάτω περιεχόμενο αλλά βάλε τα δικά σου shares, workspace ID &amp; Key:</p>



<p>create a bat or cmd file, e.g. setupagents.bat and add the below content. Change the share link, the Workspace ID and Key:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bat" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">net use y: \\server\share\

y:\Setup.exe /qn NOAPM=1 ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_AZURE_CLOUD_TYPE=0 OPINSIGHTS_WORKSPACE_ID="&lt;your workspace ID>" OPINSIGHTS_WORKSPACE_KEY="&lt;your workspace key>" AcceptEndUserLicenseAgreement=1

y:\InstallDependencyAgent-Windows.exe /S /RebootMode=manual

net use y: /delete</pre>



<p>For example, I created the setupagents.bat, and added the files to the network share  <a href="file://dcvm/Temp">\\dcvm\Temp</a> . The content of my setupagents.bat is:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">net use y: \\dcvm\Temp

y:\Setup.exe /qn NOAPM=1 ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_AZURE_CLOUD_TYPE=0 OPINSIGHTS_WORKSPACE_ID="b987ae35-b7e3-44ba-bd27-000000000000" OPINSIGHTS_WORKSPACE_KEY="OZz8YN5A12biINsMbja9PHkZLDdYNNZEw+QDIsAmi0ys/2+000000000000==" AcceptEndUserLicenseAgreement=1

y:\Temp\InstallDependencyAgent-Windows.exe /S /RebootMode=manual

net use y: /delete</pre>



<p>After running the setupagents.bat, both agents are installed. You can check at the programs and features:</p>



<figure class="wp-block-image size-full is-resized"><a href="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-46.png"><img fetchpriority="high" decoding="async" width="813" height="246" src="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-46.png" alt="" class="wp-image-4194" style="width:446px;height:auto" srcset="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-46.png 813w, https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-46-300x91.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-46-768x232.png 768w" sizes="(max-width: 813px) 100vw, 813px" /></a></figure>



<p>At the control panel the Microsoft Monitoring Agent will appear and open it to check that it is connected to y our Log Analytics Workspace.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-47.png"><img decoding="async" width="351" height="119" src="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-47.png" alt="" class="wp-image-4195" style="width:224px;height:auto" srcset="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-47.png 351w, https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-47-300x102.png 300w" sizes="(max-width: 351px) 100vw, 351px" /></a></figure>



<figure class="wp-block-image size-full is-resized"><a href="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-48.png"><img decoding="async" width="786" height="301" src="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-48.png" alt="" class="wp-image-4196" style="width:520px;height:auto" srcset="https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-48.png 786w, https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-48-300x115.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2024/04/image-48-768x294.png 768w" sizes="(max-width: 786px) 100vw, 786px" /></a></figure>



<p>Here is a list of sample Log Search commands for the dependency analysis:</p>



<ul class="wp-block-list">
<li><a href="https://learn.microsoft.com/en-us/previous-versions/azure/azure-monitor/vm/service-map#sample-log-searches">https://learn.microsoft.com/en-us/previous-versions/azure/azure-monitor/vm/service-map#sample-log-searches</a></li>



<li><a href="https://learn.microsoft.com/en-us/azure/migrate/how-to-create-group-machine-dependencies#sample-review-inbound-connections">https://learn.microsoft.com/en-us/azure/migrate/how-to-create-group-machine-dependencies#sample-review-inbound-connections</a></li>
</ul>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div><div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div></div><div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:p&#114;o&#120;&#105;m&#097;gr&#064;&#104;ot&#109;ail&#046;&#099;om" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div></div></div><p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fmonitor-dependencies-agents-at-once%2F&amp;linkname=Monitor%20%26%20Dependencies%20agents%20at%20once%21" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fmonitor-dependencies-agents-at-once%2F&amp;linkname=Monitor%20%26%20Dependencies%20agents%20at%20once%21" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fmonitor-dependencies-agents-at-once%2F&#038;title=Monitor%20%26%20Dependencies%20agents%20at%20once%21" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/monitor-dependencies-agents-at-once/" data-a2a-title="Monitor &amp; Dependencies agents at once!"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/monitor-dependencies-agents-at-once/">Monitor &amp; Dependencies agents at once!</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/monitor-dependencies-agents-at-once/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Azure Firewall Policy Rules to CSV</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/azure-firewall-policy-rules-to-csv/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/azure-firewall-policy-rules-to-csv/#comments</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Sat, 12 Feb 2022 08:21:53 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure firewall]]></category>
		<category><![CDATA[azure firewall policies]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.cloudcorner.gr/?p=3903</guid>

					<description><![CDATA[<p>Azure Firewall is a virtual network firewall service that provides your resources in an Azure Virtual Network. It&#8217;s a firewall</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-firewall-policy-rules-to-csv/">Azure Firewall Policy Rules to CSV</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Azure Firewall is a virtual network firewall service that provides your resources in an Azure Virtual Network. It&#8217;s a firewall as a service, build on the cloud for the cloud. It provides both east-west and north-south traffic inspection. Some features are Threat Intelligence, DNAT, SNAT, Application &amp; Network filtering rules, DNS Proxy, TLS Inspection, IDPS, URL Filtering, Web Categories. And as an Azure native service has built-in high availability and cloud scalability.</p>



<p>There is plenty of information and guides for Azure Firewall at the Microsoft Docs <a href="https://docs.microsoft.com/en-us/azure/firewall/">Azure Firewall documentation | Microsoft Docs</a>. In this post, I want to share some PowerShell scripts that we created with my colleague Panagiotis Tsoukias. One script to Export all Firewall Policy rules, of all Policy Groups in a CSV file. Then edit the rules in Excel.  And a second script to import the rules to the same or to a different Firewall Policy.</p>



<h2 class="wp-block-heading" id="export-the-azure-firewall-policy-rules">Export the Azure Firewall Policy Rules</h2>



<p>The first script is to Export the Firewall Policy Rules of a Rule Collection, in a manageable CSV format. Edit the script, change the first three variables, and the path to export, and run it. Open the exported CSV with Microsoft Excel and you will have this result:</p>



<figure class="wp-block-image size-large"><a href="https://www.cloudcorner.gr/wp-content/uploads/2022/02/image-5.png"><img loading="lazy" decoding="async" width="1024" height="87" src="https://www.cloudcorner.gr/wp-content/uploads/2022/02/image-5-1024x87.png" alt="csv export" class="wp-image-3905" srcset="https://www.cloudcorner.gr/wp-content/uploads/2022/02/image-5-1024x87.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2022/02/image-5-300x26.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2022/02/image-5-768x66.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2022/02/image-5.png 1090w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>The first three columns are the Rule Collection&#8217;s Name, Priority &amp; Action Type. We will need this info to create the Rule Collections and import the rules to the corresponding Rule Collection.</p>



<p>You can copy the script from the below box or download it from my GitHub link: <strong><a href="https://github.com/proximagr/automation/blob/master/Export%20Azure%20Firewall%20Policy%20Rules.ps1">Export Azure Firewall Policy Rules.ps1</a></strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="powershell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#Provide Input. Firewall Policy Name, Firewall Policy Resource Group &amp; Firewall Policy Rule Collection Group Name
$fpname = azfwpolicy
$fprg = azurehub
$fprcgname = DefaultNetworkRuleCollectionGroup

$fp = Get-AzFirewallPolicy -Name $fpname -ResourceGroupName $fprg
$rcg = Get-AzFirewallPolicyRuleCollectionGroup -Name $fprcgname -AzureFirewallPolicy $fp

$returnObj = @()
foreach ($rulecol in $rcg.Properties.RuleCollection) {

foreach ($rule in $rulecol.rules)
{
$properties = [ordered]@{
    RuleCollectionName = $rulecol.Name;
    RulePriority = $rulecol.Priority;
    ActionType = $rulecol.Action.Type;
    RUleConnectionType = $rulecol.RuleCollectionType;
    Name = $rule.Name;
    protocols = $rule.protocols -join ", ";
    SourceAddresses = $rule.SourceAddresses -join ", ";
    DestinationAddresses = $rule.DestinationAddresses -join ", ";
    SourceIPGroups = $rule.SourceIPGroups -join ", ";
    DestinationIPGroups = $rule.DestinationIPGroups -join ", ";
    DestinationPorts = $rule.DestinationPorts -join ", ";
    DestinationFQDNs = $rule.DestinationFQDNs -join ", ";
}
$obj = New-Object psobject -Property $properties
$returnObj += $obj
}

#change c:\temp to the path to export the CSV
$returnObj | Export-Csv c:\temp\rules.csv -NoTypeInformation
}</pre>



<h2 class="wp-block-heading" id="import-the-azure-firewall-policy-rules">Import the Azure Firewall Policy Rules</h2>



<p>After done editing the rules in Excel, we are ready to import them back to the Azure Policy or to a new Azure Policy.  We need to export one CSV per Rule Collection. It will help us that the first column has the Rule Collection Name. Then run the import script. The script creates a Rule Collection, if it does not already exist, and adds the Rules in this specific Rule Collection.</p>



<p>You can copy the script from the below box or download it from my GitHub link: <strong><a href="https://github.com/proximagr/automation/blob/master/Import%20Azure%20Firewall%20Policy%20Rules.ps1">Import Azure Firewall Policy Rules.ps1</a></strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="powershell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#Provide Input. Firewall Policy Name, Firewall Policy Resource Group &amp; Firewall Policy Rule Collection Group Name
$fpname = azfwpolicy
$fprg = azurehub
$fprcgname = DefaultNetworkRuleCollectionGroup

$targetfp = Get-AzFirewallPolicy -Name $fpname -ResourceGroupName $fprg
$targetrcg = New-AzFirewallPolicyRuleCollectionGroup -Name $fprcgname -Priority 200 -FirewallPolicyObject $targetfp

$RulesfromCSV = @()
# Change the folder where the CSV is located
$readObj = import-csv C:\temp\rules.csv
foreach ($entry in $readObj)
{
    $properties = [ordered]@{
        RuleCollectionName = $entry.RuleCollectionName;
        RulePriority = $entry.RulePriority;
        ActionType = $entry.ActionType;
        Name = $entry.Name;
        protocols = $entry.protocols -split ", ";
        SourceAddresses = $entry.SourceAddresses -split ", ";
        DestinationAddresses = $entry.DestinationAddresses -split ", ";
        SourceIPGroups = $entry.SourceIPGroups -split ", ";
        DestinationIPGroups = $entry.DestinationIPGroups -split ", ";
        DestinationPorts = $entry.DestinationPorts -split ", ";
        DestinationFQDNs = $entry.DestinationFQDNs -split ", ";
    }
    $obj = New-Object psobject -Property $properties
    $RulesfromCSV += $obj
}

$RulesfromCSV
Clear-Variable rules
$rules = @()
foreach ($entry in $RulesfromCSV)
{
    $RuleParameter = @{
        Name = $entry.Name;
        Protocol = $entry.protocols
        sourceAddress = $entry.SourceAddresses
        DestinationAddress = $entry.DestinationAddresses
        DestinationPort = $entry.DestinationPorts
    }
    $rule = New-AzFirewallPolicyNetworkRule @RuleParameter
    $NetworkRuleCollection = @{
        Name = $entry.RuleCollectionName
        Priority = $entry.RulePriority
        ActionType = $entry.ActionType
        Rule       = $rules += $rule
    }
}

# Create a network rule collection
$NetworkRuleCategoryCollection = New-AzFirewallPolicyFilterRuleCollection @NetworkRuleCollection
# Deploy to created rule collection group
Set-AzFirewallPolicyRuleCollectionGroup -Name $targetrcg.Name -Priority 200 -RuleCollection $NetworkRuleCategoryCollection -FirewallPolicyObject $targetfp</pre>



<p>Feel free to take, edit, use &amp; comment on the scripts, you can find them at my repo:</p>


<div class="ebg-br-wrapper ebg-br-wrapper-dark-mode-on">
	<div class="ebg-br-background-image"></div>
	<div class="ebg-br-editmode egb-br-darkmode-status">
		<span class="egb-br-darkmode-status-img">Dark Mode</span>
	</div>
	<div class="ebg-br-avatar">
		<img loading="lazy" decoding="async" class="ebg-br-header-avatar" src="https://avatars.githubusercontent.com/u/4180413?v=4" alt="" width="150" height="150" />
	</div>
	<div class="ebg-br-main">
		<p class="ebg-br-title">
			<strong>
				<a target="_blank" rel="noopener noreferrer" href="https://github.com/proximagr/automation">
					automation
					<span class="screen-reader-text">(this link opens in a new window)</span>
				</a>
			</strong>
			<em>
				by<a target="_blank" rel="noopener noreferrer" href="https://github.com/proximagr">
					proximagr
					<span class="screen-reader-text">(this link opens in a new window)</span>
				</a>
			</em>
		</p>
		<p class="ebg-br-description"></p>
		<p class="ebg-br-footer">
			<span class="ebg-br-subscribers">
				<span class="ebg-br-background-image"></span>
				1 Subscriber			</span>
			<span class="ebg-br-watchers">
				<span class="ebg-br-background-image"></span>
				0 Watchers			</span>
			<span class="ebg-br-forks">
				<span class="ebg-br-background-image"></span>
				0 Forks			</span>
			<a target="_blank" rel="noopener noreferrer" class="ebg-br-link" href="https://github.com/proximagr/automation">
				Check out this repository on GitHub.com				<span class="screen-reader-text">(this link opens in a new window)</span>
			</a>
		</p>
	</div>
</div><div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div><div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div></div><div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:pr&#111;x&#105;&#109;a&#103;r&#064;&#104;otma&#105;&#108;.&#099;om" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div></div></div><p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-firewall-policy-rules-to-csv%2F&amp;linkname=Azure%20Firewall%20Policy%20Rules%20to%20CSV" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-firewall-policy-rules-to-csv%2F&amp;linkname=Azure%20Firewall%20Policy%20Rules%20to%20CSV" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-firewall-policy-rules-to-csv%2F&#038;title=Azure%20Firewall%20Policy%20Rules%20to%20CSV" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/azure-firewall-policy-rules-to-csv/" data-a2a-title="Azure Firewall Policy Rules to CSV"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-firewall-policy-rules-to-csv/">Azure Firewall Policy Rules to CSV</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/azure-firewall-policy-rules-to-csv/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
			</item>
		<item>
		<title>Azure VM &#124; Add Multiple Data Disks v2</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/azure-vm-add-multiple-data-disks-v2/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/azure-vm-add-multiple-data-disks-v2/#comments</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Fri, 02 Jul 2021 08:26:54 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure vm]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[managed disks]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[windows server]]></category>
		<guid isPermaLink="false">http://ge08jfh8ds93sdf.azurewebsites.net/?p=3786</guid>

					<description><![CDATA[<p>This is a new version of my previous script Add multiple managed disks to Azure RM VM Changes: Shows the</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-vm-add-multiple-data-disks-v2/">Azure VM | Add Multiple Data Disks v2</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This is a new version of my previous script <a href="/microsoft/add-multiple-managed-disks-to-azure-rm-vm/">Add multiple managed disks to Azure RM VM</a></p>
<p>Changes:</p>
<ul>
<li style="list-style-type: none;">
<ul>
<li>Shows the disk capacity of the VM and asks how many disks to add.</li>
<li>Prompts for the size of every disk</li>
<li>Checks for empty Luns to add the disks</li>
</ul>
</li>
</ul>
<pre class="EnlighterJSRAW" data-enlighter-language="powershell"># 1. You need to login to the Azure Rm Account

Login-AzAccount

# 2. The script will query the Subscriptions that the login account has access and will promt the user to select the target Subscription from the drop down list
 
$subscription = Get-AzSubscription | Out-GridView -Title "Select a Subscription" -PassThru
Select-AzSubscription -SubscriptionId $subscription.Id

# 3. The script will query the available VMs and promt to select the target VM from the VM list
 
$vm = Get-AzVM | Out-GridView -Title "Select the Virtual Machine to add Data Disks to" -PassThru

# 4. I set the storage type based on the OS disk. If you want to spesify somehting else you can cahnge this to: $storageType = StandardLRS or PremiumLRS etc.

$storageType = $VM.StorageProfile.OsDisk.ManagedDisk.StorageAccountType

# 5. Enter how many data disks you need to create

$VMdiskCapacity = ($VM.StorageProfile.DataDisks).Capacity
 
$diskquantity = Read-Host "How many disks you need to create? Max Capacity" $VMdiskCapacity "."

# 6. The script will promt for disk size, in GB

$diskSizeList = @()
for($i = 1; $i -le $diskquantity; $i++)
{
    $disk = (Read-Host "Disk " $i " Size")
    $diskSizeList += $disk
}
$diskSizeList

# 7. check for exisiting disks

$existinglun = @()
for($i = 0; $i -lt $VMdiskCapacity; $i++) {
    $existinglun += ($VM.StorageProfile.DataDisks)[$i].Lun
}

# 8. disks creation

for($i = 0; $i -lt $diskquantity; $i++)
{
$diskName = $vm.Name + "-DataDisk-" + $i.ToString()
$diskConfig = New-AzDiskConfig -AccountType $storageType -Location $vm.Location -CreateOption Empty -DiskSizeGB $diskSizeList[$i]
$DataDisk = New-AzDisk -DiskName $diskName -Disk $diskConfig -ResourceGroupName $vm.ResourceGroupName
for ($j = 0; $j -lt $VMdiskCapacity; $j++) {
    if ( $null -eq $existinglun[$j] ) {
        $nextLunIndex
        for ($k = 0; $k -lt $VMdiskCapacity; $k++ ) {
            $nextLunIndex = $k
            for ( $m = 0; $m -lt $VMdiskCapacity; $m++ ) {
                if ( $k -eq $existinglun[$m] ) {
                    $nextLunIndex = -1 
                    break 
                }
            }
            if ($nextLunIndex -ne -1 ) {
                break
            }
        }
        Add-AzVMDataDisk -VM $vm -Name $DiskName -CreateOption Attach -ManagedDiskId $DataDisk.Id -Lun $nextLunIndex
        $existinglun[$j] = $nextLunIndex
        break
    } 
}
}
Update-AzVM -VM $vm -ResourceGroupName $vm.ResourceGroupName</pre>
<p>You can download the script from: <a href="https://github.com/proximagr/automation/blob/master/Add-DataDisks-DIffSize_v3.ps1">https://github.com/proximagr/automation/blob/master/Add-DataDisks-DIffSize_v3.ps1</a></p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div>
<div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:prox&#105;&#109;agr&#064;&#104;o&#116;m&#097;il&#046;&#099;o&#109;" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div>
</div>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-vm-add-multiple-data-disks-v2%2F&amp;linkname=Azure%20VM%20%7C%20Add%20Multiple%20Data%20Disks%20v2" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-vm-add-multiple-data-disks-v2%2F&amp;linkname=Azure%20VM%20%7C%20Add%20Multiple%20Data%20Disks%20v2" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-vm-add-multiple-data-disks-v2%2F&#038;title=Azure%20VM%20%7C%20Add%20Multiple%20Data%20Disks%20v2" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/azure-vm-add-multiple-data-disks-v2/" data-a2a-title="Azure VM | Add Multiple Data Disks v2"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-vm-add-multiple-data-disks-v2/">Azure VM | Add Multiple Data Disks v2</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/azure-vm-add-multiple-data-disks-v2/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Learn Azure for Free using Sandbox!</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/learn-azure-for-free-using-sandbox/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/learn-azure-for-free-using-sandbox/#comments</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Fri, 13 Nov 2020 09:59:04 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure portal]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[microsoft azure]]></category>
		<category><![CDATA[microsoft learn]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://www.e-apostolidis.gr/?p=3688</guid>

					<description><![CDATA[<p>Learn Azure for Free using Sandbox! Did you know that you can use Azure for free for learning purposes? And</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/learn-azure-for-free-using-sandbox/">Learn Azure for Free using Sandbox!</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1>Learn Azure for Free using Sandbox!</h1>
<p>Did you know that you can use Azure for free for learning purposes? And when I say free, i am not talking about the <a href="https://azure.microsoft.com/en-us/free/">free account</a> where you need to add your credit card and have 170€ credit. I am talking about a completely free environment to learn the Azure services and resources, but <strong>only for Learning purposes</strong>.</p>
<p>The Azure Sandbox is offered by the <a href="https://docs.microsoft.com/en-us/learn/">Microsoft Learn platform</a>. Microsoft Learn is a <strong>completely free</strong>, online training platform that provides interactive learning for Microsoft products and more.</p>
<p>The <a href="https://docs.microsoft.com/en-us/learn/support/faq?pivots=sandbox"><strong>Microsoft Learn sandbox</strong> </a>(sometimes called the Azure sandbox) is a <strong>free environment</strong> that you can use to explore Azure through Microsoft Learn content.</p>
<p>And the magic here is that <span style="font-size: 28px;"><b style="font-size: 28px;">you </b><span style="font-size: 28px;"><b>don&#8217;t </b></span><b style="font-size: 28px;">need an Azure account to use a sandbox! </b>All you need is a <a href="https://account.microsoft.com/account" data-linktype="external">Microsoft account</a> to sign in with. If you don&#8217;t have one, you can create one for free.</span></p>
<p>Take a look at this. This is the Microsoft Learn home page where you can select whatever learning path or module you want to follow.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3700 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free.png" width="592" height="211" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free.png 2071w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-300x107.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-1024x365.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-768x274.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-1536x547.png 1536w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-2048x730.png 2048w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-1320x470.png 1320w" sizes="auto, (max-width: 592px) 100vw, 592px" /></p>
<p>When you start a module that needs Microsoft Azure Access, there is an &#8220;<strong>Activate sandbox</strong>&#8221; button</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3690 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-1.png" width="616" height="369" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-1.png 1367w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-1-300x180.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-1-1024x613.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-1-768x460.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-1-1320x790.png 1320w" sizes="auto, (max-width: 616px) 100vw, 616px" /></p>
<p>When you press is, the only thing that you will be asked is to enter a mobile phone number, just for verification. It will not ask for credit card!</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3691 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-2.png" width="595" height="393" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-2.png 1375w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-2-300x198.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-2-1024x676.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-2-768x507.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-2-120x80.png 120w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-2-1320x872.png 1320w" sizes="auto, (max-width: 595px) 100vw, 595px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3692 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-3.png" width="571" height="159" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-3.png 1011w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-3-300x83.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-3-768x213.png 768w" sizes="auto, (max-width: 571px) 100vw, 571px" /></p>
<p>Once you verify your number, it will ask you to Review and accept the permissions to use Microsoft Azure using your Microsoft Account</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3693 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-4.png" width="579" height="178" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-4.png 1017w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-4-300x92.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-4-768x236.png 768w" sizes="auto, (max-width: 579px) 100vw, 579px" /></p>
<p>And the Sandbox environment is ready! You can have 10 Sandboxes per day, for 2 hours each.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3694 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-5.png" width="576" height="120" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-5.png 1202w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-5-300x63.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-5-1024x214.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-5-768x160.png 768w" sizes="auto, (max-width: 576px) 100vw, 576px" /></p>
<p>You can use Bash, PowerShell and the Azure Poral at will:</p>
<p>Bash:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3696 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-7.png" width="574" height="65" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-7.png 1382w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-7-300x34.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-7-1024x116.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-7-768x87.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-7-1320x149.png 1320w" sizes="auto, (max-width: 574px) 100vw, 574px" /></p>
<p>PowerShell:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3702 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-using-Sandbox.png" width="574" height="116" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-using-Sandbox.png 1440w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-using-Sandbox-300x61.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-using-Sandbox-1024x208.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-using-Sandbox-768x156.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-Learn-Azure-for-Free-using-Sandbox-1320x268.png 1320w" sizes="auto, (max-width: 574px) 100vw, 574px" /></p>
<p>Azure Portal:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3697 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-8.png" width="581" height="326" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-8.png 1487w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-8-300x168.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-8-1024x574.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-8-768x431.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-8-1320x740.png 1320w" sizes="auto, (max-width: 581px) 100vw, 581px" /></p>
<p>You can use the Sandbox to complete the specific exercise, but you can also play around with the resources. You can see at the below screenshot, that except the two &#8220;webVM&#8221;s of the exercise, I have created a &#8220;test&#8221; VM directly from the portal.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3698 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/11/Pasted-into-1-9.png" width="600" height="476" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-9.png 1146w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-9-300x238.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-9-1024x811.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/11/Pasted-into-1-9-768x609.png 768w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<p>Start your learning path at <a href="https://docs.microsoft.com/en-us/learn/">Microsoft Learn NOW</a>!</p>
<p>And remember: <strong>The sandbox may only be used to complete training on Microsoft Learn.</strong></p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div>
<div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:&#112;&#114;o&#120;im&#097;g&#114;&#064;&#104;ot&#109;a&#105;&#108;.&#099;&#111;m" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div>
</div>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Flearn-azure-for-free-using-sandbox%2F&amp;linkname=Learn%20Azure%20for%20Free%20using%20Sandbox%21" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Flearn-azure-for-free-using-sandbox%2F&amp;linkname=Learn%20Azure%20for%20Free%20using%20Sandbox%21" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Flearn-azure-for-free-using-sandbox%2F&#038;title=Learn%20Azure%20for%20Free%20using%20Sandbox%21" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/learn-azure-for-free-using-sandbox/" data-a2a-title="Learn Azure for Free using Sandbox!"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/learn-azure-for-free-using-sandbox/">Learn Azure for Free using Sandbox!</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/learn-azure-for-free-using-sandbox/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Azure Application Gateway &#124; WAF Policy per Listener</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/azure-application-gateway-waf-policy/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/azure-application-gateway-waf-policy/#comments</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Fri, 25 Sep 2020 05:22:48 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[application gateway]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[waf]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[web application]]></category>
		<category><![CDATA[web application firewall]]></category>
		<guid isPermaLink="false">https://www.e-apostolidis.gr/?p=3630</guid>

					<description><![CDATA[<p>Pantelis Apostolidis Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-application-gateway-waf-policy/">Azure Application Gateway | WAF Policy per Listener</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h1>Azure Application Gateway | WAF Policy per Listener</h1>
<p>With Azure Application Gateway v2 coming, a lot of new features have been added. Much faster deployment and change times, auto-scaling and the ability to assign different Web Application Firewall (WAF) policies per Application Gateway&#8217;s listener. This feature provides more control over each listener and also can limit the number of different Application Gateways you need to deploy. </p>
<p>With a custom WAF policy we can <strong>control the firewall per listener (URL)</strong> with:</p>
<ul>
<li>Firewall mode, Prevention &#8211; Detection</li>
<li>Request body properties</li>
<li>WAF rule set category &amp; version</li>
<li>Custom Rules with If / Then conditions
<ul>
<li>Match IP address, Number, String, Geo location</li>
<li>Allow / Deny Traffic</li>
</ul>
</li>
</ul>
<h2>This post scenario</h2>
<p>We have on Azure Application Gateway with two Listeners (listens to two different URLs at its Public IP). The two listeners are forwarding the traffic to two different Web Apps, as shown at the below image.</p>
<p>My request is to allow all traffic to the first URL but allow traffic only from a specific IP to the second URL.</p>
<p>For the demo, I assume that you already have an Azure Application Gateway v2 in place and you have published two back ends (web apps, VMs, custom IP) and your web sites / apps are healthy and you can browse them behind the Application Gateway. </p>
<p><img loading="lazy" decoding="async" width="1883" height="194" class="alignnone wp-image-3644 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-10.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-10.png 1883w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-10-300x31.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-10-1024x105.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-10-768x79.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-10-1536x158.png 1536w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-10-1320x136.png 1320w" sizes="auto, (max-width: 1883px) 100vw, 1883px" /></p>
<p>Since I am using the default azurewebsites.net domain, I added two hosts at my workstation&#8217;s host file, in order to route the traffic to the Application Gateway&#8217;s IP and not directly to the Web Apps. </p>
<p><img loading="lazy" decoding="async" width="734" height="132" class="alignnone wp-image-3643 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-9.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-9.png 734w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-9-300x54.png 300w" sizes="auto, (max-width: 734px) 100vw, 734px" /></p>
<p>I can browse both Web Apps, through the Application Gateway, from my browser. I am using http and not https for the demo since I am using the default domain and I cannot add a custom certificate.</p>



<p><img loading="lazy" decoding="async" width="1023" height="266" class="alignnone wp-image-3640 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-7.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-7.png 1023w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-7-300x78.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-7-768x200.png 768w" sizes="auto, (max-width: 1023px) 100vw, 1023px" /></p>
<p><img loading="lazy" decoding="async" width="1030" height="210" class="alignnone wp-image-3642 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-8.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-8.png 1030w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-8-300x61.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-8-1024x209.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-8-768x157.png 768w" sizes="auto, (max-width: 1030px) 100vw, 1030px" /></p>
<p>We need to create two Web Application Firewall policies (WAF). One for each listener. To create  a WAF policy, search the Azure Portal for waf and click the &#8220;Web Application Firewall policies (WAF)&#8221;.</p>
<p><img loading="lazy" decoding="async" width="778" height="243" class="alignnone wp-image-3633 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted.png 778w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-300x94.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-768x240.png 768w" sizes="auto, (max-width: 778px) 100vw, 778px" /></p>
<p>At the &#8220;Web Application Firewall policies (WAF)&#8221; page click +Add</p>
<p><img loading="lazy" decoding="async" width="866" height="329" class="alignnone wp-image-3634 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-1.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-1.png 866w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-1-300x114.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-1-768x292.png 768w" sizes="auto, (max-width: 866px) 100vw, 866px" /></p>
<p>At the Project details select &#8220;Regional WAF (Application Gateway)&#8221;. </p>
<p><img loading="lazy" decoding="async" width="1084" height="261" class="alignnone wp-image-3635 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-2.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-2.png 1084w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-2-300x72.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-2-1024x247.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-2-768x185.png 768w" sizes="auto, (max-width: 1084px) 100vw, 1084px" /></p>
<p>Select the Subscription that your Application Gateway resides, select Resource Group, add a name for the Policy and the same region as your Application Gateway. The policy must set to Enabled to apply. I named the policy URLNumber02 to start creating the policy for the second URL that I want the custom rule.</p>
<p><img loading="lazy" decoding="async" width="1387" height="686" class="alignnone wp-image-3638 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-5.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-5.png 1387w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-5-300x148.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-5-1024x506.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-5-768x380.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-5-1320x653.png 1320w" sizes="auto, (max-width: 1387px) 100vw, 1387px" /></p>
<p>At the Policy Settings change the setting to Prevention from Detection and go to the Custom rules and Add custom rule</p>
<p><img loading="lazy" decoding="async" width="733" height="533" class="alignnone wp-image-3637 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-4.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-4.png 733w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-4-300x218.png 300w" sizes="auto, (max-width: 733px) 100vw, 733px" /></p>
<p>I named the rule &#8220;AllowOnlyOneIP&#8221;, since I want to allow only one IP to access the second URL (listener) of the gateway. Give a priority, I added 1 as it is the only one. At the conditions select:</p>
<ul>
<li>March Type: IP address</li>
<li>Operation: Does not contain</li>
<li>IP address or range: add the only IP that you want to allow access to the URL</li>
</ul>
<p>At the &#8220;Then&#8221; condition, select &#8220;Deny Traffic&#8221;</p>
<p><img loading="lazy" decoding="async" width="1011" height="1269" class="alignnone wp-image-3639 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-6.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-6.png 1011w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-6-239x300.png 239w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-6-816x1024.png 816w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-6-768x964.png 768w" sizes="auto, (max-width: 1011px) 100vw, 1011px" /></p>
<p>This rule will allow traffic only of the IP is the IP address that we added to the condition. For all other IPs access will be denied.</p>
<p>Now that we created the policy, we need to assign it to the listener. At the next step of the WAF policy wizard we need to select the Application Gateway and the Listener.</p>
<p><img loading="lazy" decoding="async" width="914" height="896" class="alignnone wp-image-3645 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-11.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-11.png 914w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-11-300x294.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-11-768x753.png 768w" sizes="auto, (max-width: 914px) 100vw, 914px" /></p>
<p>First click the &#8220;Associate an application gateway&#8221; and select the Application Gateway. Remember that this policy will need to overwrite the default Application Gateway&#8217;s WAF policy. So before proceeding migrate your current WAF settings and customizations to the new WAF policy.</p>
<p><img loading="lazy" decoding="async" width="727" height="334" class="alignnone wp-image-3648 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-14.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-14.png 727w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-14-300x138.png 300w" sizes="auto, (max-width: 727px) 100vw, 727px" /></p>
<p>After you select the Application Gateway, associate the listener. I associate the &#8220;mylistener02&#8221; that is my second URL, with this policy.</p>
<p><img loading="lazy" decoding="async" width="763" height="473" class="alignnone wp-image-3647 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-13.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-13.png 763w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-13-300x186.png 300w" sizes="auto, (max-width: 763px) 100vw, 763px" /></p>
<p>After saving the policy, go to the Application gateway and check the &#8220;Web Application Firewall&#8221; settings. There you will see that all settings disappeared and you can only see that the gateway is associated with a WAF policy. We see that it is Associated to the URLNumber2 polily.</p>
<p><img loading="lazy" decoding="async" width="957" height="396" class="alignnone wp-image-3649 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-15.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-15.png 957w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-15-300x124.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-15-768x318.png 768w" sizes="auto, (max-width: 957px) 100vw, 957px" /></p>
<p>You need to create one more WAF rule for URL 01 for the correct functionality. Once you create a WAF policy and associate it to the other listener of the Application gateway, you will see that at the &#8220;Web application firewall&#8221; is associated to the new policy. Actually the Application gateway is associated to both WAF policies, one at each listener. You just cannot see this at the Azure Portal. </p>
<p><img loading="lazy" decoding="async" width="1060" height="428" class="alignnone wp-image-3650 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-16.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-16.png 1060w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-16-300x121.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-16-1024x413.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-16-768x310.png 768w" sizes="auto, (max-width: 1060px) 100vw, 1060px" /></p>
<p>We can see the WAF rules that are associated to the Application Gateway&#8217;s Listeners using the PowerShell. Running the &#8220;Get-AzApplicationGateway -Name AppGw01 -ResourceGroupName AppGw01&#8221; command you can see that the &#8220;URLNumber01&#8221; WAF policy is associated to the &#8220;mylistener&#8221; and the &#8220;URLNumber2&#8221; is associated to the &#8220;mylistener02&#8221;.</p>
<p><img loading="lazy" decoding="async" width="1741" height="1254" class="alignnone wp-image-3656 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-19.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-19.png 1741w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-19-300x216.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-19-1024x738.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-19-768x553.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-19-1536x1106.png 1536w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-19-1320x951.png 1320w" sizes="auto, (max-width: 1741px) 100vw, 1741px" /></p>
<p>To test the policies, I tried to access both URLs from a computer that don&#8217;t have the Public IP that I added tot he policy and I can access the URL 1 app but I cannot access the URL 2 app. From the computer that has the Public IP we added at the rule, I can browse both sites. </p>
<p><img loading="lazy" decoding="async" width="812" height="204" class="alignnone wp-image-3651 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-17.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-17.png 812w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-17-300x75.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-17-768x193.png 768w" sizes="auto, (max-width: 812px) 100vw, 812px" /></p>
<p><img loading="lazy" decoding="async" width="784" height="342" class="alignnone wp-image-3652 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-18.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-18.png 784w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-18-300x131.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-18-768x335.png 768w" sizes="auto, (max-width: 784px) 100vw, 784px" /></p>
<p>The WAF rules can be edited at the Web Application Firewall policies (WAF) blade and all settings will apply to the corresponding listener.</p>
<p><img loading="lazy" decoding="async" width="1022" height="560" class="alignnone wp-image-3657 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2020/09/Pasted-20.png" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-20.png 1022w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-20-300x164.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-20-768x421.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/09/Pasted-20-600x330.png 600w" sizes="auto, (max-width: 1022px) 100vw, 1022px" /></p>
<p>&nbsp;</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div><div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div></div><div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:proxim&#097;g&#114;&#064;ho&#116;&#109;&#097;il&#046;co&#109;" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div></div></div><p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-application-gateway-waf-policy%2F&amp;linkname=Azure%20Application%20Gateway%20%7C%20WAF%20Policy%20per%20Listener" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-application-gateway-waf-policy%2F&amp;linkname=Azure%20Application%20Gateway%20%7C%20WAF%20Policy%20per%20Listener" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-application-gateway-waf-policy%2F&#038;title=Azure%20Application%20Gateway%20%7C%20WAF%20Policy%20per%20Listener" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/azure-application-gateway-waf-policy/" data-a2a-title="Azure Application Gateway | WAF Policy per Listener"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-application-gateway-waf-policy/">Azure Application Gateway | WAF Policy per Listener</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/azure-application-gateway-waf-policy/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Azure Failover Cluster with Shared Disk &#8211; Step by Step</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/azure-failover-cluster-with-shared-disk-step-by-step/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/azure-failover-cluster-with-shared-disk-step-by-step/#comments</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Sat, 04 Apr 2020 13:02:03 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure vm]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[failover cluster]]></category>
		<category><![CDATA[fci]]></category>
		<category><![CDATA[iaas]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[shared disk]]></category>
		<category><![CDATA[storage account]]></category>
		<guid isPermaLink="false">https://www.e-apostolidis.gr/?p=3350</guid>

					<description><![CDATA[<p>Azure Failover Cluster with Shared Disk Recently MIcrosoft Azure anounched the preview feature &#8220;Shared Disk&#8221;. The Shared Disk can be</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-failover-cluster-with-shared-disk-step-by-step/">Azure Failover Cluster with Shared Disk &#8211; Step by Step</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1 style="text-align: justify;">Azure Failover Cluster with Shared Disk</h1>
<p style="text-align: justify;">Recently MIcrosoft Azure anounched the preview feature &#8220;Shared Disk&#8221;. The Shared Disk can be attached at two Azure MVs at the same time. The purpose is to create SQL Server Failover Cluster Instances (FCI), Scale-out File Server (SoFS), File Server for General Use (IW workload), Remote Desktop Server User Profile Disk (RDS UPD) and  SAP ASCS/SCS. More or less we can have a failover cluster at Azure VMs like haveing an on-premises failover cluster with shared storage.</p>
<p style="text-align: justify;">At this post I will demostrate step-by-step how to create a Failover Cluster in Azure with two Azure VMs and a Shared Disk.</p>
<p style="text-align: justify;">Since this is a preview feature at the time I am wroting this post, we need to <a href="https://aka.ms/AzureSharedDiskPreviewSignUp" data-linktype="external">sign up for our preview</a>.</p>
<p style="text-align: justify;">Once we have the confiration that the Shared Disk preview is enabled at our Subscription, we can proceed and create our Shared Disk. Currently this can be done only by using an ARM Template, in order to define the <strong>&#8220;maxShares&#8221;: &#8220;[parameters(&#8216;maxShares&#8217;)]&#8221;</strong> disk property. This property defines in how VMs can this Disk be attached.</p>
<div class="table-scroll-wrapper" style="text-align: justify;">
<table class="table">
<caption class="visually-hidden">The following table illustrates the allowed maximum values for <code>maxShares</code> by disk size:</caption>
<thead>
<tr>
<th>Disk sizes</th>
<th>maxShares limit</th>
</tr>
</thead>
<tbody>
<tr>
<td>P15, P20</td>
<td>2</td>
</tr>
<tr>
<td>P30, P40, P50</td>
<td>5</td>
</tr>
<tr>
<td>P60, P70, P80</td>
<td>10</td>
</tr>
</tbody>
</table>
</div>
<p style="text-align: justify;">Other limitations of the preview are:</p>
<ul style="text-align: justify;">
<li>Currently only available with premium SSDs.</li>
<li>Currently only supported in the West Central US region.</li>
<li>All virtual machines sharing a disk must be deployed in the same proximity placement groups.</li>
<li>Can only be enabled on data disks, not OS disks.</li>
<li>Only basic disks can be used with some versions of Windows Server Failover Cluster, for details see</li>
<li>Failover clustering hardware requirements and storage options.</li>
<li>ReadOnly host caching is not available for premium SSDs with maxShares&gt;1.</li>
<li>Availability sets and virtual machine scale sets can only be used with FaultDomainCount set to 1.</li>
<li>Azure Backup and Azure Site Recovery support is not yet available.</li>
</ul>
<p style="text-align: justify;">From the Azure Portal search and open the &#8220;Template Deployment&#8221;</p>
<p id="fbLGCcl" style="text-align: justify;"><img loading="lazy" decoding="async" width="770" height="197" class="alignnone size-full wp-image-3351 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e8764dede2d3.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8764dede2d3.png 770w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8764dede2d3-300x77.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8764dede2d3-768x196.png 768w" sizes="auto, (max-width: 770px) 100vw, 770px" />\</p>
<p style="text-align: justify;">Select the &#8220;Build your own template in the editor&#8221;</p>
<p id="EiSACdM" style="text-align: justify;"><img loading="lazy" decoding="async" width="450" height="189" class="alignnone size-full wp-image-3352 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e8764f3f16c2.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8764f3f16c2.png 450w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8764f3f16c2-300x126.png 300w" sizes="auto, (max-width: 450px) 100vw, 450px" /></p>
<p style="text-align: justify;">And paste the Shared Disk Json at the template</p>
<p id="WlirTrl" style="text-align: justify;"><img loading="lazy" decoding="async" width="1069" height="852" class="alignnone size-full wp-image-3353 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e87652a6a1b4.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87652a6a1b4.png 1069w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87652a6a1b4-300x239.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87652a6a1b4-1024x816.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87652a6a1b4-768x612.png 768w" sizes="auto, (max-width: 1069px) 100vw, 1069px" /></p>
<p style="text-align: justify;">The Shared Disk Json:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">{ 
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "dataDiskName": {
      "type": "string",
      "defaultValue": "mySharedDisk"
    },
    "dataDiskSizeGB": {
      "type": "int",
      "defaultValue": 1024
    },
    "maxShares": {
      "type": "int",
      "defaultValue": 2
    }
  },
  "resources": [
    {
      "type": "Microsoft.Compute/disks",
      "name": "[parameters('dataDiskName')]",
      "location": "[resourceGroup().location]",
      "apiVersion": "2019-07-01",
      "sku": {
        "name": "Premium_LRS"
      },
      "properties": {
        "creationData": {
          "createOption": "Empty"
        },
        "diskSizeGB": "[parameters('dataDiskSizeGB')]",
        "maxShares": "[parameters('maxShares')]"
      }
    }
  ] 
}</pre>
<p style="text-align: justify;">After the Template Deployment is comleted you will see a normal disk at the Resoruce Group.</p>
<p id="gJFsVXu" style="text-align: justify;"><img loading="lazy" decoding="async" width="591" height="164" class="alignnone size-full wp-image-3355 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e8765ef6d351.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8765ef6d351.png 591w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8765ef6d351-300x83.png 300w" sizes="auto, (max-width: 591px) 100vw, 591px" /></p>
<h2 style="text-align: justify;">Create the VMs</h2>
<p style="text-align: justify;">Create both VMs like any normal Azure VM creation. I created wto Windows Server 2016 VMs. Both VMs must be added to the same availability set (Fault Domain = 1), in order to add them behing an internal load balancer and they must be added to the same Proximity Placement Group.</p>
<p style="text-align: justify;">To create a Proximity Placement Group, just create a new resource, search for &#8220;Proximity Placement Group&#8221; and press create. Just provide a name for the PPG and the location, that must be the same as the Disk.</p>
<p id="uxOAIrG" style="text-align: justify;"><img loading="lazy" decoding="async" width="597" height="232" class="alignnone size-full wp-image-3386 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e887579899e4.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e887579899e4.png 597w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e887579899e4-300x117.png 300w" sizes="auto, (max-width: 597px) 100vw, 597px" /></p>
<p style="text-align: justify;">And select it at the VM creation wizard:</p>
<p id="JXiaEkS" style="text-align: justify;"><img loading="lazy" decoding="async" width="784" height="142" class="alignnone size-full wp-image-3358 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e87b8936977b.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87b8936977b.png 784w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87b8936977b-300x54.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87b8936977b-768x139.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87b8936977b-780x142.png 780w" sizes="auto, (max-width: 784px) 100vw, 784px" /></p>
<p style="text-align: justify;">Attach the Sahred Disk to Both VMs</p>
<p id="CGuUoUH" style="text-align: justify;"><img loading="lazy" decoding="async" width="792" height="200" class="alignnone size-full wp-image-3359 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e87b8a736614.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87b8a736614.png 792w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87b8a736614-300x76.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87b8a736614-768x194.png 768w" sizes="auto, (max-width: 792px) 100vw, 792px" /></p>
<p style="text-align: justify;">When attaching the Shared Disk to the VMs you will see the &#8220;disk shares used&#8221; This reports in how many VMs this disk is attached.</p>
<p id="hFlXHtH" style="text-align: justify;"><img loading="lazy" decoding="async" width="775" height="462" class="alignnone size-full wp-image-3360 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e87bb47c48ce.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87bb47c48ce.png 775w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87bb47c48ce-300x179.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e87bb47c48ce-768x458.png 768w" sizes="auto, (max-width: 775px) 100vw, 775px" /></p>
<p style="text-align: justify;">Once the VMs are ready we can start the Failover Cluster process. We need to add both VMs to the Domain. Then go tot he Disk Management and bring the disks online, GTP on both servers. The next step is to enable the Failover Clustering feature on both VMs. This can be easily acomplished using the below command:</p>
<p style="text-align: justify;">Install-WindowsFeature -Name Failover-Clustering –IncludeManagementTools –ComputerName SDVM01<br />
Install-WindowsFeature -Name Failover-Clustering –IncludeManagementTools –ComputerName SDVM02</p>
<p style="text-align: justify;">Restart both VMs</p>
<p style="text-align: justify;">Lets start the Failover Cluster Wizard. Select both Azure VMs and validate with running all tests.</p>
<p id="fSXkzSq" style="text-align: justify;"><img loading="lazy" decoding="async" width="669" height="152" class="alignnone size-full wp-image-3362 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e884c32866ec.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e884c32866ec.png 669w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e884c32866ec-300x68.png 300w" sizes="auto, (max-width: 669px) 100vw, 669px" /></p>
<p id="WhPnAgZ" style="text-align: justify;"><img loading="lazy" decoding="async" width="547" height="112" class="alignnone size-full wp-image-3363 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e884c4f95eff.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e884c4f95eff.png 547w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e884c4f95eff-300x61.png 300w" sizes="auto, (max-width: 547px) 100vw, 547px" /></p>
<p style="text-align: justify;">The report should have sucess to all Storage Related Stuff. Only the Cluster IP will fail, since it cannot allocate an Azure IP.</p>
<p id="SMrPWah" style="text-align: justify;"><img loading="lazy" decoding="async" width="864" height="557" class="alignnone size-full wp-image-3364 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e884dec86cc7.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e884dec86cc7.png 864w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e884dec86cc7-300x193.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e884dec86cc7-768x495.png 768w" sizes="auto, (max-width: 864px) 100vw, 864px" /></p>
<p id="kbDhzfM" style="text-align: justify;">So we will not create the Cluster uning the GUI wizard. We will create the cluster unsing the new-cluster command to spesify the cluter IP. But first lets create the Cluster IP Load Balancer.</p>
<p style="text-align: justify;">To enable the Cluster IP we need to create an Internal <strong>StandardLoad</strong> Balancer with Static IP. Add both VMs to the Backend pool of the load balancer.</p>
<p id="vvzgaRU" style="text-align: justify;"><img loading="lazy" decoding="async" width="1262" height="154" class="alignnone size-full wp-image-3388 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e887c9ea3982.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e887c9ea3982.png 1262w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e887c9ea3982-300x37.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e887c9ea3982-1024x125.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e887c9ea3982-768x94.png 768w" sizes="auto, (max-width: 1262px) 100vw, 1262px" /></p>
<p style="text-align: justify;">And Run this command to one of the two VMs:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">New-Cluster -Name cluster1 -Node SDVM01,SDVM02  -StaticAddress 192.168.0.10</pre>
<p style="text-align: justify;">The cluster is ready and we can now we can add the Disk to the Cluster</p>
<p id="ERZwxVD" style="text-align: justify;"><img loading="lazy" decoding="async" width="499" height="204" class="alignnone size-full wp-image-3373 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e885cc7db4ef.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885cc7db4ef.png 499w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885cc7db4ef-300x123.png 300w" sizes="auto, (max-width: 499px) 100vw, 499px" /></p>
<p style="text-align: justify;">righ click at the Cluster Disk 1 and select &#8220;Add to cluster shared volumes&#8221;</p>
<p id="ZdNipPt" style="text-align: justify;"><img loading="lazy" decoding="async" width="553" height="163" class="alignnone size-full wp-image-3371 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e885af30db17.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885af30db17.png 553w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885af30db17-300x88.png 300w" sizes="auto, (max-width: 553px) 100vw, 553px" /></p>
<p style="text-align: justify;">Wait untill the disk is online</p>
<p id="QNgGhJy" style="text-align: justify;"><img loading="lazy" decoding="async" width="564" height="119" class="alignnone size-full wp-image-3374 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e885cf948fa1.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885cf948fa1.png 564w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885cf948fa1-300x63.png 300w" sizes="auto, (max-width: 564px) 100vw, 564px" />&#8216;</p>
<p style="text-align: justify;">and check the C:\ClusterStorage path for the &#8220;Volume1&#8221; link.</p>
<p id="NQPOVug" style="text-align: justify;"><img loading="lazy" decoding="async" width="365" height="129" class="alignnone size-full wp-image-3390 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e88800cadbdf.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e88800cadbdf.png 365w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e88800cadbdf-300x106.png 300w" sizes="auto, (max-width: 365px) 100vw, 365px" /></p>
<p style="text-align: justify;">open the Volume1 and create a file, just to cehck that it is working</p>
<p id="xUUryCo" style="text-align: justify;"><img loading="lazy" decoding="async" width="463" height="126" class="alignnone size-full wp-image-3376 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e885d3374d9b.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885d3374d9b.png 463w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e885d3374d9b-300x82.png 300w" sizes="auto, (max-width: 463px) 100vw, 463px" /></p>
<p style="text-align: justify;">To have a more stable cluster, add a Quorum. At the cluster name, right click and select More Actions / Configure Quorum settings.</p>
<p id="YDVtouJ" style="text-align: justify;"><img loading="lazy" decoding="async" width="499" height="103" class="alignnone size-full wp-image-3377 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e886a521ce3a.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886a521ce3a.png 499w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886a521ce3a-300x62.png 300w" sizes="auto, (max-width: 499px) 100vw, 499px" /></p>
<p style="text-align: justify;">Since we are on Azure we will configure an Azure Storage account for quorum. Select the &#8220;Advanced Configuration&#8221;</p>
<p id="rBZxQik" style="text-align: justify;"><img loading="lazy" decoding="async" width="636" height="225" class="alignnone size-full wp-image-3378 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e886a703ea41.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886a703ea41.png 636w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886a703ea41-300x106.png 300w" sizes="auto, (max-width: 636px) 100vw, 636px" /></p>
<p style="text-align: justify;">and select the &#8220;Configure CLoud Witness&#8221;.</p>
<p id="CzrXsZi" style="text-align: justify;"><img loading="lazy" decoding="async" width="436" height="139" class="alignnone size-full wp-image-3379 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e886a7e6e9b5.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886a7e6e9b5.png 436w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886a7e6e9b5-300x96.png 300w" sizes="auto, (max-width: 436px) 100vw, 436px" /></p>
<p style="text-align: justify;">Create an Azure Storage Account</p>
<p id="Fjcmskw" style="text-align: justify;"><img loading="lazy" decoding="async" width="744" height="241" class="alignnone size-full wp-image-3380 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e886ab60d894.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886ab60d894.png 744w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886ab60d894-300x97.png 300w" sizes="auto, (max-width: 744px) 100vw, 744px" /></p>
<p style="text-align: justify;">add the Storage Account to the Virtual Network of the VMs, to secure it</p>
<p id="MYjDUaw" style="text-align: justify;"><img loading="lazy" decoding="async" width="776" height="331" class="alignnone size-full wp-image-3381 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e886ac84f241.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886ac84f241.png 776w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886ac84f241-300x128.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e886ac84f241-768x328.png 768w" sizes="auto, (max-width: 776px) 100vw, 776px" /></p>
<p style="text-align: justify;">And once the Storage Account is ready, copy/paste the name and the Key to the Culster Quorum wizard.</p>
<p id="vtoanTs" style="text-align: justify;"><img loading="lazy" decoding="async" width="275" height="195" class="alignnone size-full wp-image-3383 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e886b5ab3d31.png" alt="" /></p>
<p style="text-align: justify;">Now we have a full failover cluster</p>
<p id="YZSSBdA" style="text-align: justify;"><img loading="lazy" decoding="async" width="533" height="222" class="alignnone size-full wp-image-3391 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e88824015add.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e88824015add.png 533w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e88824015add-300x125.png 300w" sizes="auto, (max-width: 533px) 100vw, 533px" /></p>
<p style="text-align: justify;">Server 1:</p>
<p id="pUiZhrr" style="text-align: justify;"><img loading="lazy" decoding="async" width="510" height="276" class="alignnone size-full wp-image-3393 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e8882977a7f3.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8882977a7f3.png 510w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e8882977a7f3-300x162.png 300w" sizes="auto, (max-width: 510px) 100vw, 510px" /></p>
<p style="text-align: justify;">Server 2:</p>
<p id="tRHOehs" style="text-align: justify;"><img loading="lazy" decoding="async" width="527" height="295" class="alignnone size-full wp-image-3392 " src="https://www.e-apostolidis.gr/wp-content/uploads/2020/04/img_5e88827ab8584.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e88827ab8584.png 527w, https://www.cloudcorner.gr/wp-content/uploads/2020/04/img_5e88827ab8584-300x168.png 300w" sizes="auto, (max-width: 527px) 100vw, 527px" /></p>
<p>Now we can deploy SQL Server FCI, File Server, etc.. !!!!</p>
<p style="text-align: justify;">More info abuot the Shared Disk: <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-shared-enable">https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-shared-enable</a></p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div>
<div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:&#112;&#114;&#111;&#120;im&#097;&#103;r&#064;ho&#116;ma&#105;&#108;&#046;c&#111;m" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div>
</div>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-failover-cluster-with-shared-disk-step-by-step%2F&amp;linkname=Azure%20Failover%20Cluster%20with%20Shared%20Disk%20%E2%80%93%20Step%20by%20Step" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-failover-cluster-with-shared-disk-step-by-step%2F&amp;linkname=Azure%20Failover%20Cluster%20with%20Shared%20Disk%20%E2%80%93%20Step%20by%20Step" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fazure-failover-cluster-with-shared-disk-step-by-step%2F&#038;title=Azure%20Failover%20Cluster%20with%20Shared%20Disk%20%E2%80%93%20Step%20by%20Step" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/azure-failover-cluster-with-shared-disk-step-by-step/" data-a2a-title="Azure Failover Cluster with Shared Disk – Step by Step"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/azure-failover-cluster-with-shared-disk-step-by-step/">Azure Failover Cluster with Shared Disk &#8211; Step by Step</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/azure-failover-cluster-with-shared-disk-step-by-step/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>Serverless Computing &#124; Check your expired public certificates</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/serverless-computing-check-your-expired-public-certificates/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/serverless-computing-check-your-expired-public-certificates/#respond</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Fri, 12 Oct 2018 09:41:29 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure function apps]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[serverless]]></category>
		<guid isPermaLink="false">https://www.e-apostolidis.gr/?p=2220</guid>

					<description><![CDATA[<p>Serverless Computing &#124; Check your expired public certificates Check for expired public certificates serverless, using an Azure Function App. Magically</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/serverless-computing-check-your-expired-public-certificates/">Serverless Computing | Check your expired public certificates</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1 style="text-align: justify;">Serverless Computing | Check your expired public certificates</h1>
<p style="text-align: justify;">Check for expired public certificates serverless, using an Azure Function App. Magically run the required PowerShell script directly at the Portal without deploying VMs or App Services. At this post I combine Azure Function Apps, with a PowerShell script to check the certificate expirations and the Send-MailMessage PowerShell function for sending emails directly from the PowerShell script.</p>
<h2 style="text-align: justify;">Setup the Azure Function App</h2>
<p style="text-align: justify;">At the Azure Portal, create a new Function App. Select Consumption Plan and .NET Runtime Stack</p>
<p id="MXzlFhG" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2226 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bbfa628f28d7.png" alt="Azure Function App" width="565" height="798" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa628f28d7.png 565w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa628f28d7-212x300.png 212w" sizes="auto, (max-width: 565px) 100vw, 565px" /></p>
<p style="text-align: justify;">Once the Function App is created, we need to enable PowerShell language support. To do so, open it, select the Function App and at the Platform features tab, open the Application Settings</p>
<p id="OhAViFR" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2228 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bbfa72059c9c.png" alt="Azure Function App" width="758" height="371" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa72059c9c.png 758w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa72059c9c-300x147.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa72059c9c-600x294.png 600w" sizes="auto, (max-width: 758px) 100vw, 758px" /></p>
<p style="text-align: justify;">Change the FUNCTIONS_EXTENSION_VERSION to ~1 and delete the FUNCTIONS_WORKER_RUNTIME line</p>
<p style="text-align: justify;">Before:</p>
<p id="xEnrOsO" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2230 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bbfa7f11745d.png" alt="Azure Function App" width="715" height="296" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa7f11745d.png 715w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa7f11745d-300x124.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa7f11745d-600x248.png 600w" sizes="auto, (max-width: 715px) 100vw, 715px" /></p>
<p style="text-align: justify;">After:</p>
<p id="SIlnSos" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2231 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bbfa85190469.png" alt="Azure Function App" width="746" height="301" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa85190469.png 746w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa85190469-300x121.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa85190469-600x242.png 600w" sizes="auto, (max-width: 746px) 100vw, 746px" /></p>
<h2 style="text-align: justify;">Create the Function</h2>
<p style="text-align: justify;">Once you click Save, go back to the Function App, select the &#8220;Functions&#8221; and press &#8220;New function&#8221;</p>
<p id="hCPzlED" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2232 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bbfa883c7ab5.png" alt="Azure Function App" width="798" height="361" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa883c7ab5.png 798w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa883c7ab5-300x136.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa883c7ab5-768x347.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa883c7ab5-600x271.png 600w" sizes="auto, (max-width: 798px) 100vw, 798px" /></p>
<p style="text-align: justify;">If we change the application settings correctly, the &#8220;Experimental Language Support&#8221; option will appear. Enable it and the templates will be able to support PowerShell (And more languages). To get started click the &#8220;Time trigger&#8221; template.</p>
<p id="FMRGdTd" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2233 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bbfa8d95fe43.png" alt="Azure Function App" width="825" height="314" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa8d95fe43.png 825w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa8d95fe43-300x114.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa8d95fe43-768x292.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa8d95fe43-600x228.png 600w" sizes="auto, (max-width: 825px) 100vw, 825px" /></p>
<p style="text-align: justify;">At the window, select &#8220;PowerShell&#8221; for language and set the schedule. &#8220;Enter a cron expression of the format &#8216;{second} {minute} {hour} {day} {month} {day of week}&#8217; to specify the schedule.&#8221;</p>
<p style="text-align: justify;">Entering 0 0 0 1 * * the function will run once per day</p>
<p id="igDGJif" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2234 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bbfa9c9bedcd.png" alt="Azure Function App" width="547" height="574" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa9c9bedcd.png 547w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bbfa9c9bedcd-286x300.png 286w" sizes="auto, (max-width: 547px) 100vw, 547px" /></p>
<h2 style="text-align: justify;">Add the PowerShell script</h2>
<p style="text-align: justify;">Once the Function is created, you will be directed to the &#8220;Function Name&#8221; run.ps1 file. There we can run PowerShell scripts.</p>
<p id="RlvLXyc" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2235 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bc06384d99f4.png" alt="Azure Function App" width="842" height="505" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bc06384d99f4.png 842w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bc06384d99f4-300x180.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bc06384d99f4-768x461.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bc06384d99f4-600x360.png 600w" sizes="auto, (max-width: 842px) 100vw, 842px" /></p>
<p style="text-align: justify;">Below is the script, change the required variables to fit your needs and paste it to the Function run.ps1 file. The variables that you need to change is:</p>
<p style="text-align: justify;">$WebsiteURLs | This is the list, comma separated, of the URLs you want to check for certificate expiration<br />
$From | The email address of the Sender<br />
$To | The email address of the Recipient<br />
$Cc | The email address of the CC Recipient<br />
$Subject | The subject of the email<br />
$SMTPServer | The email server you will use to send the emails. You can Use the SendGrid service from Azure that currenlty provides 25000 email per month for free. More details here: <a href="http://guidestomicrosoft.com/2016/02/17/configure-a-smtp-server-in-azure/">https://sendgrid.com/docs/API_Reference/SMTP_API/getting_started_smtp.html </a><br />
$SMTPPort | The port that the SMTP service requires<br />
$username | The username to authenticate to the SMTP Service<br />
$password = ConvertTo-SecureString &#8220;here you need to add the password in plain text&#8221; -AsPlainText -Force</p>
<pre class="lang:ps decode:true">$WebsiteURLs= @("e-apostolidis.gr","azureheads.gr")
$WebsitePort=443
$Threshold=120
$Severe=30
$ID=0

$body +=  "&lt;html&gt;&lt;body&gt;&lt;br&gt;"
$body +=  "&lt;font color =""darkblue""&gt;"
$body += "#	Website_URL:	Current Certificate:	Expiration Date:	Days Remaining:	Errors:"
foreach ($WebsiteURL in $WebsiteURLs){
$CommonName=$WebsiteURL
$ID+=1
Try{
$Conn = New-Object System.Net.Sockets.TcpClient($WebsiteURL,$WebsitePort) 
Try {
$Stream = New-Object System.Net.Security.SslStream($Conn.GetStream(),$false, {
param($sender, $certificate, $chain, $sslPolicyErrors) 
return $true
})
$Stream.AuthenticateAsClient($CommonName) 

$Cert = $Stream.Get_RemoteCertificate()
$CN=(($cert.Subject -split "=")[1] -split ",")[0]
$ValidTo = [datetime]::Parse($Cert.GetExpirationDatestring())

$ValidDays = $($ValidTo - [datetime]::Now).Days
if ($ValidDays -lt $Threshold) {
$fontcolor +=  "&lt;font color =darkgreen&gt;"
} 
if ($ValidDays -lt $Severe) {
$fontcolor +=  "&lt;font color =darkred&gt;"
}
$body += "&lt;br /&gt;"
$body += $fontcolor
$body += "$ID	$WebsiteURL	$CN	$ValidTo	$ValidDays"
}
Catch { Throw $_ }
Finally { $Conn.close() }
}
Catch {
$body += "&lt;br /&gt;"
$body +="&lt;font color=red&gt; gest &lt;/font&gt;"
$body += " $ID	$WebsiteURL"
$body +=  "&lt;/body&gt;&lt;/html&gt;"
}

}

$From = "alias@domain.gr"
$To = "alias@domain.gr"
$Cc = "alias@domain.gr"
$Subject = "check the certificates"

$SMTPServer = "mail.mailserver.gr"
$SMTPPort = "587"


$username = "username"
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$mycred = New-Object System.Management.Automation.PSCredential($username, $password)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { return $true }
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject -SmtpServer $SMTPServer -UseSSL -port $SMTPPort -Credential ($mycred) -Body $body -BodyAsHtml</pre>
<p style="text-align: justify;">Press SAve &amp; Run and you are ready. Now on, once per day the script will run and it will sent an email with the certificates. Something like this:</p>
<p id="fYgDHmV" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-2236 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/10/img_5bc0649bdf4ce.png" alt="Azure Function App" width="637" height="229" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bc0649bdf4ce.png 637w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bc0649bdf4ce-300x108.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/10/img_5bc0649bdf4ce-600x216.png 600w" sizes="auto, (max-width: 637px) 100vw, 637px" /></p>
<p style="text-align: justify;">Feel free to play with the colors on the script. I have added Dark Green for the valid certificates and Red for those that is about to expire.</p>
<h2 style="text-align: justify;">Credits</h2>
<p style="text-align: justify;">Use this line to ignore the certificate check on the email server when sending the email</p>
<pre class="prettyprint prettyprinted"><span class="pun">[</span><span class="typ">System</span><span class="pun">.</span><span class="typ">Net</span><span class="pun">.</span><span class="typ">ServicePointManager</span><span class="pun">]::</span><span class="typ">ServerCertificateValidationCallback</span> <span class="pun">=</span> <span class="pun">{</span> <span class="kwd">return</span><span class="pln"> $true </span><span class="pun">}</span></pre>
<p style="text-align: justify;"><a href="https://social.technet.microsoft.com/Forums/windows/en-US/d9e9af2b-3bb9-4cb4-8046-dd0a092bc456/send-email-by-powershell?forum=winserverpowershell">https://social.technet.microsoft.com/Forums/windows/en-US/d9e9af2b-3bb9-4cb4-8046-dd0a092bc456/send-email-by-powershell?forum=winserverpowershell</a></p>
<p style="text-align: justify;">The basic script for checking for certificate revocation:</p>
<p style="text-align: justify;"><a href="https://isc.sans.edu/forums/diary/Assessing+Remote+Certificates+with+Powershell/20645/">https://isc.sans.edu/forums/diary/Assessing+Remote+Certificates+with+Powershell/20645/</a></p>
<p style="text-align: justify;">At his blog is the idea for sending emails with powershell with html:</p>
<p style="text-align: justify;"><a href="http://www.techtrek.io/send-automated-email-with-powershell/">http://www.techtrek.io/send-automated-email-with-powershell/</a></p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div>
<div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:&#112;r&#111;x&#105;&#109;&#097;&#103;r&#064;&#104;o&#116;mai&#108;.c&#111;&#109;" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div>
</div>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fserverless-computing-check-your-expired-public-certificates%2F&amp;linkname=Serverless%20Computing%20%7C%20Check%20your%20expired%20public%20certificates" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fserverless-computing-check-your-expired-public-certificates%2F&amp;linkname=Serverless%20Computing%20%7C%20Check%20your%20expired%20public%20certificates" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fserverless-computing-check-your-expired-public-certificates%2F&#038;title=Serverless%20Computing%20%7C%20Check%20your%20expired%20public%20certificates" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/serverless-computing-check-your-expired-public-certificates/" data-a2a-title="Serverless Computing | Check your expired public certificates"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/serverless-computing-check-your-expired-public-certificates/">Serverless Computing | Check your expired public certificates</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/serverless-computing-check-your-expired-public-certificates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Custom pfSense on Azure Rm &#124; a complete guide</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/custom-pfsense-on-azurerm-a-complete-guide/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/custom-pfsense-on-azurerm-a-complete-guide/#comments</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Wed, 03 Jan 2018 15:12:52 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure vm]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[custom routes]]></category>
		<category><![CDATA[custom vhd]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[route tables]]></category>
		<category><![CDATA[udr]]></category>
		<category><![CDATA[upload vhd]]></category>
		<category><![CDATA[virtual network]]></category>
		<guid isPermaLink="false">https://www.e-apostolidis.gr/?p=1528</guid>

					<description><![CDATA[<p>Custom pfSense on Azure Rm &#124; a complete guide A complete guide on how to create a pfSense VM on</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/custom-pfsense-on-azurerm-a-complete-guide/">Custom pfSense on Azure Rm | a complete guide</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1 style="text-align: justify;">Custom pfSense on Azure Rm | a complete guide</h1>
<p style="text-align: justify;">A complete guide on how to create a pfSense VM on a local Hyper-V server, prepare it for Microsoft Azure, upload the disk to Azure and create a multi-NIC VM.</p>
<p style="text-align: justify;">Download the latest image from https://www.pfsense.org/download/</p>
<p id="UOGOgbu" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1719 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a46417942ce4.png" alt="pfsense" width="554" height="365" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46417942ce4.png 554w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46417942ce4-300x198.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46417942ce4-120x80.png 120w" sizes="auto, (max-width: 554px) 100vw, 554px" /></p>
<p style="text-align: justify;">Open Hyper-V Manager create a Generation 1 VM. I added 4096 ram, 2 cores, use VHD, add an extra NIC (for second interface)  and select the downloaded ISO. (create a fixed VHD as Azure supports only fixed VHDs for custom VMs)</p>
<p id="bWwoqGz" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1703 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a4612db0c33f.png" alt="pfsense" width="300" height="484" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4612db0c33f.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4612db0c33f-186x300.png 186w" sizes="auto, (max-width: 300px) 100vw, 300px" /></p>
<p style="text-align: justify;">Start the VM and at the first screen press enter.</p>
<p id="mIaxRHN" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1700 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a4611c229af2.png" alt="pfsense" width="626" height="384" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4611c229af2.png 626w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4611c229af2-300x184.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4611c229af2-600x368.png 600w" sizes="auto, (max-width: 626px) 100vw, 626px" /></p>
<p style="text-align: justify;">At all screens I accepted the default settings. Finally at the reboot prompt remove the installation ISO.</p>
<p style="text-align: justify;">There is no need to setup VLANs, select the second interface for WAN and the first for LAN.</p>
<p id="jLbbuSk" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1705 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a4614323b079.png" alt="pfsense" width="636" height="472" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4614323b079.png 636w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4614323b079-300x223.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4614323b079-600x445.png 600w" sizes="auto, (max-width: 636px) 100vw, 636px" /></p>
<p id="FNJPixZ" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1706 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a46147b409db.png" alt="pfsense" width="653" height="137" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46147b409db.png 653w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46147b409db-300x63.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46147b409db-600x126.png 600w" sizes="auto, (max-width: 653px) 100vw, 653px" /></p>
<p style="text-align: justify;">Once the pfSense is ready press 2 and change the LAN (hn0) interface IP to one at your network. Then select the option 14 to enable SSH.</p>
<p id="ZWseqdU" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1720 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a464549bd64f.png" alt="pfsense" width="633" height="438" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a464549bd64f.png 633w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a464549bd64f-300x208.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a464549bd64f-600x415.png 600w" sizes="auto, (max-width: 633px) 100vw, 633px" /></p>
<p style="text-align: justify;">Now we can login with putty, with username admin password pfsense and press 8 for Shell access.</p>
<p id="FNSfbHz" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1711 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a4619a436eb5.png" alt="pfsense" width="653" height="415" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4619a436eb5.png 653w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4619a436eb5-300x191.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a4619a436eb5-600x381.png 600w" sizes="auto, (max-width: 653px) 100vw, 653px" /></p>
<p style="text-align: justify;">The first thing is to update the packages running:</p>
<pre class="lang:sh decode:true ">pkg upgrade</pre>
<h2 style="text-align: justify;">Python</h2>
<p style="text-align: justify;">Then install Python, as it is requirement for the Azure Linux Agent.</p>
<p style="text-align: justify;">Search for Python packages running:</p>
<pre class="lang:sh decode:true ">pkg search python</pre>
<p id="jmunmwR" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1721 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a46475c9ca1b.png" alt="pfsense" width="631" height="112" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46475c9ca1b.png 631w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46475c9ca1b-300x53.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46475c9ca1b-600x106.png 600w" sizes="auto, (max-width: 631px) 100vw, 631px" /></p>
<p style="text-align: justify;">Install the latest Python package, setup tools and bash:</p>
<pre class="lang:sh decode:true">pkg install -y python27-2.7.14</pre>
<pre class="lang:ps decode:true">pkg search setuptools

pkg install py27-setuptools-36.2.2

ln -s /usr/local/bin/python /usr/local/bin/python2.7

pkg install -y bash</pre>
<h2 style="text-align: justify;">Azure Linux Agent</h2>
<p style="text-align: justify;">ref: <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/freebsd-create-upload-vhd">https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/freebsd-create-upload-vhd</a></p>
<pre class="lang:sh decode:true">pkg install git

git clone https://github.com/Azure/WALinuxAgent.git

cd WALinuxAgent

git tag

git checkout WALinuxAgent-2.1.1

git checkout WALinuxAgent-2.0.16

python setup.py install

ln -sf /usr/local/sbin/waagent /usr/sbin/waagent</pre>
<p style="text-align: justify;">check the agent is running:</p>
<pre class="lang:sh decode:true ">waagent -Version</pre>
<p id="XyDFgfJ" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1722 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a46540428ee9.png" alt="pfsense" width="536" height="54" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46540428ee9.png 536w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a46540428ee9-300x30.png 300w" sizes="auto, (max-width: 536px) 100vw, 536px" /></p>
<p style="text-align: justify;">One final step before uploading the VHD to Azure is to set the LAN interface as dhcp.</p>
<p style="text-align: justify;">This can be done by the web interface, go to https://lanaddress, login using admin / pfsense, and go to interfaces / LAN and select DHCPas ipv4 configuration.</p>
<p id="imfoSFv" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1725 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2017/12/img_5a469d4f2dd21.png" alt="pfsense" width="306" height="351" srcset="https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a469d4f2dd21.png 306w, https://www.cloudcorner.gr/wp-content/uploads/2017/12/img_5a469d4f2dd21-262x300.png 262w" sizes="auto, (max-width: 306px) 100vw, 306px" /></p>
<p style="text-align: justify;">Now, shutdown the pfSense and upload it to Azure Storage.</p>
<p style="text-align: justify;">I use the Storage Explorer, <a href="https://azure.microsoft.com/en-us/features/storage-explorer/">https://azure.microsoft.com/en-us/features/storage-explorer/</a> a free and powerful tool to manage Azure Storage. Login to your Azure Account and press Upload. Select as Blob type: &#8220;Page blob&#8221;</p>
<p id="rlEuHoA" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1739 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4cc0ac27e62.png" alt="pfsense" width="855" height="649" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cc0ac27e62.png 855w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cc0ac27e62-300x228.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cc0ac27e62-768x583.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cc0ac27e62-600x455.png 600w" sizes="auto, (max-width: 855px) 100vw, 855px" /></p>
<p style="text-align: justify;">After the upload is completed we can create a multiple NIC VM. This cannot be accomplished from GUI. We will create this using PowerShell.</p>
<pre class="lang:ps decode:true ">$ResourceGroupName = "******"
$pfresourcegroup = "*******"
$StorageAccountName = "******"
$vnetname = "*****"
$location = "West Europe"
$vnet = Get-AzureRmVirtualNetwork -Name $vnetname -ResourceGroupName $ResourceGroupName
$backendSubnet = Get-AzureRMVirtualNetworkSubnetConfig -Name default -VirtualNetwork $vnet
$vmName="pfsense"
$vmSize="Standard_F1"
$vnet = Get-AzureRmVirtualNetwork -Name $vnetname -ResourceGroupName $ResourceGroupName
$pubip = New-AzureRmPublicIpAddress -Name "PFPubIP" -ResourceGroupName $pfresourcegroup -Location $location -AllocationMethod Dynamic
$nic1 = New-AzureRmNetworkInterface -Name "EXPFN1NIC1" -ResourceGroupName $pfresourcegroup -Location $location -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pubip.Id
$nic2 = New-AzureRmNetworkInterface -Name "EXPFN1NIC2" -ResourceGroupName $pfresourcegroup -Location $location -SubnetId $vnet.Subnets[0].Id
$VM = New-AzureRmVMConfig -VMName $vmName -VMSize $vmSize
$VM | Set-AzureRmVMOSDisk `
            -VhdUri https://********.blob.core.windows.net/vhds/pfsensefix.vhd `
            -Name pfsenseos -CreateOption attach -Linux -Caching ReadWrite
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic1.Id
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic2.Id
$vm.NetworkProfile.NetworkInterfaces.Item(0).Primary = $true
New-AzureRMVM -ResourceGroupName $pfresourcegroup -Location $locationName -VM $vm -Verbose</pre>
<p style="text-align: justify;">Once the VM is created, go to the VM&#8217;s blade and scroll down to &#8220;Boot diagnostics&#8221;. There you can see a screenshot of the VM&#8217;s monitor.</p>
<p id="acIPyky" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1744 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4cddde2157b.png" alt="pfsense" width="1002" height="707" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cddde2157b.png 1002w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cddde2157b-300x212.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cddde2157b-768x542.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cddde2157b-600x423.png 600w" sizes="auto, (max-width: 1002px) 100vw, 1002px" /></p>
<p style="text-align: justify;">Then go to the Networking section and SSH to the Public IP.</p>
<p id="RpmtQJA" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1746 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4ce2adeacc3.png" alt="pfsense" width="673" height="547" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce2adeacc3.png 673w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce2adeacc3-300x244.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce2adeacc3-600x488.png 600w" sizes="auto, (max-width: 673px) 100vw, 673px" /></p>
<p style="text-align: justify;">and also we can login to the Web Interface of the pfSense</p>
<p id="RTPgdSW" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1747 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4ce3fe0353a.png" alt="pfsense" width="882" height="630" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce3fe0353a.png 882w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce3fe0353a-300x214.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce3fe0353a-768x549.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce3fe0353a-600x429.png 600w" sizes="auto, (max-width: 882px) 100vw, 882px" /></p>
<p id="YIHfCde" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1748 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4ce85fe97a1.png" alt="pfsense" width="1161" height="857" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce85fe97a1.png 1161w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce85fe97a1-300x221.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce85fe97a1-768x567.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce85fe97a1-1024x756.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce85fe97a1-600x443.png 600w" sizes="auto, (max-width: 1161px) 100vw, 1161px" /></p>
<p style="text-align: justify;">In my case I have added both NICs at the same Subnet, but at a production environment add the LAN interface to the backend subnet and the WAN interface to the DMZ (public) subnet.</p>
<p style="text-align: justify;">Of course more NICs can be added to the VM, one for each Subnet at our environment.</p>
<h2 style="text-align: justify;">Route external traffic through the pfSense</h2>
<p style="text-align: justify;">We cannot change the gateway at an Azure VM, but we can use routing tables to route the traffic through the pfSense.</p>
<p style="text-align: justify;">From the Azure Portal, select New and search for Route table.</p>
<p id="OKjEcPT" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1749 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4ce9f90f26b.png" alt="pfsense" width="1037" height="309" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce9f90f26b.png 1037w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce9f90f26b-300x89.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce9f90f26b-768x229.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce9f90f26b-1024x305.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ce9f90f26b-600x179.png 600w" sizes="auto, (max-width: 1037px) 100vw, 1037px" /></p>
<p style="text-align: justify;">We need to configure two things. One is to associate the Route table to a Subnet and the second is to create a Route.</p>
<p id="uHNKvMv" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1750 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4ceae539c0b.png" alt="pfsense" width="232" height="111" /></p>
<p style="text-align: justify;">Open the &#8220;Route table&#8221; and click the &#8220;Routes&#8221;. Press &#8220;Add route&#8221; and in order to route all outbound traffic through the pfSense then add for Address prefix &#8220;0.0.0.0&#8221;, next hop type Virtual appliance&#8221; and Net hop address the ip address of the pfSense&#8217;s LAN interface IP.</p>
<p id="feCVtbZ" style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone wp-image-1751 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4cec67cf571.png" alt="pfsense" width="569" height="302" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cec67cf571.png 569w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4cec67cf571-300x159.png 300w" sizes="auto, (max-width: 569px) 100vw, 569px" /></p>
<p>Then go to the &#8220;Subnets&#8221; and associate the required subnets.</p>
<p id="IgXjKZN"><img loading="lazy" decoding="async" class="alignnone wp-image-1753 size-full" src="https://www.e-apostolidis.gr/wp-content/uploads/2018/01/img_5a4ced5dacef4.png" alt="pfsense" width="1068" height="430" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ced5dacef4.png 1068w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ced5dacef4-300x121.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ced5dacef4-768x309.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ced5dacef4-1024x412.png 1024w, https://www.cloudcorner.gr/wp-content/uploads/2018/01/img_5a4ced5dacef4-600x242.png 600w" sizes="auto, (max-width: 1068px) 100vw, 1068px" /></p>
<p>One final thing to do is to enable IP Forwarding at the LAN interface of the pfSense, in order to be able to receive and forward traffic not originated for it.</p>
<p id="vsIVpQc"><img loading="lazy" decoding="async" width="907" height="321" class="alignnone size-full wp-image-1807 " src="https://www.e-apostolidis.gr/wp-content/uploads/2018/02/img_5a83ec9159a98.png" alt="" srcset="https://www.cloudcorner.gr/wp-content/uploads/2018/02/img_5a83ec9159a98.png 907w, https://www.cloudcorner.gr/wp-content/uploads/2018/02/img_5a83ec9159a98-300x106.png 300w, https://www.cloudcorner.gr/wp-content/uploads/2018/02/img_5a83ec9159a98-768x272.png 768w, https://www.cloudcorner.gr/wp-content/uploads/2018/02/img_5a83ec9159a98-600x212.png 600w" sizes="auto, (max-width: 907px) 100vw, 907px" /></p>
<p>&nbsp;</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div>
<div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:p&#114;&#111;&#120;&#105;&#109;&#097;gr&#064;&#104;otm&#097;&#105;l.&#099;om" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div>
</div>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fcustom-pfsense-on-azurerm-a-complete-guide%2F&amp;linkname=Custom%20pfSense%20on%20Azure%20Rm%20%7C%20a%20complete%20guide" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fcustom-pfsense-on-azurerm-a-complete-guide%2F&amp;linkname=Custom%20pfSense%20on%20Azure%20Rm%20%7C%20a%20complete%20guide" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fcustom-pfsense-on-azurerm-a-complete-guide%2F&#038;title=Custom%20pfSense%20on%20Azure%20Rm%20%7C%20a%20complete%20guide" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/custom-pfsense-on-azurerm-a-complete-guide/" data-a2a-title="Custom pfSense on Azure Rm | a complete guide"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/custom-pfsense-on-azurerm-a-complete-guide/">Custom pfSense on Azure Rm | a complete guide</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/custom-pfsense-on-azurerm-a-complete-guide/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
		<item>
		<title>Create Azure File Shares at your ARM template using PowerShell</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/create-azure-file-shares-using-arm-template-powershell/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/create-azure-file-shares-using-arm-template-powershell/#respond</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Thu, 28 Sep 2017 13:51:43 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[IaC]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure file storage]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[template]]></category>
		<guid isPermaLink="false">https://www.e-apostolidis.gr/?p=1499</guid>

					<description><![CDATA[<p>Create Azure File Shares at your ARM template using PowerShell Using Azure Resource Manage template deployment, you can create a</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/create-azure-file-shares-using-arm-template-powershell/">Create Azure File Shares at your ARM template using PowerShell</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Create Azure File Shares at your ARM template using PowerShell</h2>
<p style="text-align: justify;">Using Azure Resource Manage template deployment, you can create a Storage account but you cannot create File Shares. Azure File Shares can be created using the Azure Portal, the Azure PowerShell or the Azure Cli.</p>
<p style="text-align: justify;">Mainly, the idea is to run a PowerShell script that will create the File Shares. This script will be invoked inside the ARM Template. In order to use a PowerShell script from a template, the script must be called from a URL. A good way to provide this is using the Git repository.  One major thing to consider is the Storage Account key must be provided to the PowerShell script securely, since the PowerShell script is at a public URL.</p>
<p style="text-align: justify;">The PowerShell script will run inside a Virtual Machine and we will use a CustomScriptExtension Extension to provide it. To use this, at the Virtual Machine Resource of the JSON file add a resources section.</p>
<p style="text-align: justify;">The Custom Script Exception is located at the Virtual Machine resource. Lets assume that the last part of the Virtual Machine resource is the &#8220;diagnosticsProfile&#8221; so after the closure of the &#8220;diagnosticsProfile&#8221; we can add the &#8220;resources&#8221;. Inside the &#8220;resources&#8221; add the &#8220;extensions&#8221; resource that will add the &#8220;CustomScriptExtension&#8221;, like below.</p>
<h3>The Template Part</h3>
<p>This will be the addition at the Virtual Machine resource:</p>
<pre class="theme:vs2012 lang:asp decode:true"> "diagnosticsProfile": {
          "bootDiagnostics": {
            "enabled": true,
            "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('diagnosticStorageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
          }
        }
        },
        "resources": [
          {
            "name": "AzureFileShares",
            "type": "extensions",
            "location": "[variables('location')]",
            "apiVersion": "2016-03-30",
            "dependsOn": [
              "[resourceId('Microsoft.Compute/virtualMachines', parameters('VMName'))]",
              "[variables('AzureFilesStorageId')]"
            ],
            "tags": {
              "displayName": "AzureFileShares"
            },
            "properties": {
              "publisher": "Microsoft.Compute",
              "type": "CustomScriptExtension",
              "typeHandlerVersion": "1.4",
              "autoUpgradeMinorVersion": true,
              "settings": {
                "fileUris": [
                  "https://raw.githubusercontent.com/######/#####/master/azurefiles.ps1"
                ]
              },
              "protectedSettings": {
               "commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ','azurefiles.ps1 -SAName ',parameters('AzureFilesStorageName'),'  -SAKey ', listKeys(resourceId(variables('AzureFilesStorageAccountResourceGroup'),'Microsoft.Storage/storageAccounts', parameters('AzureFilesStorageName')), '2015-06-15').key1)]" 
             }
            }
          }
        ]
    },</pre>
<p style="text-align: justify;">The extension must be depended from the Virtual Machine that will run the script and the Storage Account that will bu used for the file shares.</p>
<p style="text-align: justify;">At the custom script properties add the public RAW url of the PowerShell script.</p>
<p style="text-align: justify;">Next lets see the Storage Account key and execution part. At the connandToExecute section, we will provide a variable that will pass the Storage Account key &amp; Name inside the script for execution. The variable will get the Storage Account key from the Storage Account using the permissions of the Account  running the Template Deployment.</p>
<p style="text-align: justify;">Of course to make the template more flexible I have added a variable for the Resource Group and a parameter for the AzureFilesStorageName, so the template will ask for the Storage Account name at the parameters.</p>
<h3>The PowerShell</h3>
<p>The PowerShell script is tested at Windows Server 2016 VM. You can find it below:</p>
<pre class="lang:ps decode:true ">Param (
  [Parameter()]
  [String]$SAKey,
  [String]$SAName
)
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module Azure -Confirm:$False
Import-Module Azure
$storageContext = New-AzureStorageContext -StorageAccountName $SAName -StorageAccountKey $SourceSAKey
$storageContext |  New-AzureStorageShare -Name #####</pre>
<p>&nbsp;</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div>
<div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:pro&#120;&#105;&#109;a&#103;&#114;&#064;&#104;&#111;&#116;m&#097;&#105;&#108;.co&#109;" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div>
</div>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fcreate-azure-file-shares-using-arm-template-powershell%2F&amp;linkname=Create%20Azure%20File%20Shares%20at%20your%20ARM%20template%20using%20PowerShell" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fcreate-azure-file-shares-using-arm-template-powershell%2F&amp;linkname=Create%20Azure%20File%20Shares%20at%20your%20ARM%20template%20using%20PowerShell" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fcreate-azure-file-shares-using-arm-template-powershell%2F&#038;title=Create%20Azure%20File%20Shares%20at%20your%20ARM%20template%20using%20PowerShell" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/create-azure-file-shares-using-arm-template-powershell/" data-a2a-title="Create Azure File Shares at your ARM template using PowerShell"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/create-azure-file-shares-using-arm-template-powershell/">Create Azure File Shares at your ARM template using PowerShell</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/create-azure-file-shares-using-arm-template-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Add multiple managed disks to Azure RM VM</title>
		<link>https://www.cloudcorner.gr/microsoft/azure/add-multiple-managed-disks-to-azure-rm-vm/</link>
					<comments>https://www.cloudcorner.gr/microsoft/azure/add-multiple-managed-disks-to-azure-rm-vm/#comments</comments>
		
		<dc:creator><![CDATA[Pantelis Apostolidis]]></dc:creator>
		<pubDate>Fri, 08 Sep 2017 14:29:54 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azurerm]]></category>
		<category><![CDATA[managed disks]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[windows server]]></category>
		<guid isPermaLink="false">https://www.e-apostolidis.gr/?p=1484</guid>

					<description><![CDATA[<p>Add multiple managed disks to Azure RM VM In this post I have created a PowerShell script to help add</p>
<p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/add-multiple-managed-disks-to-azure-rm-vm/">Add multiple managed disks to Azure RM VM</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1>Add multiple managed disks to Azure RM VM</h1>
<p>In this post I have created a PowerShell script to help add multiple managed disks to an Azure RM Virtual Machine.</p>
<p>The script to add multiple managed disks will prompt you to login to an Azure RM account, then it will query the subscriptions and ask you to select the desired. After that it will query the available VMs and promt to select the target VM from the VM list.</p>
<p>At this point I am checking the OS disk and define the storage type of the data disk. If we need to change the storage type we can check the comments at step 4. e.g. If the OS disk is Premium and you want Standard data disks.</p>
<p>The next step is to ask for disk size. You can check the sizes and billing here: <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/windows/managed-disks-overview#pricing-and-billing">https://docs.microsoft.com/en-us/azure/virtual-machines/windows/managed-disks-overview#pricing-and-billing</a></p>
<p>Finally it will ask for the number of the disk we need to create. After this input the script will create the disks, attach them to the VM and update it.</p>
<h3>The Script:</h3>
<pre class="lang:ps decode:true "># 1. You need to login to the Azure Rm Account

Login-AzureRmAccount

# 2. The script will query the Subscriptions that the login account has access and will promt the user to select the target Subscription from the drop down list
 
$subscription = Get-AzureRmSubscription | Out-GridView -Title "Select a Subscription" -PassThru
Select-AzureRmSubscription -SubscriptionId $subscription.Id

# 3. The script will query the available VMs and promt to select the target VM from the VM list
 
$vm = Get-AzureRmVM | Out-GridView -Title "Select the Virtual Machine to add Data Disks to" -PassThru

# 4. I set the storage type based on the OS disk. If you want to spesify somehting else you can cahnge this to: $storageType = StandardLRS or PremiumLRS etc.

$storageType = $VM.StorageProfile.OsDisk.ManagedDisk.StorageAccountType

# 5. The script will promt for disk size, in GB

$diskSizeinGB = Read-Host "Enter Size for each Data Disk in GB"

$diskConfig = New-AzureRmDiskConfig -AccountType $storageType -Location $vm.Location -CreateOption Empty -DiskSizeGB $diskSizeinGB

# 6. Enter how many data disks you need to create
 
$diskquantity = Read-Host "How many disks you need to create?"

for($i = 1; $i -le $diskquantity; $i++)
{
$diskName = $vm.Name + "-DataDisk-" + $i.ToString()
$DataDisk = New-AzureRmDisk -DiskName $diskName -Disk $diskConfig -ResourceGroupName $vm.ResourceGroupName
$lun = $i - 1
Add-AzureRmVMDataDisk -VM $vm -Name $DiskName -CreateOption Attach -ManagedDiskId $DataDisk.Id -Lun $lun
}

Update-AzureRmVM -VM $vm -ResourceGroupName $vm.ResourceGroupName</pre>
<p>You can download the script from here: <a href="https://www.e-apostolidis.gr/wp-content/uploads/2017/09/AddManagedDisks.zip">AddManagedDisks</a></p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.e-apostolidis.gr/wp-content/uploads/2019/05/mvpsummit2019.jpg" width="100"  height="100" alt="Pantelis Apostolidis" itemprop="image"></div>
<div class="saboxplugin-authorname"><a href="https://www.cloudcorner.gr/author/admin/" class="vcard author" rel="author"><span class="fn">Pantelis Apostolidis</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="https://www.cloudcorner.gr" target="_self" >www.cloudcorner.gr</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Facebook" target="_blank" href="https://www.facebook.com/pantelis.apostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a><a title="Linkedin" target="_blank" href="https://www.linkedin.com/in/papostolidis/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M100.3 480H7.4V180.9h92.9V480zM53.8 140.1C24.1 140.1 0 115.5 0 85.8 0 56.1 24.1 32 53.8 32c29.7 0 53.8 24.1 53.8 53.8 0 29.7-24.1 54.3-53.8 54.3zM448 480h-92.7V334.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V480h-92.8V180.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V480z"></path></svg></span></a><a title="Instagram" target="_blank" href="https://www.instagram.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></span></a><a title="Rss" target="_blank" href="https://wwwcloudcorner.gr/feed/rdf/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg></span></a><a title="Twitter" target="_blank" href="https://twitter.com/papostolidis" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Github" target="_blank" href="https://github.com/proximagr" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-github" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></span></a><a title="User email" target="_self" href="mailto:p&#114;&#111;&#120;ima&#103;r&#064;hot&#109;ai&#108;.&#099;om" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-user_email" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg></span></a></div>
</div>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fadd-multiple-managed-disks-to-azure-rm-vm%2F&amp;linkname=Add%20multiple%20managed%20disks%20to%20Azure%20RM%20VM" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_print" href="https://www.addtoany.com/add_to/print?linkurl=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fadd-multiple-managed-disks-to-azure-rm-vm%2F&amp;linkname=Add%20multiple%20managed%20disks%20to%20Azure%20RM%20VM" title="Print" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.cloudcorner.gr%2Fmicrosoft%2Fazure%2Fadd-multiple-managed-disks-to-azure-rm-vm%2F&#038;title=Add%20multiple%20managed%20disks%20to%20Azure%20RM%20VM" data-a2a-url="https://www.cloudcorner.gr/microsoft/azure/add-multiple-managed-disks-to-azure-rm-vm/" data-a2a-title="Add multiple managed disks to Azure RM VM"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" alt="Share"></a></p><p>The post <a href="https://www.cloudcorner.gr/microsoft/azure/add-multiple-managed-disks-to-azure-rm-vm/">Add multiple managed disks to Azure RM VM</a> appeared first on <a href="https://www.cloudcorner.gr">Apostolidis Cloud Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.cloudcorner.gr/microsoft/azure/add-multiple-managed-disks-to-azure-rm-vm/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
