1
我想要使用Azure資源管理器(ARM)和.NET C#來識別Azure虛擬機部署的成功或失敗結果。C#在使用Azure資源管理器(ARM)部署Azure虛擬機時獲取結果狀態
我發現下面的示例。
https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-csharp-template
在這篇文章中,deploing時, 「返回等待」 語句中使用。
public static async Task<DeploymentExtended> CreateTemplateDeploymentAsync(
TokenCredentials credential,
string groupName,
string deploymentName,
string subscriptionId){
Console.WriteLine("Creating the template deployment...");
var deployment = new Deployment();
deployment.Properties = new DeploymentProperties
{
Mode = DeploymentMode.Incremental,
Template = File.ReadAllText("..\\..\\VirtualMachineTemplate.json"),
Parameters = File.ReadAllText("..\\..\\Parameters.json")
};
var resourceManagementClient = new ResourceManagementClient(credential)
{ SubscriptionId = subscriptionId };
return await resourceManagementClient.Deployments.CreateOrUpdateAsync(
groupName,
deploymentName,
deployment);
}
我該如何處理結果? 我想根據結果來劃分程序。
你好Tom謝謝你repling!對不起,lating的答案.. –
你的建議是非常可以理解,很好。我會盡快檢查並回復 –
這個線程是否有更新? –