@azure/ms-rest-azure-env

中文文档
2.0.0发布于 2019/07/12MITTypeScriptESM + CJS零依赖近 30 天下载 84.2万

Isomorphic library that provides Azure endpoints for different Azure Environments/Clouds.

此软件包已被标记为弃用

This package has been deprecated. new Azure Management SDK package from [Azure SDK for JavaScript](https://github.com/azure/azure-sdk-for-js) now have the cloud settings built-in, [for example](https://github.com/Azure/azure-sdk-for-js/blob/dc5f9743b05ea78f938eba31cbe704150889490c/sdk/sql/arm-sql/src/static-helpers/cloudSettingHelpers.ts).

原始使用文档

ms-rest-azure-env Build Status

An isomorphic javascript library with typescript type definitions that provides a mechanism to access Azure Endpoints in different Azure clouds. It also provides a mechanism to add a custom environment.

Example

import { Environment, EnvironmentParameters } from "@azure/ms-rest-azure-env";

// Accesing predefined environment endpoints.
console.log(Environment.AzureCloud.resourceManagerEndpointUrl);
console.log(Environment.ChinaCloud.resourceManagerEndpointUrl);

//Adding a custom environment with required endpoint values.
let df: AzureEnvironmentParameters = {
  name: "Dogfood",
  portalUrl: "http://go.microsoft.com/fwlink/?LinkId=254433",
  managementEndpointUrl: "https://management.core.windows.net",
  resourceManagerEndpointUrl: "https://management.azure.com/",
  activeDirectoryEndpointUrl: "https://login.microsoftonline.com/",
  activeDirectoryResourceId: "https://management.core.windows.net/"
};
Environment.add(df);
let dfoodEnv = Environment.get("Dogfood");
console.log(dfoodEnv);
console.log(`Accessing the custom environment info: ${(<any>Environment)["Dogfood"].managementEndpointUrl}`);

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

版本与发布记录

@azure/ms-rest-azure-env 共发布 4 个版本,首次发布于 2018/11/13;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.0latest2019/07/127 年前
1.1.22019/01/157 年前
1.1.12018/11/307 年前
1.1.02018/11/137 年前

关于 @azure/ms-rest-azure-env 的常见问题

@azure/ms-rest-azure-env 是什么?

Isomorphic library that provides Azure endpoints for different Azure Environments/Clouds.注意:该包已被作者标记为弃用——This package has been deprecated. new Azure Management SDK package from [Azure SDK for JavaScript](https://github.com/azure/azure-sdk-for-js) now have the cloud settings built-in, [for example](https://github.com/Azure/azure-sdk-for-js/blob/dc5f9743b05ea78f938eba31cbe704150889490c/sdk/sql/arm-sql/src/static-helpers/cloudSettingHelpers.ts).

如何安装 @azure/ms-rest-azure-env?

在项目目录运行 npm install @azure/ms-rest-azure-env,或使用 pnpm add / yarn add / bun add。

@azure/ms-rest-azure-env 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@azure/ms-rest-azure-env 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@azure/ms-rest-azure-env 可以商用吗?

@azure/ms-rest-azure-env 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@azure/ms-rest-azure-env 的下载量有多少?

根据 npm 官方下载统计,@azure/ms-rest-azure-env 在 2026/10/08 – 2026/11/06 这 30 天内被下载 841,927 次,日均约 28,064 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@azure/ms-rest-azure-env 还在维护吗?

最新版本 2.0.0 发布于 2019/07/12(7 年前);至今共发布 4 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/11/13。作者已将其标记为弃用,新项目建议寻找替代方案。