Skip to content

Commit e11fa40

Browse files
authored
Merge pull request #57349 from v-vasuke/deploy-net-2SF
Deploy .net to SF cleanup
2 parents 3a5ccf1 + b172c12 commit e11fa40

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

articles/service-fabric/service-fabric-host-app-in-a-container.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ The container is now ready to be built and packaged in a Service Fabric applicat
5757
## Create an Azure SQL DB
5858
When running the Fabrikam Fiber CallCenter application in production, the data needs to be persisted in a database. There is currently no way to guarantee persistent data in a container, therefore you cannot store production data in SQL Server in a container.
5959

60-
We recommend [Azure SQL Database](/azure/sql-database/sql-database-get-started-powershell). To set up and run a managed SQL Server DB in Azure, run the following script. Modify the script variables as necessary. *clientIP* is the IP address of your development computer.
61-
62-
If you are behind a corporate firewall, the IP address of your development computer may not be IP address exposed to the internet. To verify that the database has the correct IP address for the firewall rule, go to the [Azure portal](https://portal.azure.com) and find your database in the SQL Databases section. Click on its name, then in the Overview section click "Set server firewall". "Client IP address" is the IP address of your development machine. Ensure that it matches the IP address in the "AllowClient" rule.
60+
We recommend [Azure SQL Database](/azure/sql-database/sql-database-get-started-powershell). To set up and run a managed SQL Server DB in Azure, run the following script. Modify the script variables as necessary. *clientIP* is the IP address of your development computer. Take note of the name of the server outputted by the script.
6361

6462
```powershell
6563
$subscriptionID="<subscription ID>"
@@ -80,7 +78,7 @@ $adminlogin = "ServerAdmin"
8078
$password = "Password@123"
8179
8280
# The IP address of your development computer that accesses the SQL DB.
83-
$clientIP = "24.18.117.76"
81+
$clientIP = "<client IP>"
8482
8583
# The database name.
8684
$databasename = "call-center-db"
@@ -107,13 +105,15 @@ New-AzureRmSqlDatabase -ResourceGroupName $dbresourcegroupname `
107105
108106
Write-Host "Server name is $servername"
109107
```
108+
> [!TIP]
109+
> If you are behind a corporate firewall, the IP address of your development computer may not be IP address exposed to the internet. To verify that the database has the correct IP address for the firewall rule, go to the [Azure portal](https://portal.azure.com) and find your database in the SQL Databases section. Click on its name, then in the Overview section click "Set server firewall". "Client IP address" is the IP address of your development machine. Ensure that it matches the IP address in the "AllowClient" rule.
110110
111111
## Update the web config
112-
Back in the **FabrikamFiber.Web** project, update the connection string in the **web.config** file, to point to the SQL Server in the container. Update the *Server* part of the connection string for the server created by the previous script.
112+
Back in the **FabrikamFiber.Web** project, update the connection string in the **web.config** file, to point to the SQL Server in the container. Update the *Server* part of the connection string to be the server name created by the previous script. It should be something like "fab-fiber-751718376.database.windows.net".
113113

114114
```xml
115-
<add name="FabrikamFiber-Express" connectionString="Server=tcp:fab-fiber-1300282665.database.windows.net,1433;Initial Catalog=call-center-db;Persist Security Info=False;User ID=ServerAdmin;Password=Password@123;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
116-
<add name="FabrikamFiber-DataWarehouse" connectionString="Server=tcp:fab-fiber-1300282665.database.windows.net,1433;Initial Catalog=call-center-db;Persist Security Info=False;User ID=ServerAdmin;Password=Password@123;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
115+
<add name="FabrikamFiber-Express" connectionString="Server=<server name>,1433;Initial Catalog=call-center-db;Persist Security Info=False;User ID=ServerAdmin;Password=Password@123;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
116+
<add name="FabrikamFiber-DataWarehouse" connectionString="Server=<server name>,1433;Initial Catalog=call-center-db;Persist Security Info=False;User ID=ServerAdmin;Password=Password@123;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
117117

118118
```
119119
>[!NOTE]
@@ -138,15 +138,17 @@ $registry = New-AzureRMContainerRegistry -ResourceGroupName $acrresourcegroupnam
138138
```
139139

140140
## Create a Service Fabric cluster on Azure
141-
Service Fabric applications run on a cluster, a network-connected set of virtual or physical machines. Before you can deploy the application to Azure, first create a Service Fabric cluster in Azure.
141+
Service Fabric applications run on a cluster, a network-connected set of virtual or physical machines. Before you can deploy the application to Azure, create a Service Fabric cluster in Azure.
142142

143143
You can:
144144
- Create a test cluster from Visual Studio. This option allows you to create a secure cluster directly from Visual Studio with your preferred configurations.
145145
- [Create a secure cluster from a template](service-fabric-tutorial-create-vnet-and-windows-cluster.md)
146146

147147
This tutorial creates a cluster from Visual Studio, which is ideal for test scenarios. If you create a cluster some other way or use an existing cluster, you can copy and paste your connection endpoint or choose it from your subscription.
148148

149-
When creating the cluster, choose a SKU that supports running containers. The Windows Server OS on your cluster nodes must be compatible with the Windows Server OS of your container. To learn more, see [Windows Server container OS and host OS compatibility](service-fabric-get-started-containers.md#windows-server-container-os-and-host-os-compatibility). By default, this tutorial creates a Docker image based on Windows Server 2016 LTSC. Containers based on this image will run on clusters created with Windows Server 2016 Datacenter with Containers. However, if you create a cluster or use an existing cluster based on Windows Server Datacenter Core 1709 with Containers, you must change the Windows Server OS image that the container is based on. Open the **Dockerfile** in the **FabrikamFiber.Web** project, comment out the existing `FROM` statement (based on `windowsservercore-ltsc`) and uncomment the `FROM` statement based on `windowsservercore-1709`.
149+
Before starting, open FabrikamFiber.Web->PackageRoot->ServiceManifest.xml in the Solution Explorer. Take note of the port for the web front-end listed in **Endpoint**.
150+
151+
When creating the cluster,
150152

151153
1. Right-click on the **FabrikamFiber.CallCenterApplication** application project in the Solution Explorer and choose **Publish**.
152154

@@ -156,21 +158,29 @@ When creating the cluster, choose a SKU that supports running containers. The Wi
156158

157159
4. In the **Create cluster** dialog, modify the following settings:
158160

159-
1. Specify the name of your cluster in the **Cluster Name** field, as well as the subscription and location you want to use.
160-
2. Optional: You can modify the number of nodes. By default you have three nodes, the minimum required for testing Service Fabric scenarios.
161-
3. Select the **Certificate** tab. In this tab, type a password to use to secure the certificate of your cluster. This certificate helps make your cluster secure. You can also modify the path to where you want to save the certificate. Visual Studio can also import the certificate for you, since this is a required step to publish the application to the cluster.
162-
4. Select the **VM Detail** tab. Specify the password you would like to use for the Virtual Machines (VM) that make up the cluster. The user name and password can be used to remotely connect to the VMs. You must also select a VM machine size and can change the VM image if needed.
163-
5. In the **Advanced** tab, list the application port to open in the load balancer when the cluster deploys. In Solution Explorer, open FabrikamFiber.Web->PackageRoot->ServiceManifest.xml. The port for the web front-end is listed in **Endpoint**. You can also add an existing Application Insights key to be used to route application log files to.
164-
6. When you are done modifying settings, select the **Create** button.
165-
5. Creation takes several minutes to complete; the output window will indicate when the cluster is fully created.
161+
a. Specify the name of your cluster in the **Cluster Name** field, as well as the subscription and location you want to use. Take note of the name of your cluster resource group.
162+
163+
b. Optional: You can modify the number of nodes. By default you have three nodes, the minimum required for testing Service Fabric scenarios.
164+
165+
c. Select the **Certificate** tab. In this tab, type a password to use to secure the certificate of your cluster. This certificate helps make your cluster secure. You can also modify the path to where you want to save the certificate. Visual Studio can also import the certificate for you, since this is a required step to publish the application to the cluster.
166+
167+
d. Select the **VM Detail** tab. Specify the password you would like to use for the Virtual Machines (VM) that make up the cluster. The user name and password can be used to remotely connect to the VMs. You must also select a VM machine size and can change the VM image if needed.
168+
169+
> [!IMPORTANT]
170+
>Choose a SKU that supports running containers. The Windows Server OS on your cluster nodes must be compatible with the Windows Server OS of your container. To learn more, see [Windows Server container OS and host OS compatibility](service-fabric-get-started-containers.md#windows-server-container-os-and-host-os-compatibility). By default, this tutorial creates a Docker image based on Windows Server 2016 LTSC. Containers based on this image will run on clusters created with Windows Server 2016 Datacenter with Containers. However, if you create a cluster or use an existing cluster based on Windows Server Datacenter Core 1709 with Containers, you must change the Windows Server OS image that the container is based on. Open the **Dockerfile** in the **FabrikamFiber.Web** project, comment out the existing `FROM` statement (based on `windowsservercore-ltsc`) and uncomment the `FROM` statement based on `windowsservercore-1709`.
171+
172+
e. In the **Advanced** tab, list the application port to open in the load balancer when the cluster deploys. This is the port that you took note of before starting creating the cluster. You can also add an existing Application Insights key to be used to route application log files to.
173+
174+
f. When you are done modifying settings, select the **Create** button.
175+
1. Creation takes several minutes to complete; the output window will indicate when the cluster is fully created.
166176

167177

168178
## Allow your application running in Azure to access the SQL DB
169-
Previously, you created a SQL firewall rule to give access to your application running locally. Next, you need to enable the application running in Azure to access the SQL DB. Create a [virtual network service endpoint](/azure/sql-database/sql-database-vnet-service-endpoint-rule-overview) for the Service Fabric cluster and then create a rule to allow that endpoint to access the SQL DB.
179+
Previously, you created a SQL firewall rule to give access to your application running locally. Next, you need to enable the application running in Azure to access the SQL DB. Create a [virtual network service endpoint](/azure/sql-database/sql-database-vnet-service-endpoint-rule-overview) for the Service Fabric cluster and then create a rule to allow that endpoint to access the SQL DB. Be sure to specify the cluster resource group variable that you took note of when creating the cluster.
170180

171181
```powershell
172182
# Create a virtual network service endpoint
173-
$clusterresourcegroup = "fabrikamfiber.callcenterapplication_RG"
183+
$clusterresourcegroup = "<cluster resource group>"
174184
$resource = Get-AzureRmResource -ResourceGroupName $clusterresourcegroup -ResourceType Microsoft.Network/virtualNetworks | Select-Object -first 1
175185
$vnetName = $resource.Name
176186

0 commit comments

Comments
 (0)