Skip to content

Commit

Permalink
[mgmt] migrate mgmt package to esm 25 (#33081)
Browse files Browse the repository at this point in the history
#32184
@azure/arm-security
@azure/arm-search
@azure/arm-scvmm
@azure/arm-resourcesdeploymentstacks
@azure/arm-arm-resources-subscriptions
  • Loading branch information
v-jiaodi authored Feb 17, 2025
1 parent 5e2a290 commit fe306bc
Show file tree
Hide file tree
Showing 969 changed files with 4,462 additions and 5,235 deletions.
207 changes: 140 additions & 67 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 21 additions & 12 deletions sdk/resources-subscriptions/arm-resources-subscriptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,28 @@ Set the values of the client ID, tenant ID, and client secret of the AAD applica

For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).

```javascript
const { SubscriptionClient } = require("@azure/arm-resources-subscriptions");
const { DefaultAzureCredential } = require("@azure/identity");
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client.

```ts snippet:ReadmeSampleCreateClient_Node
import { SubscriptionClient } from "@azure/arm-resources-subscriptions";
import { DefaultAzureCredential } from "@azure/identity";

const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new SubscriptionClient(new DefaultAzureCredential(), subscriptionId);
```

For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate.

// For client-side applications running in the browser, use this code instead:
// const credential = new InteractiveBrowserCredential({
// tenantId: "<YOUR_TENANT_ID>",
// clientId: "<YOUR_CLIENT_ID>"
// });
// const client = new SubscriptionClient(credential, subscriptionId);
```ts snippet:ReadmeSampleCreateClient_Browser
import { InteractiveBrowserCredential } from "@azure/identity";
import { SubscriptionClient } from "@azure/arm-resources-subscriptions";

const subscriptionId = "00000000-0000-0000-0000-000000000000";
const credential = new InteractiveBrowserCredential({
tenantId: "<YOUR_TENANT_ID>",
clientId: "<YOUR_CLIENT_ID>",
});
const client = new SubscriptionClient(credential, subscriptionId);
```

### JavaScript Bundle
Expand All @@ -80,8 +88,9 @@ To use this client library in the browser, first you need to use a bundler. For

Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:

```javascript
const { setLogLevel } = require("@azure/logger");
```ts snippet:SetLogLevel
import { setLogLevel } from "@azure/logger";

setLogLevel("info");
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
"mainEntryPointFilePath": "dist/esm/index.d.ts",
"docModel": {
"enabled": true
},
Expand All @@ -11,7 +11,7 @@
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/arm-resources-subscriptions.d.ts"
"publicTrimmedFilePath": "dist/arm-resources-subscriptions.d.ts"
},
"messages": {
"tsdocMessageReporting": {
Expand All @@ -28,4 +28,4 @@
}
}
}
}
}
Loading

0 comments on commit fe306bc

Please sign in to comment.