@@ -47,26 +47,26 @@ works wherever JavaScript can be used, including [bash on Windows 10](/windows/w
47
47
1 . Add a reference to the Azure authentication library.
48
48
49
49
``` bash
50
- npm install @azure/ms-rest-nodeauth
50
+ npm install @azure/identity
51
51
```
52
52
53
53
> [ !NOTE]
54
- > Verify in _ package.json_ ` @azure/arm-resourcegraph ` is version ** 2.0.0 ** or higher and
55
- > ` @azure/ms-rest-nodeauth ` is version ** 3 .0.3 ** or higher.
54
+ > Verify in _ package.json_ ` @azure/arm-resourcegraph ` is version ** 4.2.1 ** or higher and
55
+ > ` @azure/identity ` is version ** 2 .0.4 ** or higher.
56
56
57
57
## Query the Resource Graph
58
58
59
59
1 . Create a new file named _ index.js_ and enter the following code.
60
60
61
61
``` javascript
62
62
const argv = require (" yargs" ).argv ;
63
- const authenticator = require (" @azure/ms-rest-nodeauth " );
64
- const resourceGraph = require (" @azure/arm-resourcegraph" );
63
+ const { DefaultAzureCredential } = require (" @azure/identity " );
64
+ const { ResourceGraphClient } = require (" @azure/arm-resourcegraph" );
65
65
66
66
if (argv .query ) {
67
67
const query = async () => {
68
- const credentials = await authenticator . interactiveLogin ();
69
- const client = new resourceGraph. ResourceGraphClient (credentials);
68
+ const credentials = new DefaultAzureCredential ();
69
+ const client = new ResourceGraphClient (credentials);
70
70
const result = await client .resources (
71
71
{
72
72
query: argv .query
@@ -133,7 +133,7 @@ top five results.
133
133
If you wish to remove the installed libraries from your application, run the following command.
134
134
135
135
``` bash
136
- npm uninstall @azure/arm-resourcegraph @azure/ms-rest-nodeauth yargs
136
+ npm uninstall @azure/arm-resourcegraph @azure/identity yargs
137
137
```
138
138
139
139
## Next steps
0 commit comments