<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Monub</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/monub/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/monub/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:24:09 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Docker Blog Series Part 7– Deploy Azure Web App On Containers</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/docker-blog-series-7-deploy-azure-web-app-on-containers</link>
      <pubDate>Mon, 09 Apr 2018 17:15:58 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=1325</guid>
      <description><![CDATA[Container services are encapsulated, individually deployable components that run as isolated...]]></description>
      <content:encoded><![CDATA[Container services are encapsulated, individually deployable components that run as isolated instances on the same kernel to take advantage of virtualization that an operating system provides. Thus, each application and its runtime, dependencies, and system libraries run inside a container with full, private access to the container's own isolated view of operating system constructs.

Azure has various services to orchestrate containers like Azure Service Fabric, Azure Container Service, Azure Kubernetes Service and ACI. In this blog post, we will see how to deploy containers on Web Apps.

<strong>Step 1</strong>: Create a ASPNET Core Web Application using Visual Studio.

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/image190.png"><img width="759" height="526" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb188.png" border="0" /></a>

<strong>Step 2: </strong>Select Web Application template. <strong>DO NOT </strong> check “Enable Docker Support”

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/image191.png"><img width="743" height="484" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb189.png" border="0" /></a>

<strong>Step 3: </strong>Once the application is loaded in Visual Studio add a Dockerfile to the root of the project.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image544.png"><img width="845" height="239" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb454.png" border="0" /></a>

<strong>Step 4</strong>. Open the Dockerfile in Visual Studio and add the following steps in the Dockerfile and Save the Dockerfile.

FROM microsoft/aspnetcore:latest
WORKDIR dockerdemo
ADD ./WebApp .
ENTRYPOINT ["dotnet","bin/Debug/netcoreapp2.0/publish/WebApp.dll"]
EXPOSE 8086
ENV ASPNETCORE_URLS <a href="https://0.0.0.0:8086">https://0.0.0.0:8086</a>

<strong>Step 5</strong>. Open Powershell in Admin Mode and browse to the project folder.

<strong>Step 6</strong>. Execute Docker <b>build</b> command to build image from the Dockerfile. Include tag name in the build command as shown below.

docker build . -t monuacr.azurecr.io/webapp:1

<strong>Step 7</strong>. Execute Docker <b>run</b> command to create the container using the image previously created as shown below

docker run monuacr.azurecr.io/webapp:1

<strong>Step 8</strong>. Inspect the IP address on which the container is running by executing <b>network</b> <b>inspector</b> <b>nat</b> command.

<strong>Step 9. </strong>Open the web browser and navigate to the IP address and you will see the ASP.Net core application running.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image547.png"><img width="850" height="469" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb457.png" border="0" /></a>

<strong>Step 10. </strong>Publish the image to Azure Container Registry.

docker push monuacr.azurecr.io/webapp:1

<strong>Azure Web App on Containers</strong>

Now we will deploy our container image which we pushed to the Azure Container Registry to Azure Web App as a container deployment. We can easily deploy and run containerized web apps that scale with business needs. Currently we can deploy Azure Web apps on Linux Containers.

<strong>Step 11. </strong>Go to the Azure Portal and Navigate to the Container registry we pushed the image to.

<strong>Step 12. </strong>Click on Repositories.

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/SNAGHTML453b34.png"><img width="776" height="367" title="SNAGHTML453b34" alt="SNAGHTML453b34" src="https://msdnshared.blob.core.windows.net/media/2018/04/SNAGHTML453b34_thumb.png" border="0" /></a>

<strong>Step 13. </strong>Now Click on the image we pushed to the Repository.

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/SNAGHTML47553b.png"><img width="779" height="479" title="SNAGHTML47553b" alt="SNAGHTML47553b" src="https://msdnshared.blob.core.windows.net/media/2018/04/SNAGHTML47553b_thumb.png" border="0" /></a>

<strong>Step 14. </strong>Now Click on the Deploy to Web App link. This will enable us to deploy the image to Azure Web App.

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/SNAGHTML46ad43.png"><img width="777" height="477" title="SNAGHTML46ad43" alt="SNAGHTML46ad43" src="https://msdnshared.blob.core.windows.net/media/2018/04/SNAGHTML46ad43_thumb.png" border="0" /></a>

<strong>Step 15. </strong>Fill in the required values for the web app and click on Create.

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/image192.png"><img width="782" height="513" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb190.png" border="0" /></a>

<strong>Step 16. </strong>Azure  Web App is up and running using the Docker image on Linux Container. Navigate to the Web App on the Portal.

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/image193.png"><img width="791" height="309" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb191.png" border="0" /></a>

As you saw, we can deploy Azure web apps on containers and avail all the PAAS benefits of the Azure Web App Platform along with being portable by using Containers.

For more information, check out this article.

<a href="https://azure.microsoft.com/en-us/services/app-service/containers/" title="https://azure.microsoft.com/en-us/services/app-service/containers/">https://azure.microsoft.com/en-us/services/app-service/containers/</a>]]></content:encoded>
    </item>
    <item>
      <title>Docker Blog Series Part 6 – How to use Service Fabric Reverse Proxy for container services</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/containerdocker-blog-series-part-6-how-to-use-service-fabric-reverse-proxy</link>
      <pubDate>Wed, 04 Apr 2018 00:31:29 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=1135</guid>
      <description><![CDATA[Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage...]]></description>
      <content:encoded><![CDATA[Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable microservices and containers. Service Fabric also addresses the significant challenges in developing and managing cloud native applications. It is also an orchestrator of services across a cluster of machines and it is continuing to invest heavily in container orchestration and management. In this blog post, we will check out how to use Service Fabric Reverse Proxy for container services.

Container services are encapsulated, individually deployable components that run as isolated instances on the same kernel to take advantage of virtualization that an operating system provides. Thus, each application and its runtime, dependencies, and system libraries run inside a container with full, private access to the container's own isolated view of operating system constructs. Microservices running inside containers in Service Fabric run on a subset of nodes. Service Fabric orchestration is responsible for service discovery, resolution and routing. As a result, the endpoint for the services running inside the container can change dynamically.

If the container services are deployed in Azure Service Fabric, we could use Azure Load Balancer to reach the services from outside. To make these services/endpoints accessible to external clients, we configure the Load Balancer to forward traffic to each port that the service uses. This approach works but requires each service to be configured on Load Balancer.

Other approach could be to use Reverse proxy. Instead of configuring ports of individual service in Load Balancer, we configure the port of the Reverse proxy.  Following is the specific URI format, Reverse proxy uses for service discovery.

<strong>http(s)://&lt;Cluster FQDN | internal IP&gt;:Port/&lt;MyApp&gt;/&lt;MyService&gt;</strong>

<strong> </strong>

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/image31.png"><img width="705" height="390" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb31.png" border="0" /></a>

&nbsp;

One of the challenges when using Reverse proxy approaches is when you configure Reverse proxy port in the Load Balancer, all the services in the cluster that expose an HTTP endpoint are addressable from outside the cluster. Due to this reason, we recommend to use SF Reverse proxy for internal services.

But if you have mix of microservices which includes internal and external services, we would have to expose the reverse proxy port in the load balancer to expose external services. But that would implicitly also expose our internal services which we dont want to. So a workaround for now would be to use the below port configuration in the Docker compose file. We will be explicitly dropping the HTTP prefix from the ports. This will ensure that those container services which have this configuration will not be exposed. This will make sure that the internal container service with this configuration will not be exposed through the Load Balancer.

You can check out my previous blog below to see how to do Docker – Compose deployment for Service Fabric.

<a href="https://msdnshared.blob.core.windows.net/media/2018/04/image32.png"><img width="472" height="357" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb32.png" border="0" /></a>

As you saw above, you can leverage Azure Service Fabric Reverse proxy to expose different types of services. To read more about Azure Service Fabric proxy check out the following links.

<a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy" title="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy</a>

<a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverse-proxy-diagnostics" title="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverse-proxy-diagnostics">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverse-proxy-diagnostics</a>

<a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy-configure-secure-communication" title="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy-configure-secure-communication">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy-configure-secure-communication</a>]]></content:encoded>
    </item>
    <item>
      <title>Docker Blog Series Part 5 – Understanding new container management features in Service Fabric</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/docker-blog-series-part-5-understanding-new-container-management-features-in-service-fabric</link>
      <pubDate>Sat, 23 Dec 2017 00:55:00 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=995</guid>
      <description><![CDATA[Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage...]]></description>
      <content:encoded><![CDATA[Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable microservices and containers. Service Fabric also addresses the significant challenges in developing and managing cloud native applications. It is also an orchestrator of services across a cluster of machines and it is continuing to invest heavily in container orchestration and management. In this blog post, we will check out some of newer features as they relate to container orchestration - <em>Volume Mounting</em> and <em>Docker Compose </em>support.

Containers are encapsulated, individually deployable components that run as isolated instances on the same kernel to take advantage of virtualization that an operating system provides. Thus, each application and its runtime, dependencies, and system libraries run inside a container with full, private access to the container's own isolated view of operating system constructs.

<strong>Volumes</strong>

In the world of containers, volumes are a great way to persist data created and used by the docker containers. Let’s take a look at how to use volumes in Service Fabric.

<strong>Step 1</strong> – Create a new Service Fabric Application using VS2017.

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/image422.png"><img width="663" height="460" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/12/image_thumb405.png" border="0" /></a>

<strong>Step 2 </strong>–<strong> </strong>Use  the Container template and provide the docker container image previously built. You can check out my earlier blog posts to learn about creating docker images/applications.

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/image423.png"><img width="666" height="507" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/12/image_thumb406.png" border="0" /></a>

Once the project is created, Visual Studio will create the necessary manifest files ready for publishing. Before we publish let us configure the volumes in the ApplicationManifest.

<strong>Step 3</strong> – Open the ApplicationManifest.xml and Add the Volume Policy as shown below under Policies inside ServiceManifestImport.

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/SNAGHTML88506c.png"><img width="685" height="157" title="SNAGHTML88506c" alt="SNAGHTML88506c" src="https://msdnshared.blob.core.windows.net/media/2017/12/SNAGHTML88506c_thumb.png" border="0" /></a>

&nbsp;

<strong>Step 4 - </strong>Now you are ready to publish the application and use the volumes.

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/image424.png"><img width="447" height="525" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/12/image_thumb407.png" border="0" /></a>

You can also use volume drivers like Azure File Share with Service Fabric Volumes. You can read more on it here - <a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-volume-logging-drivers" title="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-volume-logging-drivers">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-volume-logging-drivers</a>

&nbsp;

<strong>Docker Compose Support</strong>

Docker uses the <a href="https://docs.docker.com/compose">docker-compose.yml</a> file for defining multi-container applications. To make it easy for customers familiar with Docker to orchestrate existing container applications on Azure Service Fabric, natively in the platform, Service Fabric can accept version 3 and later of <code>docker-compose.yml</code> files.

As a pre-requisite, we will use the container image we used earlier to create a docker-compose.yml file.

<strong>Step 1</strong> – Create a docker-compose.yml file as shown below.

<a href="https://msdnshared.blob.core.windows.net/media/2017/12/SNAGHTMLc0cb49.png"><img width="659" height="135" title="SNAGHTMLc0cb49" alt="SNAGHTMLc0cb49" src="https://msdnshared.blob.core.windows.net/media/2017/12/SNAGHTMLc0cb49_thumb.png" border="0" /></a>

The above compose file when deployed is going to create a Service Fabric service called ‘customer’ using the image provided.

<strong>Step 2</strong> – Connect to Service Fabric cluster in Azure using the following powershell script.

Connect-ServiceFabricCluster -ConnectionEndpoint '_<strong>YOURSFCLUSTER</strong>_:19000'

<strong>Step 3</strong> – Execute the Service Fabric Docker Compose deployment command

<strong>New-ServiceFabricComposeDeployment</strong> -DeploymentName app -Compose 'docker-compose-servicefabric.yml' -RegistryUserName 'xyz' -RegistryPassword 'xyz'

Once the command is executed Service Fabric application will be created in Azure Service Fabric using the Docker-Compose feature. As you saw in this blog post, we can leverage newer features with Service Fabric for Container Orchestration. Happy Containerizing!!!

<strong>References</strong>

<a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-overview" title="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-overview">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-overview</a>

<a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-overview" title="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-overview">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-overview</a>

<a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-docker-compose" title="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-docker-compose">https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-docker-compose</a>]]></content:encoded>
    </item>
    <item>
      <title>Docker Blog Series Part 4 - Managing Secrets inside Kubernetes Cluster in Azure Container Service</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/docker-blog-series-part-4-managing-secrets-inside-kubernetes-cluster-in-azure-container-service</link>
      <pubDate>Thu, 21 Sep 2017 05:22:12 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=825</guid>
      <description><![CDATA[One of the common tasks in application development is to manage configurations. Some of the...]]></description>
      <content:encoded><![CDATA[One of the common tasks in application development is to manage configurations. Some of the configurations can be sensitive information. One of the features of Kubernetes is secret management. There are many approaches to retrieve secrets from the secret management store. In this blog post, I will show you how to manage a sample secret using environment variables in a Web Api. We will do this in two steps. First step is to create the Kubernetes secrets. Second step is to leverage Kubernetes secrets in a Web Api. This blog assumes a successful deployment of a Kubernetes cluster in ACS. If you have not done this already, please follow the below link to deploy one. <a href="https://docs.microsoft.com/en-us/azure/container-service/kubernetes/container-service-kubernetes-walkthrough">https://docs.microsoft.com/en-us/azure/container-service/kubernetes/container-service-kubernetes-walkthrough</a>

Let’s get started.
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top"><b>Step 1. </b>Create a secrets.yaml file with the below content.</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="97" valign="top"></td>
</tr>
</tbody>
</table>
<a href="https://msdnshared.blob.core.windows.net/media/2017/09/image243.png"><img width="438" height="286" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/09/image_thumb216.png" border="0" /></a>

<b>Step 2. </b>Run the following <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/">Kubectl</a> command to create Secret inside Kubernetes cluster.

kubectl.exe create -f "c:\secrets.yml"

<b>Step 3. </b>Verify if the secret got created in the Kubernetes cluster by running the following command.

kubectl.exe get secrets

NAME                         TYPE                                                      DATA                            AGE
default-token-fp4cp   kubernetes.io/service-account-token   3                                   9h
mysecret                     Opaque                                                 2                                   2h

You can optionally check this in the Kubernetes UI/Dashboard as well.

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/SNAGHTML5e05168.png"><img width="468" height="515" title="SNAGHTML5e05168" alt="SNAGHTML5e05168" src="https://msdnshared.blob.core.windows.net/media/2017/09/SNAGHTML5e05168_thumb.png" border="0" /></a>

Now that we have the secret created, we will create an ASP.NET Core Web Api project to consume the secret as an environment variable.
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top"></td>
</tr>
</tbody>
</table>
<b>Step 4</b>. Open Visual Studio 2017 and create ASP.NET Core Web Api project.

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image0017.png"><img width="672" height="466" title="clip_image001" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image001_thumb3.png" border="0" /></a>

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image00215.png"><img width="680" height="446" title="clip_image002" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image002_thumb9.png" border="0" /></a>

<b>Step 5. </b>Make the following change in Default Values Controller. We will be adding code to read Environment Variable called ‘Secret_Username’. This value will be coming from the Secrets inside the Kubernetes cluster.<b> </b>

public string Envar { get; set; }
// GET api/values
[HttpGet]
public IEnumerable&lt;string&gt; Get()
{

if (Environment.GetEnvironmentVariable("SECRET_USERNAME") != string.Empty)
Envar = Environment.GetEnvironmentVariable("SECRET_USERNAME");
else
Envar = "Environment Variable could not be read from Kubernetes Secrets";
return new string[] { "Here is the secret username", " " + Envar };
}

<b>Step 6.</b> Add a Dockerfile to the project, Build the Dockerfile and push this application to the Docker Hub or an equivalent Docker Repository. If you need help with Dockerizing the app, read my earlier blog posts.

<b>Step 7. </b>Now let’s push this application to Kubernetes cluster to retrieve the Secret value. We will use <b>kubectl</b> <b>create</b> command to create the deployment.  Service.yaml is the yaml file which describes the Kubernetes deployment. To understand more about Kubernetes deployment, read the documentation here - <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-intro/">https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-intro/</a>

<strong>kubectl.exe create –f Service.yaml</strong>

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image0031.png"><img width="720" height="490" title="clip_image003" alt="clip_image003" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image003_thumb.png" border="0" /></a>

The important part to understand here is how we describe the <strong>Environment variable</strong> and map it to the valueFrom the secret store using <strong>SecretKeyRef</strong>.

<b>Step 8</b>. Once the application is deployed to the Kubernetes cluster, your values controller should be able to access the ‘Secret_UserName’ in the Values Controller from the secret store using the environment variable ‘Secret_UserName’.

In this blog post, we saw one of the ways to manage secrets in Kubernetes.. Stay tuned for more!!!]]></content:encoded>
    </item>
    <item>
      <title>Docker Blog Series Part 3– Deploy IIS based applications to Service Fabric using Docker Containers</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/docker-blog-series-part-3-deploy-iis-based-applications-to-service-fabric-using-docker-containers</link>
      <pubDate>Wed, 28 Jun 2017 00:40:51 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=626</guid>
      <description><![CDATA[One of&nbsp; the value propositions of using containers with Service Fabric is that you can now...]]></description>
      <content:encoded><![CDATA[<p>One of&nbsp; the value propositions of using containers with Service Fabric is that you can now deploy IIS based applications to the SF cluster. In this blog post, we will see how to leverage docker containers to deploy IIS apps to Service Fabric. I will skip the image creation and publish to the docker hub in this blog. Please reference my earlier <a href="https://blogs.msdn.microsoft.com/monub/2017/05/28/docker-blog-series-part-2-build-deploy-asp-net-core-docker-image-on-service-fabric/">blog</a> to learn more about creating and pushing images.<p>For this blog, I will be using an already pushed IIS image to the docker Hub. The application image uses <a href="https://hub.docker.com/r/microsoft/iis/">microsoft/iis</a> as a base image.<p>Let’s get started.<p><strong>Step 1</strong>. Open Visual Studio 2017 and create a Service Fabric Application.<p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb2100.png"><img width="665" height="392" title="clip_image001" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image0013.png" border="0"></a><p><strong>Step 2</strong>. Now choose the Guest Container feature and provide valid Image Name and Click Ok. The image name is the one we published to Docker Hub in the previous exercise.<p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image601.png"><img width="659" height="485" title="clip_image002" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image00214.png" border="0"></a><p><strong>Step 3</strong>. Once the application is created and loaded, add the following endpoint information into ServiceManifest.xml<p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/SNAGHTML5e2bc1f.png"><img width="668" height="402" title="clip_image003" alt="clip_image003" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image003.png" border="0"></a><p><strong>Step 4. </strong>Now let’s add following section into ApplicationManifest.xml to add Hub Credentials and Port Binding endpoint information.<p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/SNAGHTML4f39dc_thumb1.png"><img width="669" height="356" title="clip_image004" alt="clip_image004" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image00410.png" border="0"></a><p><strong>Step 5. </strong>We are ready to Publish our application to Service Fabric Cluster now. Right click on the Application and Publish to Azure Service Fabric. Make sure when you create the Service Fabric cluster, you pick the option to create it with Windows Server 2016 with Containers.<p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb2010.png"><img width="679" height="476" title="clip_image005" alt="clip_image005" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image0053.png" border="0"></a><p><strong>Step 6. </strong>First let’s see our application deployed using Service Fabric explorer.<p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb2410.png"><img width="684" height="310" title="clip_image006" alt="clip_image006" src="https://msdnshared.blob.core.windows.net/media/2017/09/clip_image0066.png" border="0"></a><p><strong>Step 7 </strong>Now, lets browse to our application on Service Fabric. You should see your IIS&nbsp; application running on Service Fabric.<p>As you saw in this blog post we can use Service Fabric for Container Orchestration for newer and legacy applications. More coming in next blog on Container Orchestration capabilities like DNS, Scaling, Labels etc.. Stay tuned!]]></content:encoded>
    </item>
    <item>
      <title>Docker Blog Series Part 2 - Build &amp; Deploy ASP.NET Core based Docker Container on Service Fabric</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/docker-blog-series-part-2-build-deploy-asp-net-core-docker-image-on-service-fabric</link>
      <pubDate>Sun, 28 May 2017 01:46:38 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=535</guid>
      <description><![CDATA[Azure Service Fabric in addition to offering a Service Fabric programming model is also able to...]]></description>
      <content:encoded><![CDATA[Azure Service Fabric in addition to offering a <a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-choose-framework">Service Fabric programming model</a> is also able to orchestrate container based services across a cluster of machines. Service Fabric can deploy services in container images. In this blog post, we will see how to use Service Fabric as an orchestrator for Windows based Docker images. The images will be published to Docker Hub and consumed by the Service Fabric orchestrator. We will build an ASPNET Core Web application, Dockerize it and publish it to Docker Hub. Finally we will publish the image to a Service Fabric Cluster.

<strong>Step 1</strong>: Create a ASPNET Core Web Application using Visual Studio.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image542.png"><img width="855" height="486" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb452.png" border="0" /></a>

<strong>Step 2: </strong>Select Web Application template. <strong>DO NOT </strong> check “Enable Docker Support”

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image543.png"><img width="855" height="493" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb453.png" border="0" /></a>

<strong>Step 3: </strong> Once the application is loaded in Visual Studio add a Dockerfile to the root of the project.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image544.png"><img width="845" height="239" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb454.png" border="0" /></a>

<strong>Step 4</strong>. Open the Dockerfile in Visual Studio and add the following steps in the Dockerfile and Save the Dockerfile.
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="551" valign="top">FROM microsoft/dotnet:1.1-sdk-nanoserver
ENTRYPOINT ["dotnet", "bin/Debug/netcoreapp1.1/DemoCoreApp.dll"]
WORKDIR dockerdemo
ADD ./DemoCoreApp .
RUN dotnet restore DemoCoreApp.csproj
RUN dotnet build DemoCoreApp.csproj
EXPOSE 80
ENV ASPNETCORE_URLS <a href="https://0.0.0.0:80">https://0.0.0.0:80</a></td>
</tr>
</tbody>
</table>
<strong>Step 5</strong>. Open Powershell in Admin Mode and browse to the project folder.

<strong>Step 6</strong>. Execute Docker <b>build</b> command to build image from the Dockerfile. Include tag name in the build command as shown below.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image545.png"><img width="800" height="37" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb455.png" border="0" /></a>

<strong>Step 7</strong>. Exexute Docker <b>run</b> command to create the container using the image previously created as shown below

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image546.png"><img width="804" height="77" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb456.png" border="0" /></a>

<strong>Step 8</strong>. Inspect the IP address on which the container is running by executing <b>network</b> <b>inspector</b> <b>nat</b> command.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/SNAGHTML318dca.png"><img width="802" height="453" title="SNAGHTML318dca" alt="SNAGHTML318dca" src="https://msdnshared.blob.core.windows.net/media/2017/05/SNAGHTML318dca_thumb.png" border="0" /></a>

<strong>Step 9. </strong>Open the web browser and navigate to the IP address and you will see the ASP.Net core application running.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image547.png"><img width="850" height="469" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb457.png" border="0" /></a>

<strong>Step 10. </strong>Publish the image to Docker Hub so that it can be consumed from Service Fabric. Before pushing login to Docker Hub using <b>login</b> command

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image548.png"><img width="853" height="287" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb458.png" border="0" /></a>

Now we will use the  image from Docker Hub to deploy to a Service Fabric Cluster.

Let’s begin building the Service Fabric Orchestration piece.

<strong>Step 11</strong>. Open Visual Studio 2017 and create a Service Fabric Application.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image549.png"><img width="855" height="501" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb459.png" border="0" /></a>

<strong>Step 12</strong>. Now choose the Guest Container feature and provide valid Image Name and Click Ok. The image name is the one we published to Docker Hub in the previous exercise.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image550.png"><img width="855" height="515" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb460.png" border="0" /></a>

<strong>Step 13</strong>. Once the application is created and loaded, add the following endpoint information into ServiceManifest.xml

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image551.png"><img width="855" height="469" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb461.png" border="0" /></a>

<strong>Step 14. </strong>Now let’s add following section into ApplicationManifest.xml to add Hub Credentials and Port Binding endpoint information.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/SNAGHTML4f39dc.png"><img width="855" height="454" title="SNAGHTML4f39dc" alt="SNAGHTML4f39dc" src="https://msdnshared.blob.core.windows.net/media/2017/05/SNAGHTML4f39dc_thumb.png" border="0" /></a>

<strong>Step 15. </strong>We are ready to Publish our application to Service Fabric Cluster now. Right click on the Application and Publish to Azure Service Fabric. Make sure when you create the Service Fabric cluster, you pick the option to create it with Windows Server 2016 with Containers.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image552.png"><img width="803" height="563" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb462.png" border="0" /></a>

<strong>Step 16. </strong> First let’s see our application deployed using Service Fabric explorer.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image553.png"><img width="800" height="359" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb463.png" border="0" /></a>

<strong>Step 17. </strong>Now, lets browse to our application on Service Fabric.

<a href="https://msdnshared.blob.core.windows.net/media/2017/05/image554.png"><img width="808" height="419" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb464.png" border="0" /></a>

As you saw in this blog post we can use Service Fabric for Container Orchestration. More coming in next blog on Container Orchestration capabilities like DNS, Scaling, Labels etc.. Stay tuned!]]></content:encoded>
    </item>
    <item>
      <title>Docker Blog Series Part 1- Building ASP.NET Core Application using Docker For Windows.</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/145</link>
      <pubDate>Tue, 20 Sep 2016 01:57:10 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=145</guid>
      <description><![CDATA[Applications and their set of user expectations continue to evolve over the last few years. We have...]]></description>
      <content:encoded><![CDATA[Applications and their set of user expectations continue to evolve over the last few years. We have seen various trends like microservices and containerization become mainstream. The enterprises are beginning to realize the cost savings and other benefits of these technologies. It therefore becomes incumbent to build applications and service with this mindset. In this blog post, I will explain some of the foundational aspects of containerization and showcase <em>‘Docker for Windows’</em> Visual Studio Tooling. Along with that, we will see how to build ASP.NET core application with Docker Support Tooling

Before talking about containers, let’s take a moment to understand Microservices. Microservices and micro services style architecture is about decomposing monolithic application into smaller services. This enables versioning and deploying these services independently. Building microservices based applications helps accelerates agile delivery within an agile engineering teams.

Now let’s talk about containers. Containers provide a mechanism to run software reliably when moved from one computing environment to another. Simply put, containers are a portable unit of application and its underlying dependencies packaged (container image) together. By containerizing the application and its dependencies, the OS and underlying infrastructure differences are abstracted away. Containers isolate applications from each other on a shared OS. Additionally, we can get more isolation using Hyper V Containers. The micro services based services are a perfect fit for containerized applications.

Why should we be interested in containers? Let’s look at some of the value proposition around it.

- The containers enable ‘write-once, run anywhere’ apps.

- They enable microservices style architecture.

- It is also great for dev/test of apps and services.

- From the operations standpoint, this is great from portability and enables higher compute density. We can also scale up and down containers in response to the business needs.

Docker is platform for running these containerized applications. Docker is becoming the standard for implementing containers across the industry. There are different ways to run hosting containers within Docker.

&nbsp;
<ol>
 	<li>Docker for Windows, which uses Hyper V to run the MobyLinux VM or Windows Containers</li>
 	<li>Docker for Mac</li>
 	<li>Boot2Docker and Virtual Box for older scenarios.</li>
</ol>
In this post, I want to give a quick overview on how to run Docker applications locally using ‘<em>Docker for</em> <em>Windows’</em> using Visual Studio Tooling for an ASP.NET Core application.

<strong>Prerequisites: </strong>

<a href="https://visualstudiogallery.msdn.microsoft.com/0f5b2caa-ea00-41c8-b8a2-058c7da0b3e4">- Install Docker Tooling for Visual Studio 2015.</a>

<a href="https://docs.docker.com/docker-for-windows/">- ASP.NET Core</a>

<a href="https://docs.docker.com/docker-for-windows/">- Install Docker for Windows</a>

<em>Step 1:</em>

Create ASP.NET Core Web Application using Visual Studio 2015

<a href="https://msdnshared.blob.core.windows.net/media/2016/09/vs21.png"><img width="1024" height="527" class="alignnone size-large wp-image-295" alt="vs2" src="https://msdnshared.blob.core.windows.net/media/2016/09/vs21-1024x527.png" /></a>

<em>Steps 2:</em>

Right Click on the Web Application we just created and Add – Docker Support. Upon adding Docker support, Visual Studio Tooling automatically creates various Docker files for you to use.

<a href="https://msdnshared.blob.core.windows.net/media/2016/09/dock.png"><img width="1024" height="375" class="alignnone size-large wp-image-255" alt="dock" src="https://msdnshared.blob.core.windows.net/media/2016/09/dock-1024x375.png" /></a><a href="https://msdnshared.blob.core.windows.net/media/2016/09/dock.png"></a>

<em>Step 3:</em>

Review various Docker Files

a- Docker-compose.yml- This yml file is a Docker compose file. Docker compose is a tool which can be used to build multi-container applications. You can have more than one service defined in the docker compose file.
<table style="margin-left: 0.5in;border-collapse: collapse">
<tbody>
<tr>
<td width="1246" style="padding: 0in 5.4pt;border: 1pt solid windowtext">
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">version: '2'</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"> </span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">services:</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span><span style="font-size: 9.5pt">  </span></span><span style="font-size: 9.5pt">webapplication2:</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span><span style="font-size: 9.5pt">    </span></span><span style="font-size: 9.5pt">image: username/webapplication2</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span><span style="font-size: 9.5pt">    </span></span><span style="font-size: 9.5pt">build:</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span><span style="font-size: 9.5pt">      </span></span><span style="font-size: 9.5pt">context: .</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span><span style="font-size: 9.5pt">      </span></span><span style="font-size: 9.5pt">dockerfile: Dockerfile</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span><span style="font-size: 9.5pt">    </span></span><span style="font-size: 9.5pt">ports:</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span><span style="font-size: 9.5pt">      </span></span><span style="font-size: 9.5pt">- "8088:8088"</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p style="margin: 0in 0in 0pt 0.5in">b- Docker File. This file is used to build the docker images using the instructions in this file.</p>

<table style="margin-left: 0.5in;border-collapse: collapse">
<tbody>
<tr>
<td width="1246" style="padding: 0in 5.4pt;border: 1pt solid windowtext">
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">FROM microsoft/dotnet:1.0.0-core</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"> </span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"># Set the Working Directory</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">WORKDIR /app</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"> </span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"># Configure the listening port to 8088</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">ENV ASPNETCORE_URLS https://*:8088</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">EXPOSE 8088</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"> </span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"># Copy the app</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">COPY . /app</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"> </span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt"># Start the app</span></span></span></p>
<p style="margin: 0in 0in 0pt"><span><span style="font-family: Consolas"><span style="font-size: 9.5pt">ENTRYPOINT dotnet WebApplication2.dll</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p style="margin: 0in 0in 0pt"><em>Step 4</em> :</p>
<p style="margin: 0in 0in 0pt">All you need now is to run your Visual Studio Application and you are up and running with your ASP.NET Core application running on a Docker container. We can take a look at the running container using the “docker ps -a” command.</p>
In the next follow up blog post, we will explore How to deploy applications on Docker on Windows using Windows Server 2016 TP5.]]></content:encoded>
    </item>
    <item>
      <title>Web Test Plug-in for Authentication</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/web-and-performance-testing-jwt-token-web-test-plugin-for-authentication</link>
      <pubDate>Tue, 29 Mar 2016 18:07:35 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/?p=103</guid>
      <description><![CDATA[Web and Load testing are essential part of application life cycle management . Within Visual Studio,...]]></description>
      <content:encoded><![CDATA[Web and Load testing are essential part of application life cycle management . Within Visual Studio, we provide a great template to do web and load testing.  This template is used to simulate the application traffic using web tests and simulate high load with the load test template. This works very well for web application, web api's, wcf applications. Web Tests work at the HTTP layer and are basically simulating request/response to and from the server. They don’t execute any JavaScript. Sometimes the application to be load tested require you to provide Authentication information. If it’s a passive mode of authentication your application either redirects to an identity provider or you manage it using Forms authentication.  In case of API’s, where you are expected to provide the authentication information in the header, we can very well achieve that using Web Tests as well.

In this blog post, I will explain how easily you can plug your authentication information for a Web test. I will be using JWT Token as an example of authentication information to be passed in the header of the request.

1- Create a  Visual Studio VS 2013/2015 Web Performance and Load Testing project.

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/image739.png"><img width="836" height="486" title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/03/image_thumb572.png" border="0" /></a>

2- Once the Web Test project is created, record your web test traffic belonging to your application. Since the application is going to need authentication token in the header, let’s see how to pass that information in the request pipeline in a web test.

3- Create a Web Test Plugin. Web Test Plug-in is an extensible plugin model for Web Tests which enables us to override various Web Test Events. In this example I will be overriding the PreWebTest method. Let’s start by creating a class called JWTTokenWebTestPlugin. This class inherits from the WebTestPlugin Class.

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/image740.png"><img width="836" height="804" title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/03/image_thumb575.png" border="0" /></a>

4 – Next up, we are going to override the PreWebTest method and set the Context Parameter to the JWT token. The token is returned from the <strong>GetAdToken </strong>function as shown below. The values to the various parameters needed in the function will be provided from the UI when configuring the JWT web test plugin.

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/image741.png"><img width="838" height="313" title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/03/image_thumb576.png" border="0" /></a>

5 – Right click on the Web Test and click ‘ <em>Add Web Test Plug in’</em>. In the list of plug in’s you will see the JWTTokenWebTestPlugin. Configure the values for the Plug-in and click Ok.

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/image750.png"><img width="571" height="698" title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/03/image_thumb579.png" border="0" /></a>

<a href="https://msdnshared.blob.core.windows.net/media/2016/03/image742.png"><img width="840" height="586" title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/03/image_thumb577.png" border="0" /></a>

6- You are now set up to use Web Test Plugin with JWT Tokens. These tokens will be sent to the web api in the application header.]]></content:encoded>
    </item>
    <item>
      <title>Visual Studio Team Services Release Management IIS Web Deployment vnext</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/visual-studio-team-services-release-management-iis-web-deployment-vnext</link>
      <pubDate>Wed, 20 Jan 2016 15:54:00 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/2016/01/20/visual-studio-team-services-release-management-iis-web-deployment-vnext/</guid>
      <description><![CDATA[Modern Lifecycle Development requires teams to be agile and work with a DevOps mindset. To realize...]]></description>
      <content:encoded><![CDATA[<p>Modern Lifecycle Development requires teams to be agile and work with a DevOps mindset. To realize that vision fully, it is paramount to have a robust release pipeline for managing the releases. Release Management vNext is a <a href="https://www.visualstudio.com/en-us/products/visual-studio-team-services-vs.aspx">VSTS</a> service that enables teams to automate the deployment of their applications in different environments and manage releases effectively with great traceability. RM vnext service makes it possible for teams to do continuous integration and continuous delivery with a sophisticated approval and configuration management workflow. RM vNext is in the Public Preview stage currently.</p>
<p>In this blog post, I will demonstrate using RM VNext for an OnPrem deployment using On Prem Build/Release Agents set up. We will be deploying a simple MVC application which will be packages as a zip file for Web Deploy deployment using OOB IIS Deployment Task. We will set up both Continuous Integration and Continuous Deployment for this sample application.</p>
<h4>&nbsp;</h4>
<h1>Create the ASP.NET Web Application</h1>
<p>1- Create a&nbsp; Visual Studio VS 2013/2015 ASP.Net Web Application.</p>
<p>2- Once the project is created, check in the Solution into the appropriate VSTS Team project. It is assumed here that you have a <a href="https://www.visualstudio.com/en-us/products/visual-studio-team-services-vs.aspx">VSTS</a> project in place.</p>
<h1>Create a Build Definition for the Project in VSTS</h1>
<h6>3.1 We need to go to the Build TAB.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5074.image_32B6556B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5074.image_5F00_32B6556B.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0576.image_thumb_39695EEE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0576.image_5F00_thumb_5F00_39695EEE.png" alt="image" width="277" height="713" border="0" /></a></p>
<h6 align="left">3.1 &ndash; Configure the Build Definition. I will be using Visual Studio Build for this example.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5811.image_4DEEAE6C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5811.image_5F00_4DEEAE6C.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6545.image_thumb_295D20E8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6545.image_5F00_thumb_5F00_295D20E8.png" alt="image" width="843" height="297" border="0" /></a></p>
<h6>3.2- Set up the Repository for Build.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7571.image_6FDA10F0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7571.image_5F00_6FDA10F0.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/1108.image_thumb_2FA3F776.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/1108.image_5F00_thumb_5F00_2FA3F776.png" alt="image" width="844" height="333" border="0" /></a></p>
<p>&nbsp;</p>
<h6>3.3- Set up the CI and Scheduled Build times if needed.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2605.image_4B48836C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2605.image_5F00_4B48836C.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3386.image_thumb_3D0A0A7C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3386.image_5F00_thumb_5F00_3D0A0A7C.png" alt="image" width="847" height="405" border="0" /></a></p>
<h6>3.4- Set up the Agents for the Build. Agents for the build/release are setup through the Agent Pools Sub Tab within Control Panel. For more information you can go here - <a title="https://msdn.microsoft.com/Library/vs/alm/Build/overview" href="https://msdn.microsoft.com/Library/vs/alm/Build/overview">https://msdn.microsoft.com/Library/vs/alm/Build/overview</a></h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7345.image_6D33E5F0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7345.image_5F00_6D33E5F0.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6431.image_thumb_25DE8FFE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6431.image_5F00_thumb_5F00_25DE8FFE.png" alt="image" width="851" height="349" border="0" /></a></p>
<h6>3.4.1 &ndash; Once you have build/release agents set up, you need to configure them for the Build using &lsquo;General&rsquo; TAB.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/1172.image_56086B72.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/1172.image_5F00_56086B72.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5270.image_thumb_7CD681B2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5270.image_5F00_thumb_5F00_7CD681B2.png" alt="image" width="853" height="669" border="0" /></a></p>
<h6>3.5 &ndash; Set up the Index and Publish Symbols.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2148.image_115BD131.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2148.image_5F00_115BD131.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8461.image_thumb_29EB6E81.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8461.image_5F00_thumb_5F00_29EB6E81.png" alt="image" width="854" height="245" border="0" /></a></p>
<h6>3.6 &ndash; Copy the Artifacts of the Build and Publish the Artifacts to Drop Location on the Server. This will be the location to later on pick the build artifacts for the Release.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2260.image_6C5E10B7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2260.image_5F00_6C5E10B7.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3286.image_thumb_411979B0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3286.image_5F00_thumb_5F00_411979B0.png" alt="image" width="855" height="256" border="0" /></a></p>
<h6>3.7 &ndash; Queue up the Build.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5635.image_67E78FF0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5635.image_5F00_67E78FF0.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/4505.image_thumb_47CC8333.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/4505.image_5F00_thumb_5F00_47CC8333.png" alt="image" width="380" height="378" border="0" /></a></p>
<h6>3.8- Build should complete and artifacts should be available in the Drop Location on the server.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3175.image_27B17676.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3175.image_5F00_27B17676.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7725.image_thumb_2E647FF9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7725.image_5F00_thumb_5F00_2E647FF9.png" alt="image" width="831" height="314" border="0" /></a></p>
<h1>Create Release Definition</h1>
<p>Next we will work on the Release part for Deploying the Application to an On Prem Environment using Release Management. We need to go to the Release TAB.</p>
<h6>4.1- Create a Release Definition.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7801.image_031FE8F2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7801.image_5F00_031FE8F2.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/1376.image_thumb_7C00AC79.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/1376.image_5F00_thumb_5F00_7C00AC79.png" alt="image" width="433" height="606" border="0" /></a></p>
<h6>4.2- Configure Release Definition for an On Prem Deployment. Create Environment</h6>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5684.image_5E222878.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5684.image_5F00_5E222878.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/1882.image_thumb_5702EC00.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/1882.image_5F00_thumb_5F00_5702EC00.png" alt="image" width="432" height="607" border="0" /></a></p>
<h6>4.2.1 &ndash; Configure the Environment with the Approvers, release Agent.</h6>
<p>There are options for Pre-Deployment and Post-Deployment Approval. Agent options allow you to configure the Agent for release. The agent you configured for Build can be used for Release as well. You can also use Configure Variables option for tokenization of certain configurations which are environment specific.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5277.image_7DD10240.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5277.image_5F00_7DD10240.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3542.image_thumb_39909AF4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3542.image_5F00_thumb_5F00_39909AF4.png" alt="image" width="432" height="495" border="0" /></a></p>
<h6>4.2.2 &ndash; Add Tasks to the Release Definition.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2134.image_795A8179.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2134.image_5F00_795A8179.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/4064.image_thumb_32052B87.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/4064.image_5F00_thumb_5F00_32052B87.png" alt="image" width="756" height="496" border="0" /></a></p>
<h6>4.2.3 - Create a Windows Machine File Copy to copy the Build Artifacts to a //Share location on the On Prem Machine</h6>
<p>Keeping in mind when working on Prem Deployment, the Build/Release Agent needs to be configured on an On Prem Machine so that they have clear line of sight to the servers which need to be deployed which are on Prem as well.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2477.image_66A587C2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2477.image_5F00_66A587C2.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8204.image_thumb_1B45E3FE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8204.image_5F00_thumb_5F00_1B45E3FE.png" alt="image" width="753" height="354" border="0" /></a></p>
<h6>4.2.4 -&nbsp; Add an IIS Web Application Deployment task to do the On Prem Deployment</h6>
<p>For enabling this, we need to create Deploy Machines which is a machine group which makes it easy to do the deployment. You can also specify the machines using the Machine IP&rsquo;s or FQDN with ports but Machine group is recommended.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6622.image_1426A786.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6622.image_5F00_1426A786.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6786.image_thumb_2FCB337C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6786.image_5F00_thumb_5F00_2FCB337C.png" alt="image" width="766" height="382" border="0" /></a></p>
<h6>4.2.5 &ndash; We now link the Release to the Build Artifacts.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2043.image_569949BC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2043.image_5F00_569949BC.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/4666.image_thumb_367E3CFF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/4666.image_5F00_thumb_5F00_367E3CFF.png" alt="image" width="766" height="347" border="0" /></a></p>
<h6>4.2.7 &ndash; If you need Continuous Deployment, you can check the CD check box and provide the Build Definition.</h6>
<p>This will ensure Release to the environments when build is kicked off and completed.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8132.image_445082FA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8132.image_5F00_445082FA.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8204.image_thumb_0F43F3CA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8204.image_5F00_thumb_5F00_0F43F3CA.png" alt="image" width="772" height="618" border="0" /></a></p>
<h6>4.2.8 &ndash; For creating the Machine Group&nbsp; Machines, we need to go to Test TAB and create a Machine Group under Machines sub TAB.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/1754.image_3CC7A43E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/1754.image_5F00_3CC7A43E.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6064.image_thumb_72CC234B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6064.image_5F00_thumb_5F00_72CC234B.png" alt="image" width="777" height="390" border="0" /></a></p>
<h6>4.2.9 &ndash; The machine group&nbsp; has name of the machines and the WinRM port with credentials for accessing them.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2318.image_3BF1CF05.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2318.image_5F00_3BF1CF05.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3223.image_thumb_0BCA8442.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3223.image_5F00_thumb_5F00_0BCA8442.png" alt="image" width="778" height="403" border="0" /></a></p>
<h6>4.2.10- Create a Release by specifying the Build and the Environment to be released to.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6013.image_394BA405.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6013.image_5F00_394BA405.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2211.image_thumb_4B2837D2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2211.image_5F00_thumb_5F00_4B2837D2.png" alt="image" width="796" height="473" border="0" /></a></p>
<h6>4.2.11 &ndash; On Prem Release is successful.</h6>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/4452.image_71F64E12.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/4452.image_5F00_71F64E12.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2727.image_thumb_5FAD8750.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2727.image_5F00_thumb_5F00_5FAD8750.png" alt="image" width="793" height="254" border="0" /></a></p>
<p>Here is how the Build and Release Summary reports look. Great insight into the Changesets, Associated Work Items, Test cases run, Code Coverage reports.</p>
<p>&nbsp;</p>
<h1><strong><span style="font-size: small;">Build Summary Report</span></strong></h1>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0068.image_067B9D91.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0068.image_5F00_067B9D91.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3632.image_thumb_02051CCA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3632.image_5F00_thumb_5F00_02051CCA.png" alt="image" width="800" height="465" border="0" /></a></p>
<p>&nbsp;</p>
<h1><strong><span style="font-size: small;">Release Summary Report</span></strong></h1>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6431.image_4FA1494A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6431.image_5F00_4FA1494A.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0523.image_thumb_48820CD2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0523.image_5F00_thumb_5F00_48820CD2.png" alt="image" width="811" height="508" border="0" /></a></p>
<p>&nbsp;</p>
<p>You can also check out&nbsp;<a href="https://msdn.microsoft.com/library/vs/alm/release/overview">https://msdn.microsoft.com/library/vs/alm/release/overview</a> for more information. Happy Releasing using RM Vnext service</p>]]></content:encoded>
    </item>
    <item>
      <title>Unit Testing OData Web API/Entity Framework Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/monub/unit-testing-odata-web-apientity-framework-applications</link>
      <pubDate>Sun, 17 May 2015 16:09:31 GMT</pubDate>
      <dc:creator><![CDATA[Monu Bambroo]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/monub/2015/05/17/unit-testing-odata-web-apientity-framework-applications/</guid>
      <description><![CDATA[The cost of fixing bugs is lower if found early in the software development cycle. Unit tests...]]></description>
      <content:encoded><![CDATA[<p>The cost of fixing bugs is lower if found early in the software development cycle. Unit tests greatly reduce this cost by pushing quality upstream. This helps prevent regression bugs and when coupled with TDD approach, provides a solid foundation for a complete test suite. Furthermore, teams are striving to push code into production more frequently and with higher quality. In order to flourish in this DevOps space, it is imperative to have a pipeline of solid automated tests. Traditionally, unit tests have been written for a class library projects or middle tier/business logic projects. </p>  <p>In this blog post, I will demonstrate how to easily unit test an OData based Web API service which is consuming data from SQL DB using Entity Framework. The goal is to write unit tests which stub out the actual DB calls. We will make use of faking the DB Context and using a common DI pattern of construction injection. The result is a highly testable maintainable and cohesive codebase.</p>  <hr style="width: 100%" width="100%" />  <h2>Create the ASP.NET Web Application</h2>  <p>First, open Visual Studio VS 2013, create an ASP.Net Web Application, choose MVC and Web API template and check the Add Unit Tests checkbox.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5554.image_3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5554.image_5F00_3.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7028.image_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7028.image_5F00_thumb.png" width="639" height="564" /></a><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8508.image_10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8508.image_5F00_10.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5468.image_thumb_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5468.image_5F00_thumb_5F00_4.png" width="640" height="481" /></a></p>  <h2>&#160;</h2>  <h2>Create the DB</h2>  <p>Next, create a SQL Database as the backend for this project. Use SQL Server Edition of your choice. I am using SQL Server 2014 for this post. We will use Entity Framework(EF 6.0.0.0) to connect to this DB.</p>  <p>Let the DB name be <strong>ODataDB</strong></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6038.image_14.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6038.image_5F00_14.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0284.image_thumb_6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0284.image_5F00_thumb_5F00_6.png" width="640" height="577" /></a></p>  <p>Next up, create a Table in the database named Application with following properties. </p>  <h2>Create the Application Table</h2>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8688.image_26.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8688.image_5F00_26.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5086.image_thumb_12.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5086.image_5F00_thumb_5F00_12.png" width="647" height="219" /></a></p>  <h2>&#160;</h2>  <h2>Reverse Engineer Code First from the DB</h2>  <p>Right Click on the Web API project we created to reverse engineer code from the database. You will need to install Visual Studio Entity framework extensions.    <br />Make sure Entity Framework dll’s are referenced in the project.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5305.image_22.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5305.image_5F00_22.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0513.image_thumb_10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0513.image_5F00_thumb_5F00_10.png" width="663" height="459" /></a></p>  <p>We now have Application Map.cs and ODataDBContext.cs created and mapping created.</p>  <h2>&#160;</h2>  <h2>Create ODataController </h2>  <p>Next up, install Web API OData Libraries from Nuget for the Web API project. I am using the latest version of ASP.Net Web API2.2 for OData v1-3</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6472.image_34.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6472.image_5F00_34.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/1220.image_thumb_16.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/1220.image_5F00_thumb_5F00_16.png" width="673" height="531" /></a></p>  <p>Now let’s create ODataController based on Entity Framework and call it Application Controller.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7870.image_37.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7870.image_5F00_37.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5758.image_thumb_17.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5758.image_5F00_thumb_5F00_17.png" width="676" height="374" /></a></p>  <p>We will use ApplicationMap and ODataDBContext for Model and Data Context class respectively.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8081.image_39.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8081.image_5F00_39.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2627.image_thumb_18.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2627.image_5F00_thumb_5F00_18.png" width="676" height="273" /></a></p>  <p>Now that Application Controller is created and we have our Get/Post/Put operations in place in the controller class.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0574.image_45.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0574.image_5F00_45.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6443.image_thumb_21.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6443.image_5F00_thumb_5F00_21.png" width="681" height="340" /></a></p>  <p>Click F5, and the OData Service is up and running!</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/4300.image_47.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/4300.image_5F00_47.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8585.image_thumb_22.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8585.image_5F00_thumb_5F00_22.png" width="682" height="182" /></a></p>  <h2>Create Unit Test for the Application Controller</h2>  <p>Now that the application is running, we want to write unit tests for it.</p>  <p>First and foremost, we need to Fake Out the DB Context in our application. Instead of using the ODataDBContext, we will use FakeDBContext. In order to do that we first need to create an interface for ODataDBContext. We will call it IODataDBContext and have ODataDBContext implement from it.</p>  <h2>Create Interface IODataDBContext</h2>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0488.image_49.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0488.image_5F00_49.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3125.image_thumb_23.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3125.image_5F00_thumb_5F00_23.png" width="699" height="484" /></a></p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2148.image_51.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2148.image_5F00_51.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7851.image_thumb_24.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7851.image_5F00_thumb_5F00_24.png" width="701" height="352" /></a></p>  <h2>Implement IODataDBContext from ODataDBContext</h2>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/8422.image_56.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/8422.image_5F00_56.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/1172.image_thumb_26.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/1172.image_5F00_thumb_5F00_26.png" width="696" height="573" /></a></p>  <p>&#160;</p>  <p>Run the application to see everything works like before. Now that the IODataDBContext is in place, let’s create FakeDBContext in the Unit Test Project.</p>  <h2>Unit Test Project Plumbing</h2>  <p>Add the following to the Unit Test Project.</p>  <ul>   <li>Add FakeODataDBContext to the unit test project. Ensure that FakeODataDBContext implements the IODataDBContext Interface. </li>    <li>Add Entity framework dll to the references. </li>    <li>Add System.Web.Http dll to the references. </li>    <li>Add System.Web.Http.OData dll to the references. </li>    <li>Add FakeDBSet class to the project.      <br /></li> </ul>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3731.image_58.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3731.image_5F00_58.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/6215.image_thumb_27.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/6215.image_5F00_thumb_5F00_27.png" width="705" height="404" /></a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/2570.image_66.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/2570.image_5F00_66.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5238.image_thumb_31.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5238.image_5F00_thumb_5F00_31.png" width="694" height="797" /></a></p>  <p>Notice the constructor in the FakeODateDBContext, it has a method called GetApp(), this method is used to create the Fake Application object which is returned to the Unit test when calling the ODataController for Application. </p>  <p>Below is the code for GetApp(), Here we are using the FakeDbSet to create a Fake Application Object in memory for the purposes of the Unit Test.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0363.image_68.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0363.image_5F00_68.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5277.image_thumb_32.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5277.image_5F00_thumb_5F00_32.png" width="710" height="186" /></a></p>  <p>Before we start writing Unit Tests, we need to tweak the controller code to expose the ODataDBContext object as a parameter. This is classic case of constructor dependency injection which would make the code testable.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/5265.image_74.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/5265.image_5F00_74.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/7824.image_thumb_35.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/7824.image_5F00_thumb_5F00_35.png" width="715" height="283" /></a></p>  <p>Now, let’s write the Unit Test for the Application Controller. Here is the Code for the unit test. The unit test&#160; is a&#160; Visual Studio Unit Test.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/3443.image_72.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/3443.image_5F00_72.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/65/98/metablogapi/0312.image_thumb_34.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-65-98-metablogapi/0312.image_5F00_thumb_5F00_34.png" width="718" height="385" /></a></p>  <p>As you see above, we have successfully written a Unit Test for the ODataController Api. The above unit test will exercise the code paths of your controller code and also execute any logic inside it without having to make the actual Database call. The FakeDBContext lets you get/set&#160; data in memory and disposes it once the unit test exits.</p>  <p>You can potentially create Unit Tests for all your Controller methods(Get,Post.Put,Delete) across all your application and ensure very high Code Coverage and a highly testable and maintainable application.</p>  <p>Hopefully this post helps you start writing Unit tests for ODataController Services using Entity Framework.</p>  <hr style="width: 100%" width="100%" />]]></content:encoded>
    </item>
  </channel>
</rss>