是否可以通过管理/资源管理 API 为 Azure 网站启用 Always On? [英] Is it possible to enable Always On for Azure websites through management/resource management APIs?

查看:29
本文介绍了是否可以通过管理/资源管理 API 为 Azure 网站启用 Always On?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一些代码来自动部署 Azure 网站(包括在 Azure 中创建网站).我正在使用 Nuget 中提供的 Azure 管理库和 Azure 资源管理库.大部分已经到位,但是我还没有找到一种方法来通过我见过的任何 API 启用始终开启"属性.可以通过网站的配置"选项卡下的 azure 管理门户设置此属性.

I am writing some code for automatic deployment of Azure websites (including the creation of the website in Azure). I'm using the Azure Management Libraries and Azure Resource Management Libraries available in Nuget. Most of it is in place, however I have not been able to find a way to enable the "Always On" property through any of the APIs I've seen. This property can be set through the azure management portal under the Configure tab for a website.

我已经检查过:

  1. MSDN 上的属性参考:http://msdn.microsoft.com/en-us/library/azure/dn236426.aspx
  2. 使用 powershell API(get-azureresource、get-azurewebsite 等)查看是否有对 Always On 的引用(没有)
  3. REST 调用管理门户正在发送,通过 Fiddler.这里有一个在 POST 中对 Always On 的引用,转至 https://manage.windowsazure.com/Websites/UpdateConfig(据我所知,这不是管理或资源管理 API 的一部分).发送的 JSON 正文中的确切路径是/siteConfig/AlwaysOn.
  1. The properties reference on MSDN: http://msdn.microsoft.com/en-us/library/azure/dn236426.aspx
  2. The powershell APIs (get-azureresource, get-azurewebsite, ...) to see if there's a reference to Always On (there's not)
  3. The REST calls the management portal is sending, through Fiddler. Here there is a reference to Always On in a POST going to https://manage.windowsazure.com/Websites/UpdateConfig (which is not part of the management or resource management APIs as far as I know). The exact path in the JSON body that is sent is /siteConfig/AlwaysOn.

那么,问题是,是否可以通过官方"API 启用/禁用 Always On?

So, the question is, is it possible to enable/disable Always On through an "official" API?

谢谢!

推荐答案

我相信我找到了解决方案!

I believe I found the solution!

使用资源管理 API,我可以通过 siteConfig 对象设置 AlwaysOn 属性.在 Powershell 中:

Using the resource management API, I can set the AlwaysOn property through the siteConfig object. In powershell:

Set-AzureResource -ApiVersion 2014-04-01 -PropertyObject @{"siteConfig" = @{"AlwaysOn" = $false}} -Name mywebsite -ResourceGroupName myrg -ResourceType Microsoft.Web/sites

在 .NET 中的资源管理 API 中,它与此类似.

In the resource management API in .NET it would be similar to this.

由此产生的 REST 调用,https://management.azure.com/subscriptions/xxx/resourcegroups/yyy/providers/Microsoft.Web/sites/zzz?api-version=2014-04-01:<代码>{"location": "西欧",特性": {站点配置":{永远在线":真}},标签":{}}

The resulting REST call, to https://management.azure.com/subscriptions/xxx/resourcegroups/yyy/providers/Microsoft.Web/sites/zzz?api-version=2014-04-01: { "location": "West Europe", "properties": { "siteConfig": { "AlwaysOn": true } }, "tags": {} }

这篇关于是否可以通过管理/资源管理 API 为 Azure 网站启用 Always On?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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