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
+78-24Lines changed: 78 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,20 +31,30 @@ This quickstart uses the Azure Identity library, along with Azure CLI or Azure P
31
31
32
32
[!INCLUDE [Sign in to Azure](../../includes/confidential-ledger-sign-in-azure.md)]
33
33
34
-
### Install the packages
35
-
36
-
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).
34
+
### Initialize a new npm project
35
+
In a terminal or command prompt, create a suitable project folder and initialize an `npm` project. You may skip this step if you have an existing node project.
36
+
```terminal
37
+
cd <work folder>
38
+
npm init -y
39
+
```
37
40
41
+
### Install the packages
38
42
Install the Azure Active Directory identity client library.
39
43
40
44
```terminal
41
-
npm install @azure/identity
45
+
npm install --save @azure/identity
42
46
```
43
47
44
48
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.
76
+
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.
77
+
78
+
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:
67
79
68
-
```JavaScript
80
+
```terminal
81
+
tsc <filename.ts>
82
+
```
83
+
84
+
The compiled JavaScript file will have the same name but a `*.js` extension. Then run the script in nodeJS:
85
+
```terminal
86
+
node <filename.js>
87
+
```
88
+
89
+
The following sample TypeScript code creates and views the properties of a Managed CCF resource.
@@ -133,11 +156,42 @@ export async function main() {
133
156
console.log("Deleted.");
134
157
}
135
158
136
-
main().catch((err) => {
137
-
console.error(err);
138
-
});
159
+
(async () => {
160
+
try {
161
+
awaitmain();
162
+
} catch(err) {
163
+
console.error(err);
164
+
}
165
+
})();
139
166
```
140
167
168
+
## Delete the Managed CCF resource
169
+
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