<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2528 " id="quads-ad2528" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>

<p>If you ever needed to add multiple ports or range of ports endpoints to a particular Virtual machine on Azure. you might have a difficulty doing this since it’s not allowed by design and that will require time to do this manually for range of ports. that’s where this article comes handy.</p>
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2524 " id="quads-ad2524" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>

<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2522 " id="quads-ad2522" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>

<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2527 " id="quads-ad2527" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>




<p>To achieve this first you will need to connect to your Azure subscription on Azure powershell. <a href="http://www.google.com/url?q=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fwindowsazure%2Fjj554332.aspx&;sa=D&;sntz=1&;usg=AFQjCNH9f6WllUyrtDSFJuRSDbojS_hA3g" target="_blank" rel="noreferrer noopener">Azure PowerShell</a>.</p>



<p>Run Azure powershell as an administrator and type the following cmdlet to get your subscription info</p>



<p>Get-AzurePublishSettingsFile</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-mKEvmyU1SKw/VaHEDytSNkI/AAAAAAAAQF8/AjL9aj21Ymg/s1600-h/clip_image001%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh5.googleusercontent.com/o3WBYn3Wp2X_fkGj_VKHTK_FLmLAKxyWxb9QKyUzZFzOm894qgD8ASbwJ7d8yfgjkWriVK9ndA=w673" alt="clip_image001"/></a> 

<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2531 " id="quads-ad2531" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>
 
</figure>



<p>This will open a page and ask you to sign in to your Azure user account and download a file called Visual Studio Premium with MSDN-DATE-credentials.publishsettings</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-_KYc59eEGK8/VaHEGYea2HI/AAAAAAAAQGM/N-6lFmoJkWY/s1600-h/clip_image002%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh4.googleusercontent.com/M7cuXkcqpMz_Jx9ZxVzlFlEAYFL4NTn_JePbkin9gX5OOWx1exp9g44lXedwCy1u6WnpRG6zrXpfd4iqA4rNXppI_lGt-pWw6xr8vdCv6dyRbrQMiA=w673" alt="clip_image002"/></a></figure>



<p>In the powershell you will have to navigate to where the file is located. And import the settings that have just been downloaded in that file</p>



<p>Import-azurepublishSettingsFile `.\Visual Studio FileLocation`</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-0A9p8pMyJFg/VaHEJdhyEPI/AAAAAAAAQGc/1INE__aNpug/s1600-h/clip_image003%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh6.googleusercontent.com/30owz8Q2_vGxNLZWBWNFiwk6LTFAA8lsEBqG2aAzIK2Y9CKM4GseKRw5LQohO0j__HwTrcOvu-nc2botmt-5LhvjA_eznpIjZvvifPluAdMmKauv2m0=w673" alt="clip_image003"/></a></figure>



<p>You can check for your account and Subscription, using Get-azureaccount script</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-_xazNGh7qqk/VaHELPRcozI/AAAAAAAAQGs/Nlbj3E4sZ8U/s1600-h/clip_image004%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh3.googleusercontent.com/aYRJGmN0nYb15EOJo1p9hIlihvC5p67WKsXuj7h0IDatc1WbjCLhceVpuMoW30GoO5nTvGGvRvF3DzIwAONMmOshwRiB_N-N9byqKlxsZYtNibEk2hE=w673" alt="clip_image004"/></a></figure>



<p>Now I have setup a ubuntu Machine on Azure that hosts Openfire Chat server which requires 10000-10005 port range for the media service. On Azure Web interface the port range option is not yet supported. The only available option is through powershell which will open the required port range for us.</p>



<p>To do so I&#8217;ll use the following cmdlet highlighting the required information to enter</p>
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2530 " id="quads-ad2530" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>




<p>To create endpoints for ports 10000-10005:</p>



<p>$vm = Get-AzureVM -ServiceName <strong>moh10ly</strong> -Name <strong>ubunut-mohammed</strong> ; 10000..10005 | ForEach { $VM | Add-AzureEndpoint -Name <strong>TestEndpoint</strong>$_ -Protocol TCP -LocalPort $_ -PublicPort $_} ; $vm | Update-AzureVM</p>



