I have created Virtual machine on Azure portal via Fluent API class in c#. my c# code is:
public JsonResult createVM()
{
try
{
IAzure azure = Authenticate(subscriptionId);
azure.VirtualMachines.Define(vmName)
.WithRegion(location)
.WithExistingResourceGroup(ResourceGroupName)
.WithExistingPrimaryNetworkInterface(networkInterface)
.WithSpecializedOSDisk(managedDisk, operatingSystem)
.WithSize(vmSize)
.Create();
//Here i want complete response from above code..if success.
return Json(string.Empty);
}
catch (CloudException ex)
{
Response.Write(ex.Response.Content);
return Json(string.Empty);
}
}
i get response in catch block if execution failed. but we need response if execution succeed .