You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/service-fabric/service-fabric-concept-resource-model.md
+65-55Lines changed: 65 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,88 +1,100 @@
1
1
---
2
2
title: Azure Service Fabric application resource model
3
-
description: This article provides an overview of managing an Azure Service Fabric application with Azure Resource Manager
3
+
description: This article provides an overview of managing an Azure Service Fabric application by using Azure Resource Manager.
4
4
ms.topic: conceptual
5
5
ms.date: 10/21/2019
6
6
ms.custom: sfrev
7
7
---
8
8
9
9
# Service Fabric application resource model
10
10
11
-
It is recommended that Service Fabric applications are deployed onto your Service Fabric cluster via Azure Resource Manager. This method makes it possible to describe applications and services in JSON and deploy them in the same Resource Manager template as your cluster. As opposed to deploying and managing applications via PowerShell or Azure CLI, there is no need to wait for the cluster to be ready. The process of application registration, provisioning, and deployment can all happen in one step. This is the best practice to manage application life cycle in your cluster. For more information, see [Best practices: Infrastructure as code](https://docs.microsoft.com/azure/service-fabric/service-fabric-best-practices-infrastructure-as-code#azure-service-fabric-resources).
11
+
You have multiple options for deploying Azure Service Fabric applications on your Service Fabric cluster. We recommend using Azure Resource Manager. If you use Resource Manager, you can describe applications and services in JSON, and then deploy them in the same Resource Manager template as your cluster. Unlike using PowerShell or Azure CLI to deploy and manage applications, if you use Resource Manager, you don't have to wait for the cluster to be ready; application registration, provisioning, and deployment can all happen in one step. Using Resource Manager is the best way to manage the application life cycle in your cluster. For more information, see [Best practices: Infrastructure as code](service-fabric-best-practices-infrastructure-as-code.md#azure-service-fabric-resources).
12
12
13
-
When applicable, manage your applications as Resource Manager resources to improve:
13
+
Managing your applications as resources in Resource Manager can help you gain improvements in these areas:
14
14
15
-
* Audit trail: Resource Manager audits every operation and keeps a detailed *Activity Log* that can help you trace any changes made to these applications and your cluster.
16
-
* Role-based access control: Managing access to clusters as well as applications deployed on the cluster can be done via the same Resource Manager template.
17
-
* Azure Resource Manager (via the Azure portal) becomes a one-stop-shop for managing your cluster and critical application deployments.
18
-
19
-
## Service Fabric application life cycle with Azure Resource Manager
15
+
* Audit trail: Resource Manager audits every operation and keeps a detailed activity log. An activity log can help you trace any changes made to the applications and to your cluster.
16
+
* Role-based access control: You can manage access to clusters and to applications deployed on the cluster by using the same Resource Manager template.
17
+
* Management efficiency: Using Resource Manager gives you a single location (the Azure portal) for managing your cluster and critical application deployments.
20
18
21
19
In this document, you will learn how to:
22
20
23
21
> [!div class="checklist"]
24
22
>
25
-
> * Deploy application resources using Azure Resource Manager
26
-
> * Upgrade application resources using Azure Resource Manager
27
-
> * Delete application resources
23
+
> * Deploy application resources by using Resource Manager.
24
+
> * Upgrade application resources by using Resource Manager.
25
+
> * Delete application resources.
26
+
27
+
## Deploy application resources
28
+
29
+
The high-level steps you take to deploy an application and its services by using the Resource Manager application resource model are:
30
+
1. Package the application code.
31
+
1. Upload the package.
32
+
1. Reference the location of the package in a Resource Manager template as an application resource.
28
33
29
-
## Deploy application resources using Azure Resource Manager
34
+
For more information, view [Package an application](service-fabric-package-apps.md#create-an-sfpkg).
30
35
31
-
To deploy an application and its services using the Azure Resource Manager application resource model, you need to package application code, upload the package, and then reference the location of package in an Azure Resource Manager template as an application resource. For more information, view [Package an application](https://docs.microsoft.com/azure/service-fabric/service-fabric-package-apps#create-an-sfpkg).
36
+
Then, you create a Resource Manager template, update the parameters file with application details, and deploy the template on the Service Fabric cluster. [Explore samples](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart/tree/master/ARM).
32
37
33
-
Then, create an Azure Resource Manager template, update the parameters file with application details, and deploy it on the Service Fabric cluster. Refer to samples [here](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart/tree/master/ARM).
38
+
### Create a storage account
34
39
35
-
### Create a Storage account
40
+
To deploy an application from a Resource Manager template, you must have a storage account. The storage account is used to stage the application image.
36
41
37
-
Deploying an application from a Resource Manager template requires a storage account to stage the application image. You can re-use an existing storage account or create a new storage account to stage your applications. If you would like to use an existing storage account, you can skip this step.
42
+
You can reuse an existing storage account or you can create a new storage account for staging your applications. If you use an existing storage account, you can skip this step.
38
43
39
44
![Create a storage account][CreateStorageAccount]
40
45
41
-
### Configure Storage account
46
+
### Configure your storage account
42
47
43
-
Once the storage account has been created, you need to create a blob container where the applications can be staged. In the Azure portal, navigate to the storage account that you would like to store your applications. Select the **Blobs**blade, and click the **Add Container** button. Resources in your cluster can be secured by setting the public access level to private. Access can be granted in a number of ways:
48
+
After the storage account is created, you create a blob container where the applications can be staged. In the Azure portal, go to the Azure Storage account where you want to store your applications. Select **Blobs**> **Add Container**.
44
49
45
-
*[Authorize access to blobs and queues with Azure Active Directory](../storage/common/storage-auth-aad-app.md)
46
-
*[Grant access to Azure blob and queue data with RBAC in the Azure portal](../storage/common/storage-auth-aad-rbac-portal.md)
47
-
*[Delegate access with a shared access signature (SAS)](https://docs.microsoft.com/rest/api/storageservices/delegate-access-with-shared-access-signature
48
-
)
50
+
Resources in your cluster can be secured by setting the public access level to **private**. You can grant access in multiple ways:
49
51
50
-
For this example we will proceed using anonymous read access for blobs.
52
+
* Authorize access to blobs and queues by using [Azure Active Directory](../storage/common/storage-auth-aad-app.md).
53
+
* Grant access to Azure blob and queue data by using [RBAC in the Azure portal](../storage/common/storage-auth-aad-rbac-portal.md).
54
+
* Delegate access by using a [shared access signature](https://docs.microsoft.com/rest/api/storageservices/delegate-access-with-shared-access-signature).
55
+
56
+
The example in the following screenshot uses anonymous read access for blobs.
51
57
52
58
![Create blob][CreateBlob]
53
59
54
-
### Stage application in a Storage account
60
+
### Stage the application in your storage account
61
+
62
+
Before you can deploy an application, you must stage the application in blob storage. In this tutorial, we create the application package manually. Keep in mind that this step can be automated. For more information, see [Package an application](service-fabric-package-apps.md#create-an-sfpkg).
55
63
56
-
Before the application can be deployed, it must be staged in blob storage. In this tutorial we will create the application package manually, however this step can be automated. For more information, view [Package an application](https://docs.microsoft.com/azure/service-fabric/service-fabric-package-apps#create-an-sfpkg). In the following steps the [Voting sample application](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart) will be used.
64
+
In this tutorial, we use the [Voting sample application](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart).
57
65
58
-
1. In Visual Studio right-click on the Voting project and select package.
59
-
![Package Application][PackageApplication]
60
-
2. Open the **.\service-fabric-dotnet-quickstart\Voting\pkg\Debug** directory that was just create, and zip the contents into a file called **Voting.zip** such that the ApplicationManifest.xml is at the root of the zip file.
61
-
![Zip Application][ZipApplication]
62
-
3. Rename the extension of the file from .zip to **.sfpkg**.
63
-
4. In the Azure portal, in the **apps** container of your storage account, click **Upload** and upload **Voting.sfpkg**.
64
-
![Upload App Package][UploadAppPkg]
66
+
1. In Visual Studio, right-click the **Voting** project, and then select **Package**.
65
67
66
-
The application is now staged. We are now ready to create the Azure Resource Manager template to deploy the application.
68
+
![Package Application][PackageApplication]
69
+
1. Go to the *.\service-fabric-dotnet-quickstart\Voting\pkg\Debug* directory. Zip the contents into a file called *Voting.zip*. The *ApplicationManifest.xml* file should be at the root in the zip file.
67
70
68
-
### Create the Azure Resource Manager template
71
+
![Zip Application][ZipApplication]
72
+
1. Rename the file to change the extension from .zip to *.sfpkg*.
69
73
70
-
The sample application contains [Azure Resource Manager Templates](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart/tree/master/ARM) that can be used to deploy the application. The template files are named **UserApp.json** and **UserApp.Parameters.json**.
74
+
1. In the Azure portal, in the **apps** container for your storage account, select **Upload**, and then upload **Voting.sfpkg**.
75
+
76
+
![Upload App Package][UploadAppPkg]
77
+
78
+
Now, the application is now staged and you can create the Resource Manager template to deploy the application.
79
+
80
+
### Create the Resource Manager template
81
+
82
+
The sample application contains [Azure Resource Manager templates](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart/tree/master/ARM) you can use to deploy the application. The template file names are *UserApp.json* and *UserApp.Parameters.json*.
71
83
72
84
> [!NOTE]
73
-
> The **UserApp.Parameters.json** file must be updated with the name of your cluster.
85
+
> The *UserApp.Parameters.json* file must be updated with the name of your cluster.
| clusterName | The name of the cluster you're deploying to | sf-cluster123 ||
80
92
| application | The name of the application | Voting |
81
-
| applicationTypeName | The type name of the application | VotingType | Must match what's in ApplicationManifest.xml |
82
-
| applicationTypeVersion | The version of the application type | 1.0.0 | Must match what's in ApplicationManifest.xml |
83
-
| serviceName | The name of the service the service | Voting~VotingWeb | Must be in the format ApplicationName~ServiceType |
84
-
| serviceTypeName | The type name of the service | VotingWeb | Must match what's in the ServiceManifest.xml |
85
-
| appPackageUrl | The blob storage URL of the application |https://servicefabricapps.blob.core.windows.net/apps/Voting.sfpkg| The URL of the application package in blob storage (the procedure to set this is described below) |
93
+
| applicationTypeName | The type name of the application | VotingType | Must match ApplicationManifest.xml |
94
+
| applicationTypeVersion | The version of the application type | 1.0.0 | Must match ApplicationManifest.xml |
95
+
| serviceName | The name of the service | Voting~VotingWeb | Must be in the format ApplicationName~ServiceType |
96
+
| serviceTypeName | The type name of the service | VotingWeb | Must match ServiceManifest.xml |
97
+
| appPackageUrl | The blob storage URL of the application |https://servicefabricapps.blob.core.windows.net/apps/Voting.sfpkg| The URL of the application package in blob storage (the procedure to set the URL is described later in the article) |
## Upgrade Service Fabric application using Azure Resource Manager
134
+
## Upgrade the Service Fabric application by using Resource Manager
123
135
124
-
Applications already deployed to a Service Fabric cluster will be upgraded for the following reasons:
136
+
You might upgrade an application that's already deployed to a Service Fabric cluster for one of these reasons:
125
137
126
-
1. A new service is added to the application. A service definition must be added to service-manifest.xml and application-manifest.xml file. Then to reflect new version of application, you need to update the application type version from 1.0.0 to 1.0.1 [UserApp.parameters.json](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart/blob/master/ARM/UserApp.Parameters.json).
138
+
* A new service is added to the application. A service definition must be added to *service-manifest.xml* and *application-manifest.xml* files when a service is added to the application. To reflect a new version of an application, you also must change the application type version from 1.0.0 to 1.0.1 in [UserApp.Parameters.json](https://github.com/Azure-Samples/service-fabric-dotnet-quickstart/blob/master/ARM/UserApp.Parameters.json):
127
139
128
140
```json
129
141
"applicationTypeVersion": {
@@ -137,7 +149,7 @@ Applications already deployed to a Service Fabric cluster will be upgraded for t
137
149
}
138
150
```
139
151
140
-
2. A new version of an existing service is added to the application. This involves application code changes and updates to app type version and name.
152
+
* A new version of an existing service is added to the application. Examples include application code changes and updates to app type version and name. For this upgrade, update UserApp.Parameters.json like this:
141
153
142
154
```json
143
155
"applicationTypeVersion": {
@@ -147,15 +159,15 @@ Applications already deployed to a Service Fabric cluster will be upgraded for t
147
159
148
160
## Delete application resources
149
161
150
-
Applications deployed using the application resource model in Azure Resource Manager can be deleted from cluster using below steps
162
+
To delete an application that was deployed by using the application resource model in Resource Manager:
151
163
152
-
1) Get resource ID for application using [Get-AzResource](https://docs.microsoft.com/powershell/module/az.resources/get-azresource?view=azps-2.5.0):
164
+
1. Use the [Get-AzResource](https://docs.microsoft.com/powershell/module/az.resources/get-azresource?view=azps-2.5.0) cmdlet to get the resource ID for the application:
153
165
154
166
```powershell
155
167
Get-AzResource -Name <String> | f1
156
168
```
157
169
158
-
2) Delete the application resources using [Remove-AzResource](https://docs.microsoft.com/powershell/module/az.resources/remove-azresource?view=azps-2.5.0):
170
+
1. Use the [Remove-AzResource](https://docs.microsoft.com/powershell/module/az.resources/remove-azresource?view=azps-2.5.0) cmdlet to delete the application resources:
* [Manage applications and services as Azure Resources](https://docs.microsoft.com/azure/service-fabric/service-fabric-best-practices-infrastructure-as-code)
0 commit comments