<p>To Acquire your service name, you can simply login to Azure portal and check out All Items and see the cloud service name .. Just like the below screenshot</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-woVAG_ZuzsY/VaHENFdVQyI/AAAAAAAAQG8/sVOWDsG-XZU/s1600-h/clip_image005%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh3.googleusercontent.com/fcGaszzrC2TWjIOOj42ylTZHMzRyU92IafVrcFtCGSxgxeje6PknPTHQJ0SSoEiQlsnoyY-WyCp-4YoVR7m-oRLUPpihgaT4y0Z-ZuMUmjxFKP1GRWbp=w673" alt="clip_image005"/></a></figure>



<p>To Check your VMname simply navigate to Virtual machines tab and on the right side you can see the name.. I have copied it as well in the command.</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-hIKNWnDL6ng/VaHEPD_sTZI/AAAAAAAAQHM/osfwXMSTQoU/s1600-h/clip_image006%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh6.googleusercontent.com/WPGfkZKjSUzEGMkNboBRad8S9b0-RpX-7DwayonfcqvFBF0YnwVxgPK41eP9Zg2_1sHVsgipQSH6vKqTEfGHvLUmSEgkCTVcXF1AQnEn-MbKhz2ZXPE=w673" alt="clip_image006"/></a></figure>



<p>Once you edited the cmdlet with your information you can enter it in the Powershell and enter</p>



<p>It should return something like this.</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-C4HKdbfELnk/VaHEQwNhWZI/AAAAAAAAQHc/zxYLru7nOco/s1600-h/clip_image007%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh5.googleusercontent.com/Ncr9yEi1dLU_77Ny-2T5LnBCHH_ktvHEODLbWnFAW6nz_AbnDnSp2mDBCOzPIHwIG8GjW8VlARKSzwAHcBom5K8G9FzsJFzuEy4f2c0sOZv4zM5KeA=w673" alt="clip_image007"/></a></figure>



<p>Once finished you can check Azure end point portal for the new ports configuration</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-OpDPuu7cs3w/VaHESypLieI/AAAAAAAAQHs/yasdE7qe51g/s1600-h/clip_image008%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh5.googleusercontent.com/ira3BtdASdDGWqFMe2hWHp2tcfZhUDZ2Z9UAKclC59Vtpuj4s7m0-KvmmCSvbIKEuJGPRnFMvnzyHnPoaUQz1qGutrA1AJ-o5yZ2k6TvoaajWmaPZ0g=w673" alt="clip_image008"/></a></figure>



<p>Here we go .. Ports are created in Azure</p>



<figure class="wp-block-image"><a href="http://lh3.googleusercontent.com/-ng7arttpQi4/VaHEU2-docI/AAAAAAAAQH8/RxsH5_fF2FE/s1600-h/clip_image009%25255B3%25255D.png" target="_blank" rel="noreferrer noopener"><img src="https://lh5.googleusercontent.com/txHe3LBgv1PiFdCGE8p-1vutdmpJAmMhQuR5FUUXKgPmhNR9GI64cfn5SLl-gYbWX70ZGRn9dGOcNRrt1uaQDQjWhSPQ7sI9RfXvhpfZ-QtxiorhTU8=w673" alt="clip_image009"/></a></figure>



<p>To remove the endpoints for ports 10000-10005:</p>
<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2523 " id="quads-ad2523" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>




<p>$vm = Get-AzureVM -ServiceName <strong>moh10ly</strong> -Name <strong>ubunut-mohammed</strong> ; 10000..10005 | ForEach { $VM | Remove-AzureEndpoint -Name <strong>TestEndpoint</strong>$_} ; $vm | Update-AzureVM</p>

<!-- WP QUADS Content Ad Plugin v. 2.0.92 -->
<div class="quads-location quads-ad2529 " id="quads-ad2529" style="float:none;margin:0px 3px 3px 3px;padding:0px 0px 0px 0px;" data-lazydelay="0">

</div>


Reset and manage your Active Directory users' Passwords Active Directory is one of the most…
Finding Exchange Database hidden mailboxes. Story:Maybe you have been in this situation before, trying to…
If you're using a Proxy server in your firewall or in your network and have…
Story:I got some clients that have reported some of their users being locked out and…
Delegate Permissions This is a code that I have wrote recently to check if an…
Story: I got a request from a client who constantly gets CVs and have to…