1
+ {
2
+ "metadata" : {
3
+ "kernelspec" : {
4
+ "name" : " .net-powershell" ,
5
+ "display_name" : " .NET (PowerShell)"
6
+ },
7
+ "language_info" : {
8
+ "name" : " PowerShell" ,
9
+ "version" : " 7.0" ,
10
+ "mimetype" : " text/x-powershell" ,
11
+ "file_extension" : " .ps1" ,
12
+ "pygments_lexer" : " powershell"
13
+ }
14
+ },
15
+ "nbformat_minor" : 2 ,
16
+ "nbformat" : 4 ,
17
+ "cells" : [
18
+ {
19
+ "cell_type" : " markdown" ,
20
+ "source" : [
21
+ " # Storing Secrets for your labs\r\n " ,
22
+ " \r\n " ,
23
+ " You can use the Microsoft.PowerShell.SecretManagement module introduced here to store and retrieve secrets with PowerShell.\r\n " ,
24
+ " \r\n " ,
25
+ " Installation\r\n " ,
26
+ " You install it from the PowerShell Gallery using"
27
+ ],
28
+ "metadata" : {
29
+ "azdata_cell_guid" : " 9536f2d9-53b8-4fa8-8e6a-3f1917e5ac40"
30
+ }
31
+ },
32
+ {
33
+ "cell_type" : " code" ,
34
+ "source" : [
35
+ " Install-Module Microsoft.PowerShell.SecretManagement -AllowPrerelease"
36
+ ],
37
+ "metadata" : {
38
+ "azdata_cell_guid" : " 2e0b6025-b8ac-40f5-924b-6fb17da870ca"
39
+ },
40
+ "outputs" : [],
41
+ "execution_count" : null
42
+ },
43
+ {
44
+ "cell_type" : " markdown" ,
45
+ "source" : [
46
+ " You need to use the `-PreRelease` flag at the moment as it is in preview. \r\n " ,
47
+ " \r\n " ,
48
+ " ## Local Vault\r\n " ,
49
+ " \r\n " ,
50
+ " It will come with a built in local key vault for you to use. You can see this with `Get-SecretVault`"
51
+ ],
52
+ "metadata" : {
53
+ "azdata_cell_guid" : " 9805b9c4-b61d-4f81-9bc7-89df70c5f3fe"
54
+ }
55
+ },
56
+ {
57
+ "cell_type" : " code" ,
58
+ "source" : [
59
+ " Get-SecretVault"
60
+ ],
61
+ "metadata" : {
62
+ "azdata_cell_guid" : " c56718a1-6a3e-45f2-b9c8-334ded6c5f84"
63
+ },
64
+ "outputs" : [
65
+ {
66
+ "data" : {
67
+ "text/html": "<script type=\"text/javascript\">#!javascript\r\nif ((typeof(requirejs) !== typeof(Function)) || (typeof(requirejs.config) !== typeof(Function))) { \r\n let script = document.createElement(\"script\"); \r\n script.setAttribute(\"src\", \"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\"); \r\n script.onload = function(){\r\n loadDotnetInteractiveApi();\r\n };\r\n document.getElementsByTagName(\"head\")[0].appendChild(script); \r\n}\r\nelse {\r\n loadDotnetInteractiveApi();\r\n}\r\n\r\nfunction loadDotnetInteractiveApi(){\r\n let apiRequire = requirejs.config({context:\"dotnet-interactive.23580.54265\",paths:{dotnetInteractive:\"http://localhost:54265/resources/dotnet-interactive\"}});\r\n apiRequire(['dotnetInteractive'], \r\n function(api) { \r\n api.createDotnetInteractiveClient(\"http://localhost:54265/\", window);\r\n },\r\n function(error){\r\n console.log(error);\r\n });\r\n}</script>"
68
+ },
69
+ "metadata" : {},
70
+ "output_type" : " display_data"
71
+ },
72
+ {
73
+ "name" : " stdout" ,
74
+ "text" : " \r\n " ,
75
+ "output_type" : " stream"
76
+ },
77
+ {
78
+ "name" : " stdout" ,
79
+ "text" : " Name ModuleName ImplementingType\r\n " ,
80
+ "output_type" : " stream"
81
+ },
82
+ {
83
+ "name" : " stdout" ,
84
+ "text" : " ---- ---------- ----------------\r\n " ,
85
+ "output_type" : " stream"
86
+ },
87
+ {
88
+ "name" : " stdout" ,
89
+ "text" : " BuiltInLocalVault \r\n " ,
90
+ "output_type" : " stream"
91
+ },
92
+ {
93
+ "name" : " stdout" ,
94
+ "text" : " \r\n " ,
95
+ "output_type" : " stream"
96
+ }
97
+ ],
98
+ "execution_count" : 1
99
+ },
100
+ {
101
+ "cell_type" : " markdown" ,
102
+ "source" : [
103
+ " ## Store your secrets\r\n " ,
104
+ " \r\n " ,
105
+ " This is a great place to store your secrets for your demos. You can add your secrets using a couple of methods\r\n " ,
106
+ " \r\n " ,
107
+ " - It's just your lab, just type them in to `Get-Secret`"
108
+ ],
109
+ "metadata" : {
110
+ "azdata_cell_guid" : " 5e8eb5ee-ce89-4eab-a00c-e7fa5e33b680"
111
+ }
112
+ },
113
+ {
114
+ "cell_type" : " code" ,
115
+ "source" : [
116
+ " Set-Secret -Name BeardLabSaAccount -Secret 'BeardsAreAwesome'"
117
+ ],
118
+ "metadata" : {
119
+ "azdata_cell_guid" : " 4e846ca5-d89a-4a91-a8b0-59505f7fd7f2"
120
+ },
121
+ "outputs" : [],
122
+ "execution_count" : 2
123
+ }
124
+ ]
125
+ }
0 commit comments