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/managed-ccf/quickstart-typescript.md
+76-27Lines changed: 76 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,20 +30,33 @@ This quickstart uses the Azure Identity library, along with Azure CLI or Azure P
30
30
31
31
[!INCLUDE [Sign in to Azure](../../includes/confidential-ledger-sign-in-azure.md)]
32
32
33
+
### Initialize a new npm project
34
+
Begin by initializing a new `npm` project in a folder. You may skip this step if you have an existing node project.
35
+
```terminal
36
+
cd <work folder>
37
+
npm init -y
38
+
```
39
+
33
40
### Install the packages
34
41
35
42
In a terminal or command prompt, create a suitable project folder, and then create and activate a Python virtual environment as described on [Use Python virtual environments](/azure/developer/python/configure-local-development-environment?tabs=cmd#use-python-virtual-environments).
36
43
37
44
Install the Azure Active Directory identity client library.
38
45
39
46
```terminal
40
-
npm install @azure/identity
47
+
npm install --save @azure/identity
41
48
```
42
49
43
50
Install the Azure Confidential Ledger management plane client library.
The Azure SDK for JavaScript and TypeScript library (azure/arm-confidentialledger) allows operations on Managed CCF resources, such as creation and deletion, listing the resources associated with a subscription, and viewing the details of a specific resource. The following piece of code creates and views the properties of a Managed CCF resource.
78
+
The Azure SDK for JavaScript and TypeScript library [azure/arm-confidentialledger](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/confidentialledger/arm-confidentialledger) allows operations on Managed CCF resources, such as creation and deletion, listing the resources associated with a subscription, and viewing the details of a specific resource.
79
+
80
+
To run the below samples, please save the code snippets into a file with a `.ts` extension into your project folder and compile it as part of your TypeScript project, or compile the script into JavaScript separately by running:
81
+
82
+
```terminal
83
+
tsc <filename.ts>
84
+
```
85
+
86
+
The compiled JavaScript file will have the same name but a `*.js` extension. Then run the script in nodeJS:
87
+
```terminal
88
+
node <filename.js>
89
+
```
90
+
91
+
The following sample TypeScript code creates and views the properties of a Managed CCF resource.
@@ -132,11 +150,42 @@ export async function main() {
132
150
console.log("Deleted.");
133
151
}
134
152
135
-
main().catch((err) => {
136
-
console.error(err);
137
-
});
153
+
(async () => {
154
+
try {
155
+
awaitmain();
156
+
} catch(err) {
157
+
console.error(err);
158
+
}
159
+
})();
138
160
```
139
161
162
+
## Delete the Managed CCF resource
163
+
The following piece of code deletes the Managed CCF resource. Other Managed CCF articles can build upon this quickstart. If you plan to continue on to work with subsequent quickstarts and tutorials, you might wish to leave these resources in place.
Other Managed CCF articles can build upon this quickstart. If you plan to continue on to work with subsequent quickstarts and tutorials, you might wish to leave these resources in place.
0 commit comments