azure - Azure Python SDK:创建预算?
问题描述
我正在尝试为我的 Azure 订阅创建预算。首先。我尝试使用Azure CLI创建预算。
az consumption budget create --amount
--budget-name
--category {cost, usage}
--end-date
--start-date
--time-grain {annually, monthly, quarterly}
我收到以下错误作为响应:Cost Management supports only Enterprise Agreement, Web direct and Microsoft Customer Agreement offer types
。我无法弄清楚问题出在哪里,但我想这是因为我们的组织正在使用 Azure 赞助。
然后,我看到 Azure 提供了一个带有 PUT 请求的预算 REST API,如下所示:
https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/budgets/TestBudget?api-version=2019-10-01
我想知道是否可以使用Azure Python SDK创建预算?有Python SDK 计费的文档,但没有示例。
解决方案
请尝试使用 Pulumi - 它对单个用户免费: https ://www.pulumi.com/docs/reference/pkg/azure-native/consumption/budget/
其他选项是使用 Azure Arm 模板: https ://docs.microsoft.com/en-us/azure/cost-management-billing/costs/quick-create-budget-template?tabs=CLI
推荐阅读
- angular - RxJS distinct 运算符没有从对象数组中获取不同的值
- reactjs - 动态需要图像在 reactjs/nextjs 中不起作用
- swift - 为什么我的 UILabel 无法显示成功获取的值?
- java - 可以将两个参数传递给模态
- matplotlib - 在 Spyder 上安装 Tex
- python - TensorFlow,在 CNN 的混乱中重塑
- javascript - Recharts:响应式 LineChart 网格和线条无法正确呈现,出现在图表之外
- java - namedParameterJdbcTemplate 中的空指针
- java - Java 正则表达式从字符串中提取数字
- react-hooks - useRef() 和 { } 之间的区别