Skip to content

Commit 49b76d2

Browse files
committed
added secrets chapter
1 parent 65c2ebd commit 49b76d2

File tree

2 files changed

+88
-8
lines changed

2 files changed

+88
-8
lines changed

README.md

+80
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,85 @@ parameters('MBOParams')?['StoreA']?.serviceEndpoint
490490
````
491491

492492
---
493+
## Dealing with secrets
494+
495+
### Move paramater values into the "local.settings.json" file
496+
497+
You probably noticed that some workflow parameter values contain sensitive information which might be stored in your source code repository together with "parameters.json" file.
498+
499+
````
500+
"serviceEndpoint": "https://order-engine.storeb.com",
501+
"OAuthTenantName": "storeb.com",
502+
"OAuthAppId": "61612ba2-5672-4aa2-bfec-18886177871e",
503+
"OAuthAppSecret": "coreAPIB-BigSecret",
504+
505+
````
506+
507+
Working on workflows locally, you can move these values into the local.settings.json file. This file is usually excluded from the source code check-ins because it is included into the [.gitignore](.gitignore) file. Additionally you will need to refer to these values in the parameters.json file
508+
509+
Let's add these parameters to the local.settings.json
510+
511+
Now it will look like that
512+
````
513+
{
514+
"IsEncrypted": false,
515+
"Values": {
516+
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
517+
"FUNCTIONS_WORKER_RUNTIME": "node",
518+
"WORKFLOWS_SUBSCRIPTION_ID": "",
519+
"WORKFLOWS_TENANT_ID": "",
520+
"WORKFLOWS_RESOURCE_GROUP_NAME": "",
521+
"WORKFLOWS_LOCATION_NAME": "",
522+
"WORKFLOWS_MANAGEMENT_BASE_URI": "https://management.azure.com/",
523+
"StoreA.serviceEndpoint": "https://order-engine.storea.com",
524+
"StoreA.OAuthTenantName": "storea.com",
525+
"StoreA.OAuthAppId": "2de6a36b-89f0-4ef3-a8ce-191402ed2a1a",
526+
"StoreA.OAuthAppSecret": "coreAPIA-BigSecret",
527+
"StoreB.serviceEndpoint": "https://order-engine.storeb.com",
528+
"StoreB.OAuthTenantName": "storeb.com",
529+
"StoreB.OAuthAppId": "61612ba2-5672-4aa2-bfec-18886177871e",
530+
"StoreB.OAuthAppSecret": "coreAPIB-BigSecret"
531+
}
532+
}
533+
534+
````
535+
All other values above our custom values were created automatically by Visual Studio Code.
536+
537+
Let's add references to these values into our "parameters.json" file
538+
539+
````
540+
{
541+
"mboParams": {
542+
"type": "Object",
543+
"value": {
544+
"StoreA": {
545+
"serviceEndpoint": "@appsetting('StoreA.serviceEndpoint')",
546+
"OAuthTenantName": "@appsetting('StoreA.OAuthTenantName')",
547+
"OAuthAppId": "@appsetting('StoreA.OAuthAppId')",
548+
"OAuthAppSecret": "@appsetting('StoreA.OAuthAppSecret')",
549+
"retryAttempts": 3,
550+
"retryInterval": 5,
551+
"logLevel": "info"
552+
},
553+
"StoreB": {
554+
"serviceEndpoint": "@appsetting('StoreB.serviceEndpoint')",
555+
"OAuthTenantName": "@appsetting('StoreB.OAuthTenantName')",
556+
"OAuthAppId": "@appsetting('StoreB.OAuthAppId')",
557+
"OAuthAppSecret": "@appsetting('StoreB.OAuthAppSecret')",
558+
"retryAttempts": 5,
559+
"retryInterval": 2,
560+
"logLevel": "error"
561+
}
562+
}
563+
}
564+
}
565+
566+
````
567+
568+
We are using the ["appsetting"](https://docs.microsoft.com/en-us/azure/logic-apps/parameterize-workflow-app?tabs=azure-portal#visual-studio-code) expression type to refer to the app settings in the local.setting.json during the local development, and to the Logic Apps "App Settings" for these values after the [Azure deployment](https://docs.microsoft.com/EN-US/azure/logic-apps/edit-app-settings-host-settings?tabs=azure-portal#manage-app-settings---localsettingsjson)
569+
570+
Repeat your previous test and you see that you receive the same result.
571+
493572

494573

495574
## Scenario Solution proposal
@@ -525,6 +604,7 @@ The real solution does not return the result as an HTTP response, but rather sen
525604

526605
---
527606

607+
528608
## CI/CD
529609

530610
Two GitHub actions were created for CI/CD :

solution/logic/parameters.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
"type": "Object",
44
"value": {
55
"StoreA": {
6-
"serviceEndpoint": "https://order-engine.storea.com",
7-
"OAuthTenantName": "storea.com",
8-
"OAuthAppId": "2de6a36b-89f0-4ef3-a8ce-191402ed2a1a",
9-
"OAuthAppSecret": "coreAPIA-BigSecret",
6+
"serviceEndpoint": "@appsetting('StoreA.serviceEndpoint')",
7+
"OAuthTenantName": "@appsetting('StoreA.OAuthTenantName')",
8+
"OAuthAppId": "@appsetting('StoreA.OAuthAppId')",
9+
"OAuthAppSecret": "@appsetting('StoreA.OAuthAppSecret')",
1010
"retryAttempts": 3,
1111
"retryInterval": 5,
1212
"logLevel": "info"
1313
},
1414
"StoreB": {
15-
"serviceEndpoint": "https://order-engine.storeb.com",
16-
"OAuthTenantName": "storeb.com",
17-
"OAuthAppId": "61612ba2-5672-4aa2-bfec-18886177871e",
18-
"OAuthAppSecret": "coreAPIB-BigSecret",
15+
"serviceEndpoint": "@appsetting('StoreB.serviceEndpoint')",
16+
"OAuthTenantName": "@appsetting('StoreB.OAuthTenantName')",
17+
"OAuthAppId": "@appsetting('StoreB.OAuthAppId')",
18+
"OAuthAppSecret": "@appsetting('StoreB.OAuthAppSecret')",
1919
"retryAttempts": 5,
2020
"retryInterval": 2,
2121
"logLevel": "error"

0 commit comments

Comments
 (0)