Azure资源管理器 [英] Azure resourceManager

查看:98
本文介绍了Azure资源管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以编程方式扩展Azure工作者角色,但找不到资源名称的正确语法.

I'm trying to scale programmatically an Azure worker role and I can't find the right syntax for the resource name.

 // Create the autoscale client.
 AutoscaleClient autoscaleClient = new AutoscaleClient(new CertificateCloudCredentials(subscriptionId, cert));
 AutoscaleSettingGetResponse get =autoscaleClient.Settings.Get(AutoscaleResourceIdBuilder.BuildCloudServiceResourceId("WRK-GROUP-NE01","CIW.GROUPS",true) );
 AutoscaleSetting setting = get.Setting;

它返回:ResourceNotFound:不支持资源服务名称监视. 你能指出我正确的语法吗?

It returns : ResourceNotFound: The resource service name monitoring is not supported. Can you point me to the right syntax?

推荐答案

您所遵循的指南基于Azure服务管理模型(又称为经典模式),该模型已弃用,并且仅主要用于向后兼容性支持.

The guide which you're following is based on the Azure Service Management model, aka Classic mode, which is deprecated and only exists mainly for backward compatibility support.

您应该使用最新的Microsoft.Azure.Insights nuget软件包来获取自动缩放设置.

You should use the latest Microsoft.Azure.Insights nuget package for getting the autoscale settings.

使用上面的nuget的示例代码如下:

Sample code using the nuget above is as below:

using Microsoft.Azure.Management.Insights;
using Microsoft.Rest;

//... Get necessary values for the required parameters 

var client = new InsightsManagementClient(new TokenCredentials(token));
client.AutoscaleSettings.Get(resourceGroupName, autoScaleSettingName);

有关获取自动缩放设置的信息,请参见下面的REST API参考.

See the REST API Reference below for getting the autoscale settings.

GET
https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/autoscaleSettings/{autoscale-setting-name}?api-version={api-version}

要更新自动销售设置,您可以使用以下api

For updating Autosale setting you can use below api

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}?api-version=2015-04-01

https://docs.microsoft.com/en -us/rest/api/monitor/autoscalesettings/createorupdate

希望有帮助.

这篇关于Azure资源管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