Skip to content

Commit 31123dc

Browse files
committed
edit pass
1 parent c70a84a commit 31123dc

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

articles/service-fabric/service-fabric-application-secret-store.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Service Fabric Secrets Store
3-
description: This article describes how to use Service Fabric Secrets Store.
2+
title: Azure Service Fabric Central Secrets Store
3+
description: This article describes how to use Central Secrets Store in Azure Service Fabric.
44

55
ms.topic: conceptual
66
ms.date: 07/25/2019
77
---
88

9-
# Service Fabric Secrets Store
10-
This article describes how to create and use secrets in Service Fabric applications using Service Fabric Secrets Store(CSS). CSS is a local secret store cache, used to keep sensitive data such as a password, tokens, and keys encrypted in memory.
9+
# Central Secrets Store in Azure Service Fabric
10+
This article describes how to use Central Secrets Store (CSS) in Azure Service Fabric to create secrets in Service Fabric applications. CSS is a local secret store cache that keeps sensitive data, such as a password, tokens, and keys, encrypted in memory.
1111

12-
## Enabling Secrets Store
13-
Add the below to your cluster configuration under `fabricSettings` to enable CSS. It's recommended to use a certificate different from cluster certificate for CSS. Make sure the encryption certificate is installed on all nodes and `NetworkService` has read permission to certificate's private key.
12+
## Enable Central Secrets Store
13+
Add the following script to your cluster configuration under `fabricSettings` to enable CSS. It's recommended that you use a certificate other than a cluster certificate for CSS. Make sure the encryption certificate is installed on all nodes and that `NetworkService` has read permission to the certificate's private key.
1414
```json
1515
"fabricSettings":
1616
[
@@ -42,10 +42,14 @@ This article describes how to create and use secrets in Service Fabric applicati
4242
...
4343
]
4444
```
45-
## Declare secret resource
46-
You can create a secret resource either using the Resource Manager template or using the REST API.
45+
## Declare a secret resource
46+
You can create a secret resource by using either the Resource Manager template or the REST API.
47+
48+
### Use the Resource Manager
49+
50+
Use the following template to use Resource Manager to create the secret resource. The template creates a `supersecret` secret resource, but no value is set for the secret resource yet.
51+
4752

48-
* Using Resource Manager template
4953
```json
5054
"resources": [
5155
{
@@ -62,20 +66,20 @@ You can create a secret resource either using the Resource Manager template or u
6266
}
6367
]
6468
```
65-
The above template creates `supersecret` secret resource, but no value is set for the secret resource yet.
6669

67-
* Using the REST API
70+
### Use the REST API
6871

69-
To create secret resource, `supersecret` make a PUT request to `https://<clusterfqdn>:19080/Resources/Secrets/supersecret?api-version=6.4-preview`. You need the cluster certificate or admin client certificate to create a secret.
72+
To create a `supersecret` secret resource by using the REST API, make a PUT request to `https://<clusterfqdn>:19080/Resources/Secrets/supersecret?api-version=6.4-preview`. You need the cluster certificate or admin client certificate to create a secret resource.
7073

7174
```powershell
7275
Invoke-WebRequest -Uri https://<clusterfqdn>:19080/Resources/Secrets/supersecret?api-version=6.4-preview -Method PUT -CertificateThumbprint <CertThumbprint>
7376
```
7477

75-
## Set secret value
76-
* Using Resource Manager template
78+
## Set the secret value
79+
80+
### Use the Resource Manager template
7781

78-
The below Resource Manager template creates and set value for secret `supersecret` with version `ver1`.
82+
Use the following Resource Manager template to create and set the secret value. This template sets the secret value for the `supersecret` secret resource as version `ver1`.
7983
```json
8084
{
8185
"parameters": {
@@ -113,22 +117,26 @@ The below Resource Manager template creates and set value for secret `supersecre
113117
}
114118
],
115119
```
116-
* Using the REST API
120+
### Use the REST API
117121

122+
Use the following script to use the REST API to set the secret value.
118123
```powershell
119124
$Params = @{"properties": {"value": "mysecretpassword"}}
120125
Invoke-WebRequest -Uri https://<clusterfqdn>:19080/Resources/Secrets/supersecret/values/ver1?api-version=6.4-preview -Method PUT -Body $Params -CertificateThumbprint <ClusterCertThumbprint>
121126
```
122-
## Using the secret in your application
127+
## Use the secret in your application
123128

124-
1. Add a section in settings.xml file with the below content. Note here the Value is of the format {`secretname:version`}
129+
Follow these steps to use the secret in your Service Fabric application.
130+
131+
1. Add a section in the **settings.xml** file with the following script. Note here that the value is in the format {`secretname:version`}.
125132

126133
```xml
127134
<Section Name="testsecrets">
128135
<Parameter Name="TopSecret" Type="SecretsStoreRef" Value="supersecret:ver1"/
129136
</Section>
130137
```
131-
2. Now import the section in ApplicationManifest.xml
138+
139+
2. Import the section in **ApplicationManifest.xml**.
132140
```xml
133141
<ServiceManifestImport>
134142
<ServiceManifestRef ServiceManifestName="testservicePkg" ServiceManifestVersion="1.0.0" />
@@ -141,14 +149,12 @@ Invoke-WebRequest -Uri https://<clusterfqdn>:19080/Resources/Secrets/supersecret
141149
</ServiceManifestImport>
142150
```
143151

144-
Environment Variable 'SecretPath' will point to the directory where all secrets are stored. Each parameter listed under section `testsecrets` will be stored in a separate file. Application can now use the secret as shown below
152+
`EnvironmentVariableName=SecretPath` will point to the directory where all secrets are stored. Each parameter listed under the `testsecrets` section is stored in a separate file. The application can now use the secret as follows:
145153
```C#
146154
secretValue = IO.ReadFile(Path.Join(Environment.GetEnvironmentVariable("SecretPath"), "TopSecret"))
147155
```
148-
3. Mounting secrets to a container
149-
150-
Only change required to make the secrets available inside the container is to specify a MountPoint in `<ConfigPackage>`.
151-
Here is the modified ApplicationManifest.xml
156+
3. Mount the secrets to a container. The only change required to make the secrets available inside the container is to specify a mount point in `<ConfigPackage>`.
157+
The following script is the modified **ApplicationManifest.xml**.
152158

153159
```xml
154160
<ServiceManifestImport>
@@ -164,11 +170,9 @@ Here is the modified ApplicationManifest.xml
164170
</Policies>
165171
</ServiceManifestImport>
166172
```
167-
Secrets will be available under the mount point inside your container.
168-
169-
4. Binding secret to an environment variable
173+
Secrets are available under the mount point inside your container.
170174

171-
You can bind secret to a process environment variable by specifying Type='SecretsStoreRef'. Here is an example of how to bind `supersecret` version `ver1` to environment variable `MySuperSecret` in ServiceManifest.xml.
175+
4. You can bind a secret to a process environment variable by specifying `Type='SecretsStoreRef`. The following script is an example of how to bind the `supersecret` version `ver1` to the environment variable `MySuperSecret` in **ServiceManifest.xml**.
172176

173177
```xml
174178
<EnvironmentVariables>

0 commit comments

Comments
 (0)