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

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

问题描述

我正在编写一些代码来自动部署Azure网站(包括在Azure中创建网站)。我正在使用Nuget中提供的Azure管理库和Azure资源管理库。大部分都已准备就绪,但是我无法找到一种通过我见过的任何API启用 Always On属性的方法。可以通过网站的配置选项卡下的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等)来查看是否存在始终保持引用(没有)

  3. 管理门户网站正在通过Fiddler发送的REST调用。这里有对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.

因此,问题是,是否可以启用/ disable通过官方 API始终打开?

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

{
位置:西欧,
属性:{
siteConfig:{
AlwaysOn:true
}
},
tags:{}
}

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天全站免登陆