0

I created a fresh mesh app and it is working fine. Now I updated the service yaml to add one secret as following:

Secrets:
        - name: MySecret.txt
          description: My Mesh Application Secret
          secret_type: inlinedValue
          content_type: SecretStoreRef
          value: mysecret
        - name: mysecret:1.0
          description: My Mesh Application Secret Value
          secret_type: value
          content_type: text/plain
          value: "P@ssw0rd#1234"

I have taken this example from the official microsoft documentation. Now after redeploying or even fresh with fresh deployment (tried both) the application when I run the following command :

az mesh secret list -g <resourcegroupname>

I get and [] list i.e. no secrets are shown. Please note that the applications are working fine and also the deployment too succeeded. Please assist.

Dadwals
  • 1,171
  • 2
  • 8
  • 15
  • OK, after further investigation, it looks like the Visual Studio tool does not support the secrets mentioned in yaml file to merge into a ARM JSON file during publish. So I just manually updated the ARM JSON as mentioned in the official Mesh documentation. – Dadwals Feb 15 '19 at 19:26
  • But now when I am deploying the template to Azure, Azure is throwing a template validation error: `"Deployment template validation failed: 'The template resource 'websecret:1.0' for type 'Microsoft.ServiceFabricMesh/secrets/values' at line '163' and column '9' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name` – Dadwals Feb 15 '19 at 19:30
  • Please refere to https://github.com/MicrosoftDocs/azure-docs/issues/25070 for answer – Dadwals Feb 15 '19 at 21:44

1 Answers1

1

I have an issue open on that page for a number of problems that document has. Here's what I had to do to my ARM templates to get the template deploying:

Change the secret name to "MySecret.txt/1"

Change

properties": {
  "kind": "inlinedValue",
  "description": "My Mesh Application Secret",
  "contentType": "SecretsStoreRef",
  "value": "mysecret",
}

to

"properties": {
  "kind": "inlinedValue",
  "description": "My Mesh Application Secret",
  "contentType": "text/plain",
}

To access your secret, you'll have to add a setting to your codePackages node:

"settings": [
  {
    "name": "MySecretPasswordSetting",
    "value": "[resourceId('Microsoft.ServiceFabricMesh/secrets/values','MySecret.txt','v1')]"
  }
]

I also had to add "Microsoft.ServiceFabricMesh/secrets/MySecret.txt/values/v1" to my Microsoft.ServiceFabricMesh/applications.dependsOn.

sirdank
  • 3,351
  • 3
  • 25
  • 58