<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>It's getting cloudy!</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/azure4fun/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/azure4fun/feed.xml</link>
    <description>A skydive in the clouds! Well, MS Azure ...</description>
    <lastBuildDate>Sat, 15 Apr 2017 15:10:13 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Deploying Docker EE on Azure &amp; solving common issues</title>
      <link>https://docs.microsoft.com/archive/blogs/azure4fun/deploying-docker-ee-on-azure-solving-common-issues</link>
      <pubDate>Sat, 15 Apr 2017 14:29:24 GMT</pubDate>
      <dc:creator><![CDATA[Ahmed Farag]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.msdn.microsoft.com/azure4fun/?p=215</guid>
      <description><![CDATA[We are in the era of cloud computing. Many customers are rushing to accelerate their digital...]]></description>
      <content:encoded><![CDATA[We are in the era of cloud computing. Many customers are rushing to accelerate their digital transformation. In the same time the cloud providers are getting better and better by the minute. Literally!

That leaves a lot of the IT leaders no choice but to think carefully about their strategies to move to the cloud. One of the things that is very popular now is containers.

In the context of digital transformation and cloud migration its appealing for <span style="text-decoration: underline"><strong>the following reasons:</strong></span>
<p style="padding-left: 30px">1- Provides an abstraction layer from the underlying infrastructure layer.</p>
<p style="padding-left: 60px">That gives organizations the flexibility of moving their workloads easily and host them in different infrastructure anytime whether it is on-premises or in the cloud. So, you are not locked-in to a specific cloud provider nor to your own on-premises datacenter.</p>
<p style="padding-left: 30px">2- Gives you the ability to optimize the usage of your infrastructure by increasing the density of your workloads</p>
<p style="padding-left: 30px">3- It’s a great architecture for implement continuous integration, continuous deployment pipeline.</p>
One of the great containers platforms out there is Docker. It’s supported in Azure. You can deploy a Docker DC/OS container cluster leveraging the <a href="https://docs.microsoft.com/en-us/azure/container-service/container-service-intro">Azure Container Service</a>.

You also have the option of Deploying the enterprise version of Docker that is available on the <a href="https://azuremarketplace.microsoft.com/en-us/marketplace/apps/docker.dockerdatacenter?tab=Overview">Marketplace</a>.

In this article, I will cover how to deploy a Docker EE (Standard/Advanced) cluster in Azure and I will touch on a common error that users fall into that breaks their deployment.

The deployment of a Docker EE cluster in Azure is straight forward.
<h3>To deploy a Docker EE cluster, you need the following</h3>
<ol>
 	<li>Azure subscription</li>
 	<li>Azure Application principal</li>
 	<li>RSA SSH Key</li>
</ol>
<h3>Azure subscription</h3>
This will allow you to leverage the Azure cloud services and create virtual machines, database …etc. You need a subscription to be able to deploy the virtual machines and other resources required to host your Docker cluster. Luckily you can get a free trail one here.
<h3>Azure Application principal</h3>
Azure App principal aka Azure AD Application refers to an identity object (resource) that can be created in Azure AD that allows applications (Code or script) to authenticate and be authorized (similar to Azure AD users) to access Azure resources or any resources that Azure AD integrates with.

In simple terms, think of it as a service account used by applications to access resources that are linked with your Azure AD directory. Similar to a service account, an App principal will have the following:
<ul>
 	<li>Principal name --&gt; User Name</li>
 	<li>App principal ID or (App ID) --&gt; User ID</li>
 	<li>App Secret --&gt; Password</li>
</ul>
Check the additional resources section at the end of the article for link to a resource with more details.
<h3>Why do we need an App Principal for a Docker cluster?</h3>
It’s used by the Docker orchestrator to manage your cluster in Azure. Docker uses the App principal (Service principal) to be authorized to access the Azure subscription via the Azure APIs to change your cluster underlying infrastructure when required. For example, scale up or down the number of nodes (VMs) and/or configure the azure load balancer.
<h3>RSA SSH Key</h3>
Used to SSH to your manager nodes.
<h3>Steps to deploy a Docker EE cluster</h3>
<ol>
 	<li>Create an Azure resource group</li>
 	<li>Create an App Principal</li>
 	<li>Assign the App Principal from <strong>step #2</strong> a permission on the group created on <strong>step #1</strong></li>
 	<li>Create your DockerEE cluster using the app principal created in <strong>step #2</strong> and select the resource group created in <strong>step #1</strong></li>
</ol>
&nbsp;
<h3>First: <span style="text-decoration: underline">Create a resource group</span></h3>
<p style="padding-left: 30px">1- Go to <a href="https://Portal.Azure.com">https://Portal.Azure.com</a></p>
<p style="padding-left: 30px">2- Click on the <strong>+</strong> sign from the left nav to add a new resource | select or type <strong>resource group</strong></p>
<p style="padding-left: 30px">3- Provide <strong>Resource group</strong> <strong>name</strong>, <strong>Subscription</strong> and <strong>Resource group location</strong></p>
              <a href="https://msdnshared.blob.core.windows.net/media/2017/04/CreateResourceGroup.png"><img width="723" height="381" class="alignnone wp-image-315 size-full" alt="createresourcegroup" src="https://msdnshared.blob.core.windows.net/media/2017/04/CreateResourceGroup.png" /></a>
<h3>Create resource group [Azure CLI]</h3>
&nbsp;
<pre style="padding-left: 30px">ahmed@Azure:~$ <span style="color: #99cc00">az</span> group create -n DockerEECDemo --location southcentralus</pre>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/CreateRGBash.png"><img width="1024" height="208" class="wp-image-325 size-large" alt="Create Resource Group Azure CLI" src="https://msdnshared.blob.core.windows.net/media/2017/04/CreateRGBash-1024x208.png" /></a></p>
&nbsp;
<h3>Second: <span style="text-decoration: underline">Create an App principal</span></h3>
&nbsp;
<ol>
 	<li>Go to <a href="https://Portal.Azure.com">https://Portal.Azure.com</a></li>
 	<li>Click (or search for) the<strong> Azure Active Directory</strong> icon from the left nav | select or type <strong>App registration</strong> | <strong>New application registration</strong></li>
 	<li>Provide a <strong>Name</strong>, leave the default settings of <strong>Application type</strong> = “Web app/API” and provide any random URL at <strong>Sign-on URL</strong> field</li>
 	<li>Press <strong>Create</strong></li>
</ol>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/CreateAppPrin.png"><img width="574" height="498" class="size-full wp-image-275 alignnone" alt="createappprin" src="https://msdnshared.blob.core.windows.net/media/2017/04/CreateAppPrin.png" /></a></p>
&nbsp;

<strong>Then you need to issue a key for the app principal</strong>
<ol>
 	<li>Click on <strong>Settings</strong> | <strong>Keys</strong></li>
 	<li>Type a <strong>Description</strong> for the key and choose the <strong>Expires</strong> time | Press <strong>Save</strong></li>
 	<li>Copy the <strong>Application ID</strong> = [Principal App ID] &amp; Key <strong>Value</strong> = [Principal App Secret] to somewhere safe as you will need to use them later</li>
</ol>
<a href="https://msdnshared.blob.core.windows.net/media/2017/04/IssueKeySecret.png"><img width="1709" height="662" class="size-full wp-image-395 alignnone" alt="issuekeysecret" src="https://msdnshared.blob.core.windows.net/media/2017/04/IssueKeySecret.png" /></a><a href="https://msdnshared.blob.core.windows.net/media/2017/04/CopyAppID.png"></a>

&nbsp;
<h3>Third: <span style="text-decoration: underline">Assign permission to the new App Principal to the resource group</span></h3>
&nbsp;
<p style="padding-left: 30px">This step is forgotten by most people. If this step is not performed and your App principal doesn’t have inherited contribute permissions on the resource group, your DTR portal provisioning will silently fail and will never load.</p>
<strong>Steps to grant the App principal contribute permission</strong>
<ol>
 	<li>Go to the resource group you have created | Click on <strong>Access Control (IAM)</strong> from the left nav | <strong>Add</strong></li>
 	<li>Select the role <strong>Contributor</strong> | find the created app principal using the field <strong>Select</strong> | select the right one from the list of results</li>
 	<li>Press <strong>Save</strong></li>
</ol>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/AddPermission.png"><img width="1371" height="958" class="size-full wp-image-237 alignnone" alt="addpermission" src="https://msdnshared.blob.core.windows.net/media/2017/04/AddPermission.png" /></a></p>

<pre></pre>
<h3>Forth: <span style="text-decoration: underline">Create DockerEE cluster</span></h3>

&nbsp;

Now you are ready to create your DockerEE cluster. Assuming you already has an RSA SSH key pair generated. If not, please follow <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-ssh-keys-detailed">this article</a> for directions on how to get that done.

1- Go to <a href="https://Portal.Azure.com">https://Portal.Azure.com</a>

2- Click on the<strong> +</strong> sign from the left nav to add a new resource | search for <strong>Docker EE for Azure (Standard/Advanced)</strong>

3- Select <strong>Docker EE for Azure (Standard/Advanced)</strong> from the search results

4- Press <strong>Create</strong>

5- Provide the following values

<ul>
 	<li><strong>Swarm Name</strong>: dockerswarm</li>
 	<li><strong>Service Principal App ID</strong>: You should have that from the earlier steps</li>
 	<li><strong>Service Principal App Secret</strong>: You should have that from the earlier steps</li>
 	<li><strong>SSH public key</strong>: Your RSA SSH public Key</li>
 	<li><strong>Subscription</strong>: Your azure subscription name</li>
 	<li><strong>Resource group</strong>: The resource group created in the steps above</li>
 	<li><strong>Location</strong>: Select which Azure region you want your cluster deployed to. Usually this defaults to the location settings of the resource group.</li>
</ul>

<a href="https://msdnshared.blob.core.windows.net/media/2017/04/CreateCluster1.png"><img width="733" height="941" class="size-full wp-image-285 alignnone" alt="createcluster1" src="https://msdnshared.blob.core.windows.net/media/2017/04/CreateCluster1.png" /></a>

6- Press <strong>OK</strong>

7- Then provide the rest of the <strong>values</strong> including the<strong> Docker Datacenter License Key.</strong> Be aware that the key doesn’t get validated, so it will not complain if you put in the wrong key. You need to enter the entire text from the license file you received from Docker. You can update the key after the cluster is created. Check the common issues section at the end of the article for more details.

<a href="https://msdnshared.blob.core.windows.net/media/2017/04/CreateCluster2.png"><img width="735" height="949" class="alignnone wp-image-295 size-full" alt="createcluster2" src="https://msdnshared.blob.core.windows.net/media/2017/04/CreateCluster2.png" /></a>

8- Press <strong>OK</strong>

9- Go over the summary and if everything looks good press <strong>OK</strong>

10- Press <strong>Purchase</strong>

&nbsp;

The provisioning time will be different depending on the region and time of provisioning but usually its done between 5-10 minutes. The azure portal will notify you when the cluster has been provisioned successfully.

You may need to wait another 15 minutes or so after the cluster is provisioned to allow for the DTR to be configured.

You can navigate to the resource group where you have created your Docker cluster to inspect all the Azure resources created:

<a href="https://msdnshared.blob.core.windows.net/media/2017/04/InspectRG.png"><img width="1024" height="629" class="alignnone wp-image-385 size-large" alt="inspectrg" src="https://msdnshared.blob.core.windows.net/media/2017/04/InspectRG-1024x629.png" /></a>

Now you have successfully deployed a DockerEE cluster

&nbsp;

<h3>Common questions</h3>

&nbsp;

<ol>
 	<li><strong>How can I find out what the DTR URL is?</strong></li>
</ol>

Navigate to the resource group where the cluster is created as shown above and find a resource of type<strong> Public IP address</strong> with the name dockerswarm<strong>-dtrLoadBalancer-public-ip</strong>

Click on that <strong>resource</strong> | then copy the <strong>DNS name</strong>

<a href="https://msdnshared.blob.core.windows.net/media/2017/04/DTRLinkPubIP.png"><img width="1024" height="264" class="wp-image-415 size-large alignnone" alt="dtrlinkpubip" src="https://msdnshared.blob.core.windows.net/media/2017/04/DTRLinkPubIP-1024x264.png" /></a>

You can browse the URL: <a href="http://dtrlb-nlo5xsvfj5ty2.southcentralus.cloudapp.azure.com">http://dtrlb-nlo5xsvfj5ty2.southcentralus.cloudapp.azure.com</a>

That should prompt you to login …

<a href="https://msdnshared.blob.core.windows.net/media/2017/04/LogintoDTR.png"><img width="582" height="456" class="size-full wp-image-405 alignnone" alt="logintodtr" src="https://msdnshared.blob.core.windows.net/media/2017/04/LogintoDTR.png" /></a>



<strong>2. Which storage account the DTR is using? How can I change it?</strong>

You can see the Azure storage account information that is used by DTR and change it from the DTR portal under <strong>Settings</strong> | <strong>Storage</strong>

https://DTR_URL/<span style="color: #ff0000">admin</span>/<span style="color: #ff0000">settings</span>/<span style="color: #ff0000">storage</span>

<a href="https://msdnshared.blob.core.windows.net/media/2017/04/DockerStorageSettings.png"><img width="1024" height="479" class="alignnone wp-image-355 size-large" alt="dockerstoragesettings" src="https://msdnshared.blob.core.windows.net/media/2017/04/DockerStorageSettings-1024x479.png" /></a>

&nbsp;

<strong>3. Can I script the deployment of the cluster?</strong>

Yes. Docker have created an excellent bash script for that.

You run the following command:

<pre style="padding-left: 30px">$ docker run -ti docker4x/create-sp-azure sp-name [rg-name rg-region]</pre>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/CreatingAppPrinBash.png"><img width="1024" height="756" class="alignnone wp-image-335 size-large" alt="creatingappprinbash" src="https://msdnshared.blob.core.windows.net/media/2017/04/CreatingAppPrinBash-1024x756.png" /></a></p>
<p style="padding-left: 30px">Then this using the Azure CLI you run this command:</p>

<pre style="padding-left: 30px">$ <span style="color: #99cc00">az</span> group create  --name DockerGroup --location centralus --deployment-name docker.template --template-file &lt;templateurl&gt;</pre>
<h3></h3>
&nbsp;
<h3>Common issues</h3>
&nbsp;
<ol>
 	<li><strong>You get the following error at the homepage of the DTR portal “Warning: Unlicensed copy. Please register your license on the Settings page”</strong></li>
</ol>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/DTRLicError.png"><img width="796" height="619" class="size-full wp-image-356 alignnone" alt="dtrlicerror" src="https://msdnshared.blob.core.windows.net/media/2017/04/DTRLicError.png" /></a></p>
<p style="padding-left: 30px"><strong>Resolution</strong></p>
<p style="padding-left: 30px">This means your license key is invalid. You need to update the license key as follows:</p>
<p style="padding-left: 30px">Navigate to the <strong>settings</strong> page | <strong>General</strong> tab| Press on <strong>Apply new license</strong></p>
<p style="padding-left: 30px">https://DTR_URL/<span style="color: #ff0000">admin</span>/<span style="color: #ff0000">settings</span></p>
<p style="padding-left: 30px">Select the new license key (*.lic) file and press Open</p>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/ApplyNewLic.png"><img width="1024" height="710" class="alignnone wp-image-245 size-large" alt="applynewlic" src="https://msdnshared.blob.core.windows.net/media/2017/04/ApplyNewLic-1024x710.png" /></a></p>
<p style="padding-left: 30px">Once its loaded successfully, it should look like this:</p>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/NewLic.png"><img width="859" height="575" class="size-full wp-image-225 alignnone" alt="newlic" src="https://msdnshared.blob.core.windows.net/media/2017/04/NewLic.png" /></a></p>
<p style="padding-left: 30px"></p>
<p style="padding-left: 30px"><strong>3. Trying to load the DTR portal but its not working (getting timeout error)</strong></p>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2017/04/DTRtimeout.png"><img width="810" height="434" class="size-full wp-image-375 alignnone" alt="dtrtimeout" src="https://msdnshared.blob.core.windows.net/media/2017/04/DTRtimeout.png" /></a></p>
<p style="padding-left: 30px"><strong>Resolution</strong></p>
<p style="padding-left: 30px">Make sure you have waited at least 15 mins after the cluster has been deployed to allow Docker to provision and configure the load balancer and IP config for the DTR endpoint.</p>
<p style="padding-left: 30px">If it still doesn’t work, make sure you have granted access the App principal used in creating the cluster to the resource group where the cluster has been provisioned.</p>
<p style="padding-left: 30px">If not, you can fix the permissions and redeploy a new cluster. Check the steps above for provisioning a new Docker cluster.</p>
<p style="padding-left: 30px"><strong>4. The Docker cluster deployment job failed due to a VM didn’t start on time</strong></p>
<p style="padding-left: 30px">This happens when a VM takes longer than expected to start so the deployment job timesout.</p>
<p style="padding-left: 30px"><b>Resolution</b></p>
<p style="padding-left: 30px">If that happens I would suggest deleting the cluster and re-deploying a new one. Obviously, you can go a restart the VM (that failed to start on time), however, from my experience that results on issues in configuring DTR. So it’s better to re-deploy.</p>

<h3></h3>
<h3>Additional resources</h3>
<ul>
 	<li><a href="https://success.docker.com/Architecture/Docker_Reference_Architecture%3A_Docker_EE_Best_Practices_and_Design_Considerations">Docker EE best practices &amp; considerations</a></li>
 	<li><a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-application-objects">Application and service principal objects in Azure Active Directory</a></li>
 	<li><a href="https://docs.docker.com/docker-for-azure/">Docker for Azure Setup &amp; Prerequisites</a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Common error 'Microsoft.Bot.Builder.Internals.Fibers.InvalidNeedException'</title>
      <link>https://docs.microsoft.com/archive/blogs/azure4fun/common-error-microsoft-bot-builder-internals-fibers-invalidneedexception</link>
      <pubDate>Mon, 30 Jan 2017 06:12:28 GMT</pubDate>
      <dc:creator><![CDATA[Ahmed Farag]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.msdn.microsoft.com/azure4fun/?p=205</guid>
      <description><![CDATA[Using the Microsoft Bot Framework streamlines the development of Bots and makes the process of...]]></description>
      <content:encoded><![CDATA[<a href="https://msdnshared.blob.core.windows.net/media/2017/01/Error.png"><img width="150" height="150" class="alignright wp-image-206 size-thumbnail" alt="Bot Error" src="https://msdnshared.blob.core.windows.net/media/2017/01/Error-150x150.png" /></a>

Using the Microsoft Bot Framework streamlines the development of Bots and makes the process of integrating a Bot with common platforms\channels easier.
Here is a <a href="https://blog.xamarin.com/add-yap-to-your-app-with-bot-framework/">good example </a>of building a Bot, hosting it on a Xamarin phone App and making use of the Microsoft cognitive API LUIS to provide a more human experience.
One of the common issues developers run into, is getting the following error from the Bot:
“<span style="color: #ff0000">Exception thrown: 'Microsoft.Bot.Builder.Internals.Fibers.InvalidNeedException' in mscorlib.dll</span>”
"<span style="color: #ff0000">invalid need: expected Wait, have Done</span>"
Exception type: "Microsoft.Bot.Builder.Internals.Fibers.InvalidNeedException"

This error can be annoying because it doesn’t go away even if you restarted or redeployed your Bot Web API project.
Before we talk about how you can fix it, I would like to briefly mention how to avoid it.
<h2>Avoiding the error</h2>
Whenever you open a conversation and program your Bot to send response messages like this for example:
<pre><span style="color: #0000ff"> await</span> context.PostAsync("<span style="color: #800000">I'm sorry I don't understand. Can you clarify please?</span>");</pre>
You need to make sure you also call wait or done after words like this:
<pre> context.Done(<span style="color: #0000ff">true</span>);</pre>
<h2>Fixing the error</h2>
Because your conversation hasn’t been ended (sort of in a hang state) it cannot receive more messages (activities) from the user. So in order to resolve this you need to access the conversation state store and flush it. The way I have achieved this as follows:
<pre><span style="color: #008080"> StateClient</span> stateClient = activity.GetStateClient();
 <span style="color: #0000ff">await</span> stateClient.BotState.DeleteStateForUserAsync(activity.ChannelId, activity.From.Id);
</pre>
As you see above, this will result into deleting the conversation history so be aware of that.
That code I listed above can be placed inside your Post method implementation part of the Message controller. We can provide a better visibility to the user and handle the error as follows:
<pre><span style="color: #0000ff"> case</span> <span style="color: #008080">ActivityTypes</span>.Message:
 <span style="color: #0000ff">try
</span> {
 <span style="color: #0000ff">await</span> <span style="color: #008080">Conversation</span>.SendAsync(activity, () =&gt; <span style="color: #0000ff">new</span> ShoppingDialog());
 }
 <span style="color: #0000ff">catch</span>(Exception Ex)
 {
 <span style="color: #0000ff">if</span> (Ex.GetType() == <span style="color: #0000ff">typeof</span>(<span style="color: #008080">InvalidNeedException</span>))
 {
 ConnectorClient connector = <span style="color: #0000ff">new</span> ConnectorClient(<span style="color: #0000ff">new</span> <span style="color: #008080">Uri</span>(activity.ServiceUrl));
 <span style="color: #008080">Activity</span> reply = activity.CreateReply("<span style="color: #800000">Sorry, I'm having some difficulties here. I have to reboot myself. Lets start over.</span>");
 <span style="color: #0000ff">await</span> connector.Conversations.ReplyToActivityAsync(reply);
 <span style="color: #008080">StateClient</span> stateClient = activity.GetStateClient();
 <span style="color: #0000ff">await</span> stateClient.BotState.DeleteStateForUserAsync(activity.ChannelId, activity.From.Id);
 }
 }
 <span style="color: #0000ff">break</span>;
</pre>
<h2>Additional resources</h2>
<ul>
 	<li><a href="http://aka.ms/bf-bc-vstemplate">Bot Framework Template for Visual Studio</a></li>
 	<li><a href="https://github.com/Microsoft/BotBuilder">Bot Framework Samples in GitHub</a></li>
 	<li><a href="https://channel9.msdn.com/Events/Build/2016/B821">Building a Conversational Bot: From 0 to 60</a></li>
 	<li><a href="https://channel9.msdn.com/Events/Build/2016/B878">Microsoft Cognitive Services: Give Your Apps a Human Side</a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Custom Azure RBAC roles and how to extend existing role definition’s scope</title>
      <link>https://docs.microsoft.com/archive/blogs/azure4fun/custom-azure-rbac-roles-and-how-to-extend-existing-role-definitions-scope</link>
      <pubDate>Fri, 21 Oct 2016 04:54:57 GMT</pubDate>
      <dc:creator><![CDATA[Ahmed Farag]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.msdn.microsoft.com/azure4fun/?p=195</guid>
      <description><![CDATA[Azure Role-Based Access Control (RBAC) enables fine-grained access management for Azure...]]></description>
      <content:encoded><![CDATA[<a href="https://msdnshared.blob.core.windows.net/media/2016/10/RBACoverview.png"><img width="739" height="385" class="size-full wp-image-196 alignnone" alt="RBACoverview" src="https://msdnshared.blob.core.windows.net/media/2016/10/RBACoverview.png" /></a>

Azure Role-Based Access Control (RBAC) enables fine-grained access management for Azure resources. Using RBAC, you can grant only the amount of access that users need to perform their jobs. This is considered a best practice for managing resources in Azure.
<h6><em><span style="text-decoration: underline"><strong>**Please note:</strong></span> <strong>This post includes PowerShell scripts. To learn more about how to use Azure PowerShell scripts check this post <a href="https://blogs.msdn.microsoft.com/azure4fun/2016/10/20/how-to-use-azure-powershell-sdk/">here</a>.</strong></em></h6>
Sometimes you will find that none of the built-in roles meet your specific access needs. That’s when you can create a custom role. Custom roles can be created using <a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-manage-access-powershell/">Azure PowerShell</a>, <a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-manage-access-azure-cli/">Azure Command-Line Interface</a> (CLI), and the <a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-manage-access-rest/">REST API</a>. There is no UI option using the portal at the time of writing this post unfortunately.

Just like built-in roles, custom roles can be assigned to users, groups, and applications at subscription, resource group, and resource scopes. Custom roles are stored in an Azure AD tenant and can be shared across all subscriptions that use that tenant as the Azure AD directory for the subscription.

To create a custom role, you need to define the role in JSON format.
<h3>The definition consists of three main sections</h3>
<ul>
 	<li>Role identifying information (Name, description …etc.)</li>
 	<li>Included/Excluded actions</li>
 	<li>Scope</li>
</ul>
<h3>Here is an example of a role definition JSON</h3>
<pre>{
   <span style="color: #008080">"Name":</span> <span style="color: #800000">"Virtual Machine Manager"</span>,
   <span style="color: #008080">"Description":</span> <span style="color: #800000">"Can restart virtual machines that can be view only."</span>,
   <span style="color: #008080">"Actions":</span> [
      <span style="color: #800000">"Microsoft.Compute/virtualMachines/start/action"</span>,
      <span style="color: #800000">"Microsoft.Compute/virtualMachines/restart/action"</span>
   ],
   <span style="color: #008080">"NotActions":</span> [
   ],
   <span style="color: #008080">"AssignableScopes":</span> [
      <span style="color: #800000">"/subscriptions/FFBBA206-76CF-42CE-B97E-0CD948BACB69"</span>,
      <span style="color: #800000">"/subscriptions/FFBBA206-76CF-42CE-B97E-0CD948BACB69"</span>
   ]
}</pre>
In the above role definition, we allow the action or starting and restarting a VM. Note that this custom role will not be useful to the assigned user/group unless it’s the user/group already has read access on VM resources via a different role. We chose to let this permission be handled on a separate role intentionally.

The next step is to save the above definition in a file ‘MycustomRole.json’ then execute the following PowerShell command to add the custom role definition:
<pre>New-AzureRmRoleDefinition -InputFile C:\MycustomRole.json</pre>
<a href="https://msdnshared.blob.core.windows.net/media/2016/10/NewCustomRBACPS1.png"><img width="1100" height="287" class="alignleft size-full wp-image-166" alt="NewCustomRBACPS" src="https://msdnshared.blob.core.windows.net/media/2016/10/NewCustomRBACPS1.png" /></a>

Now you can go to the portal and assign this custom role to users or security groups as follows:

<a href="https://msdnshared.blob.core.windows.net/media/2016/10/AddUserPermission.gif"><img width="1480" height="546" class="alignleft size-full wp-image-75" alt="AddUserPermission" src="https://msdnshared.blob.core.windows.net/media/2016/10/AddUserPermission.gif" /></a>

To delete an existing custom role, run the following command:
<pre>Remove-AzureRmRoleDefinition -Id <span style="color: #008000">ROLE_DEFINITION_ID</span></pre>
Or
<pre>Remove-AzureRmRoleDefinition -Name <span style="color: #008000">"ROLE_DEFINITION_Name"</span></pre>
** You need to make sure that there are not users/groups assigned to that role before you attempt to delete the role or you will get an error.

Sometimes you create a custom role and you find out that you need to extend the scope of the role to include more subscriptions or resource groups that has been created after the custom role has been created.

To achieve that following the steps:

First, load the desired role definition in a variable either by Name or ID

Add the new scopes you would like to add (repeat this step as needed)

Update the role definition in the cloud with the changes you just did (submit changes)
<pre>$role = Get-AzureRmRoleDefinition -Name <span style="color: #008000">"ROLE_DEFINITION_NAME"</span>
$role.AssignableScopes.Add("/subscriptions/<span style="color: #008000">NEW_SUBSCRIPTION_ID_GOES_HERE</span>")  <span style="color: #008000"> ##[[Repeat this step to add all the subscriptions you want to add]]</span>
Set-AzureRmRoleDefinition -Role $role</pre>
<h3>Additional resources</h3>
<ul>
 	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-what-is/">Get started with access management in the Azure portal</a></li>
 	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-configure/">Use role assignments to manage access to your Azure subscription resources</a></li>
 	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-built-in-roles/">RBAC: Built-in roles</a></li>
 	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-custom-roles/">Custom Roles in Azure RBAC</a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>How to use Azure PowerShell SDK?</title>
      <link>https://docs.microsoft.com/archive/blogs/azure4fun/how-to-use-azure-powershell-sdk</link>
      <pubDate>Thu, 20 Oct 2016 16:33:55 GMT</pubDate>
      <dc:creator><![CDATA[Ahmed Farag]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.msdn.microsoft.com/azure4fun/?p=175</guid>
      <description><![CDATA[In my blog you will notice that I will reference this post to give a quick intro into how to use...]]></description>
      <content:encoded><![CDATA[In my blog you will notice that I will reference this post to give a quick intro into how to use PowerShell.

To use Azure PowerShell do the following:
<ol>
 	<li>Download the latest PowerShell SDK from <a href="https://www.microsoft.com/web/handlers/webpi.ashx/getinstaller/WindowsAzurePowershellGet.3f.3f.3fnew.appids">here</a>.</li>
 	<li>Open an Azure PowerShell command window from the start menu</li>
 	<li>Run the following commands:</li>
</ol>
<pre>Add-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId <span style="color: #339966">[SUBSCRIPTION_ID_GOES_HERE]</span></pre>
<a href="https://msdnshared.blob.core.windows.net/media/2016/10/ConnectPS.png"><img width="1385" height="715" class="alignleft size-full wp-image-85" alt="ConnectPS" src="https://msdnshared.blob.core.windows.net/media/2016/10/ConnectPS.png" /></a><a href="https://msdnshared.blob.core.windows.net/media/2016/10/00-Connect.png">
</a>

&nbsp;

If you cannot find the Azure PowerShell command window icon shortcut in the start menu you can open a regular command-line window (CMD) and run the following two commands:
<pre>PowerShell.exe
Import-Module 'C:\Program Files (x86)\Microsoft sdks\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1'</pre>
&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Common problem when using Azure resource groups &amp; RBAC</title>
      <link>https://docs.microsoft.com/archive/blogs/azure4fun/common-problem-when-using-azure-resource-groups-rbac</link>
      <pubDate>Thu, 20 Oct 2016 16:13:41 GMT</pubDate>
      <dc:creator><![CDATA[Ahmed Farag]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.msdn.microsoft.com/azure4fun/?p=65</guid>
      <description><![CDATA[** Before you start reading:

 	This article references a lot of PowerShell commands. Read this...]]></description>
      <content:encoded><![CDATA[<strong><em>**<u> Before you start reading:</u></em></strong>
<ul>
 	<li>This article references a lot of PowerShell commands. Read this <a href="https://blogs.msdn.microsoft.com/azure4fun/2016/10/20/how-to-use-azure-powershell-sdk/">post</a> to get up to speed on how to use Azure PowerShell module</li>
 	<li>Long PowerShell scripts in this article have been wrapped to multiple lines to be readable, make sure you use a single line when you try to execute them</li>
 	<li>Snapshots and scripts have been modified to remove account identifying information for security reasons</li>
</ul>
<a href="https://msdnshared.blob.core.windows.net/media/2016/10/AzureClassic.png"><img width="1161" height="509" class="alignleft size-full wp-image-186" alt="AzureClassic" src="https://msdnshared.blob.core.windows.net/media/2016/10/AzureClassic.png" /></a>

Since the introduction of Azure resource manager aka ARM, a lot of organizations started looking at how they can leverage ARM to better manage Azure resources for their different business groups within a company.

In the past, before the introduction of ARM, it was very common to manage resources on <strong>two levels</strong>:
<ul>
 	<li>Cloud services</li>
 	<li>Subscription level</li>
</ul>
The later (subscription level) was the common model for enterprises since it provides some sort of isolation from resources and security perspective.

So, if you have a specific workload were all resources in that workload share the same lifecycle or belong to the same business group, that workload would be organized under a separate Azure subscription.

Under that model (Azure classic resources) you can only have <strong>two different security roles:</strong>
<ul>
 	<li>Service administrator</li>
 	<li>Co-administrator</li>
</ul>
Both roles have full admin rights on the subscription level, the only difference between the two is that ‘Co-administrators’ can’t change the association of subscriptions to Azure directories.

For more details about the above roles go to: <a href="https://azure.microsoft.com/en-us/documentation/articles/billing-add-change-azure-subscription-administrator/">https://azure.microsoft.com/en-us/documentation/articles/billing-add-change-azure-subscription-administrator/</a>

After the introduction of the ARM model aka v2.0 resources, organizations started looking at leveraging resource groups as another level of management and isolation for different workloads in Azure.

Moreover, role based access control provided a much better way to manage permissions overall. One of the common implementation is to create few azure subscriptions (think of them as separate billing points or buckets). Each subscription might belong to a specific business group, for instance: HR, Finance, IT, Engineering …etc.

Then, under these subscriptions, different Azure resource groups are created to provide another layer of isolation between workloads. Resources can be organized under a single resource group if they share one of the following attributes:
<ul>
 	<li>Location (US West, Germany Central …etc.)</li>
 	<li>Level (Production, Test, Development …etc.)</li>
 	<li>Workload (Web application, Data warehouse, BI …etc.)</li>
</ul>
[caption id="attachment_145" align="aligncenter" width="548"]<a href="https://msdnshared.blob.core.windows.net/media/2016/10/RBAC.png"><img width="548" height="445" class="size-full wp-image-145" alt="RBAC" src="https://msdnshared.blob.core.windows.net/media/2016/10/RBAC.png" /></a> <strong>The RBAC role that you assign dictates what resources the user, group, or application can manage within that scope.</strong> [Source: <a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-what-is/">Microsoft</a>][/caption]To allow different business groups to manage their resource groups in a self-service manner, subscription admins provide owner rights to individuals on their perspective resource groups. This will allow these resource group owners to create, delete &amp; manage any resources only within their assigned resource group.

A resource group owner should have all the permissions he/she needs to manage resources in the resource group. It’s the highest level of permissions on the resource group level.

A resource group owner can grant other users permissions on the resource group level.

There are three main built-in roles that comes out-of-the-box:
<ul>
 	<li><strong>Owner:</strong> Full access</li>
 	<li><strong>Contributor:</strong> Full access but cannot grant others permissions</li>
 	<li><strong>Reader:</strong> View only access</li>
</ul>
For more information about RBAC go <a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-what-is/">here</a>.
<h2><strong>Common issue</strong></h2>
One of the issues administrators have been facing, is receiving complaints from resource group owners about the inability of creating certain types of resources due to lack of enough permissions. So for instance when a resource group owners tris to create an “IoT Hub” resource, they get the following error:

<span style="color: #ff0000">“The subscription {{SUBSCRIPTION_NAME}} doesn’t have permissions to register resource provider: Microsoft.Devices.”</span>

<a href="https://msdnshared.blob.core.windows.net/media/2016/10/SubError.png"><img width="996" height="986" class="wp-image-155 size-full" alt="Error creating a resource" src="https://msdnshared.blob.core.windows.net/media/2016/10/SubError.png" /></a>

or during the validation process they get the following error:

<span style="color: #ff0000">‘AuthorizationFaild’ – The client ‘{{USER_ACCOUNT}}’ with object id ’{{OBJECT_ID}}’ does not have authorization to perform action ‘Microsoft.Devices/register/action’ over scope ‘/subscriptions/{{SUBSCRIPTION_ID}}.(Code: AuthorizationFailed)(Code: 8)</span>

<a href="https://msdnshared.blob.core.windows.net/media/2016/10/Validation-error.png"><img width="860" height="810" class="size-full wp-image-115" alt="Validation error" src="https://msdnshared.blob.core.windows.net/media/2016/10/Validation-error.png" /></a>

This issue is more likely to happen in newer subscriptions and usually happens if a certain resource type has never been created before in that subscription.

Subscription admins often fix this issue by granting resource group owners contributor rights on the subscription level which contradicts with their strategy of isolating access down to the level of resource group level not the subscription level.
<h2><strong>Root cause</strong></h2>
Some admins say, that some resources require access to the subscription level to be able to create these resources and that ‘owner’ rights on a resource group level is not sufficient. That is not true.

Let’s take a step back to understand how this all works first.

To provision any resources in azure (using the resource manager model) you need to have a resource provider that supports the creation of that resource. For example, if you will provision a virtual machine, you need to have a ‘Microsoft.Compute’ resource provider available in the subscription first before you can do that.

Resource providers are registered on the level of the subscription only.

Luckily, the Azure Resource Manager (ARM) is intelligent enough to figure that out for you. When a new Azure resource gets provisioned, if the resource provider required for that resource type is not registered in the subscription yet, ARM will attempt to register it for you. That action (resource provider registration) requires access to the subscription level.

By default, any new azure subscription will be pre-registered with a list of commonly used resource providers. The resource provider for IoTHub for instance, is not one of them.

When a user is granted owner rights only on a specific resource group, if that user tries to provision a resource that requires registering a resource provider for the first time, that operation will fail. That is what happened in our case above when trying to provision IoThub.

So the bottom line is, we *<strong>DO NOT</strong>* need to grant access permissions to the subscription level for users to be able to create resources like HDInsight, IotHub and SQLDW …etc within their resource groups that they have owner rights on, as long as the resource providers for these resources is already registered.

To get a list of registered resource providers in the current subscription<strong><u> run the following command:</u></strong>
<pre>get-AzureRmResourceProvider -ListAvailable |where {$_.Registrationstate -eq "Registered"}</pre>
<h2><strong>Quick resolution</strong></h2>
The issue should be easier to understand now after the above explanation. The issue is that we need to make sure that we have the resource provider registered in the subscription before we attempt to create resources. If we don’t, we need to make sure that the user creating the new resource has enough rights to register the required resource provider on the subscription level

To fix the issue in hand Look at the error message to figure out what resource provider needs to be registered. In our case, it is: “Microsoft.Devices”. Have a subscription admin run the following PowerShell command to register that resource for you:

Register-AzureRmResourceProvider -ProviderNamespace Microsoft.Devices
<h2><strong>Long-term resolution</strong></h2>
The solution we have provided above addresses only that particular instance of the problem. If you have another user that tries to create a resource that requires a different provider that is not registered yet and that user only has owner rights on his resource group, the user will fall into the same issue again.

In order to maintain the resource groups owners model and still be able to create all kinds of resources, and yet don’t fall into the issue described above we have to implement <strong>*one*</strong> of the following solutions:
<ol>
 	<li>Preregister all providers in a subscription</li>
 	<li>Create a custom RBAC role to permit registration of resources providers to resource group owners</li>
</ol>
<h3>1- Preregister all providers in a subscription</h3>
<p style="padding-left: 30px">If we have a limited number of subscriptions that doesn’t change often, we can run a PowerShell command to preregister all available providers to each subscription. The only downside here is that every time a new service is added to Azure including Azure marketplace you will need to run a PowerShell command to register the new providers for these new services.</p>
<p style="padding-left: 30px"><strong> </strong>To get a list of all available resource providers run the following PowerShell command:</p>

<pre style="padding-left: 60px">get-AzureRmResourceProvider -ListAvailable | select ProviderNamespace</pre>
<p style="padding-left: 60px"><strong><a href="https://msdnshared.blob.core.windows.net/media/2016/10/GetResourceProviders.png"><img width="1384" height="264" class="alignleft size-full wp-image-156" alt="GetResourceProviders" src="https://msdnshared.blob.core.windows.net/media/2016/10/GetResourceProviders.png" />
</a></strong></p>
<p style="padding-left: 30px">To register all available resource providers in the current subscription run the following PowerShell command:</p>

<pre style="padding-left: 60px">get-AzureRmResourceProvider -ListAvailable | foreach-object{Register-AzureRmResourceProvider -ProviderNamespace $_.ProviderNamespace}</pre>
<p style="padding-left: 30px">To register a resource provider (e.g. the one required for provisioning IoT Hub resources) run the following command:</p>

<pre style="padding-left: 60px">Register-AzureRmResourceProvider -ProviderNamespace Microsoft.Devices</pre>
<h3>2- Create a custom RBAC role to permit registration of resources providers to resource group owners</h3>
<p style="padding-left: 30px">This solution will leverage a custom RBAC role to enable resource group owners to have the ability to register resource providers to subscriptions. The custom RBAC role will grant *<strong>ONLY</strong>* registration rights on the subscription, this role should be assigned in-addition to the resource group owner built-in role:</p>
<p style="padding-left: 30px">Here is the definition of the custom role:</p>

<pre style="padding-left: 30px">{
<span style="color: #33cccc">"Name":</span> <span style="color: #800000">"Register Microsoft providers"</span>,
<span style="color: #33cccc">"Description":</span> <span style="color: #800000">"Can register Microsoft providers"</span>,
<span style="color: #33cccc">"Actions":</span> [ <span style="color: #800000">"*/register/action" </span>],
<span style="color: #33cccc">"AssignableScopes":</span> [ <span style="color: #800000">"/subscriptions/<span style="color: #008000">[SUBSCRIPTION1_ID_GOES_HERE]</span>"</span>,
<span style="color: #800000">"/subscriptions/<span style="color: #008000">[SUBSCRIPTION2_ID_GOES_HERE]</span>"</span>,
<span style="color: #800000">"/subscriptions/<span style="color: #008000">[SUBSCRIPTION3_ID_GOES_HERE]</span>"</span> ]
}</pre>
<p style="padding-left: 30px">Replace ‘[SUBSCRIPTION1_ID_GOES_HERE], [SUBSCRIPTION2_ID_GOES_HERE] …etc.’ with all subscription ids that you would like this role to be associated to.</p>

<h6 style="padding-left: 30px"><strong><em>** Please note that custom role definition objects span subscriptions and sit on the AAD tenant level. That means you can only have uniquely named custom roles defined across all subscriptions in a single tenant. So make sure you include all the subscriptions ids you want to include in the above custom role definition in the assignable scopes section.</em></strong></h6>
<p style="padding-left: 30px">Here is how to create a custom role using PowerShell:</p>
<p style="padding-left: 30px">First save the custom role definition listed above in a file called MycustomRole.json then run the following command:</p>

<pre style="padding-left: 30px">New-AzureRmRoleDefinition -InputFile C:\MycustomRole.json
</pre>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2016/10/NewCustomRBACPS1.png"><img width="1100" height="287" class="alignleft size-full wp-image-166" alt="NewCustomRBACPS" src="https://msdnshared.blob.core.windows.net/media/2016/10/NewCustomRBACPS1.png" /></a></p>
<p style="padding-left: 30px">Now you can go to the portal and assign this custom role to users or security groups (in our case to resource owners):</p>
<p style="padding-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/2016/10/AddUserPermission.gif"><img width="1480" height="546" class="alignleft size-full wp-image-75" alt="AddUserPermission" src="https://msdnshared.blob.core.windows.net/media/2016/10/AddUserPermission.gif" /></a></p>
<strong>What happens to newly created subscriptions?</strong>
<p style="padding-left: 30px">In future, newly added subscriptions will not have the custom role associated to them. To make the new custom role you created above available and applies to new subscriptions, run the following PowerShell script to update the existing custom role to include the new subscriptions:</p>

<pre>$role = Get-AzureRmRoleDefinition -Name "Register Microsoft providers"
$role.AssignableScopes.Add("/subscriptions/[NEW_SUBSCRIPTION_ID_GOES_HERE]")   <span style="color: #008000">##[[Repeat this step to add all the subscriptions you want to add]]
</span>Set-AzureRmRoleDefinition -Role $role</pre>
<h2>Additional resources:</h2>
<ul>
 	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-configure/">Use role assignments to manage access to your Azure subscription resources</a></li>
 	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-custom-roles/">Custom Roles in Azure RBAC</a></li>
 	<li><a href="https://msdn.microsoft.com/en-us/library/mt603685.aspx">Register-AzureRmResourceProvider</a></li>
 	<li><a href="https://msdn.microsoft.com/en-us/library/mt603615.aspx">Get-AzureRmResourceProvider</a></li>
 	<li><a href="https://msdn.microsoft.com/en-us/library/mt678996.aspx">New-AzureRmRoleDefinition</a></li>
 	<li><a href="https://msdn.microsoft.com/en-us/library/mt678997.aspx">Set-AzureRmRoleDefinition</a></li>
 	<li><a href="https://msdn.microsoft.com/en-us/library/mt679008.aspx">Remove-AzureRmRoleDefinition</a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>AzCopy - Unable to connect to the remote server</title>
      <link>https://docs.microsoft.com/archive/blogs/azure4fun/azcopy-unable-to-connect-to-the-remote-server</link>
      <pubDate>Mon, 17 Oct 2016 18:44:10 GMT</pubDate>
      <dc:creator><![CDATA[Ahmed Farag]]></dc:creator>
      <guid
        isPermaLink="false">http://blogs.msdn.microsoft.com/azure4fun/?p=25</guid>
      <description><![CDATA[A lot of customers are working on migrating their workloads to the cloud. If you are building new...]]></description>
      <content:encoded><![CDATA[A lot of customers are working on <strong>migrating their workloads</strong> to the <strong>cloud</strong>. If you are building new infrastructure in Azure its common to have the need to <strong>upload\download files</strong> to and from the Azure. This can be for instance, to upload virtual disks (VHDs) or database backups ...etc.

There are many tools that can help you achieve that, <span style="text-decoration: underline"><strong>the too most common ones are:</strong></span>
<ol>
 	<li><a href="http://storageexplorer.com">Microsoft Azure Storage Explorer</a> (UI tool)</li>
 	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy">AzCopy</a> (Command-line tool)</li>
</ol>
If you are looking for a rich and easy to use UI tool you would go with the <strong>Microsoft Azure Storage Explorer</strong>.

[caption id="attachment_35" align="alignnone" width="988"]<a href="https://msdnshared.blob.core.windows.net/media/2016/10/MASE.png"><img width="988" height="763" class="wp-image-35 size-full" alt="Microsoft Azure Storage Explorer" src="https://msdnshared.blob.core.windows.net/media/2016/10/MASE.png" /></a> Microsoft Azure Storage Explorer - v0.8.5[/caption]

However, if you need to download/upload large files &gt; 500MB its recommended to use the AzCopy command-line.

[caption id="attachment_45" align="alignnone" width="598"]<a href="https://msdnshared.blob.core.windows.net/media/2016/10/Azcopy.gif"><img width="598" height="368" class="wp-image-45 size-full" alt="AzCopy Command-line Tool" src="https://msdnshared.blob.core.windows.net/media/2016/10/Azcopy.gif" /></a> AzCopy Command-line Tool[/caption]

The <a href="http://storageexplorer.com">link </a>above has good documentation about how to use the AzCopy command-line. What I would like to cover here is some <strong>troubleshooting tips</strong> for using AzCopy. AzCopy command-line tool connects to an <strong>Azure storage account</strong> either using http or https. That means it communicates through <strong>ports 80 or 443</strong>. So you need to make sure these ports are open to the internet.

You may have the required ports open but still get a <strong>connectivity error</strong>, more specifically an error like this <span style="color: #ff0000">'Unable to connect to the remote server'. <span style="color: #000000">If you are positive that ports are open the next thing to check is, if you need to use a proxy to get to the internet. You can use the switch '/v' to turn on <strong>verbose logging</strong>. The default location of the<strong> log file</strong> is at: </span></span>

<span style="color: #ff0000"><span style="color: #000000">'C:\Users\******\AppData\Local\Microsoft\Azure\AzCopy\AzCopyVerbose.log'. Here is how that connectivity error is logged:</span></span>
<pre style="color: black;padding-left: 30px;font-family: 'Segoe UI';font-size: 10pt;margin-top: 2pt;margin-bottom: 2pt">Microsoft.WindowsAzure.Storage.DataMovement.TransferException: Unable to connect to the remote server
 ---&gt; Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server ---&gt; System.Net.WebException: Unable to connect to the remote server ---&gt; System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 13.88.145.72:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Exception&amp; exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.AzCopy.EnumerationHelpers.AzureBlobLocation.&lt;ValidateDestination&gt;b__0()
   at Microsoft.WindowsAzure.Storage.AzCopy.LocationHelper.ValidateAzureDestination(Action existCheck)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.AzCopy.AzCopy.ExecuteTransfer(Exception&amp; listFilesException)</pre>
<span style="color: #ff0000"><span style="color: #000000">If you need to use a proxy you will need to add a <strong>config file</strong> called <strong>'AzCopy.exe.config'</strong> to the following location <strong>'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\'</strong>. In that file you will need to add the following XML:</span></span>
<pre style="margin-top: 2pt;margin-bottom: 2pt;font-family: 'Segoe UI';font-size: 10.0pt;color: black">&lt;configuration&gt;
   &lt;system.net&gt;
     &lt;defaultProxy&gt;
        &lt;proxy <span>proxyaddress="http://<span style="color: #339966">PROXY_ADDRESS</span>:<span style="color: #00ccff">PORT_NUMBER</span>" </span>bypassonlocal="true" /&gt;
     &lt;/defaultProxy&gt;
   &lt;/system.net&gt;
 &lt;/configuration&gt;</pre>
<p style="margin-top: 2pt;margin-bottom: 2pt;font-family: 'Segoe UI';font-size: 10.0pt;color: black"><span style="color: #339966">PROXY_ADDRESS</span>: Is the proxy address used to connect to the internet, e.g. myproxy.company.com</p>
<p style="margin-top: 2pt;margin-bottom: 2pt;font-family: 'Segoe UI';font-size: 10.0pt;color: black"><span style="color: #00ccff">PORT_NUMBER</span>: Is the port number used to connect to the proxy, e.g. 8080</p>
After that the AzCopy command-line tool will run with the configured proxy settings.]]></content:encoded>
    </item>
  </channel>
</rss>