As Azure user I can be START the running VM. When it already stopped. All services related to that will be get started. So before starting VM make sure that VM is stopped state.
Azure Virtual Machine can be started two ways.
- Manually START VM
- API request to START VM
1.Manually START VM - Go To VM overview page - click START button - Click OK - VM successfully started now.
2.API request to START VM
Build API request and Start Azure Virtual Machine.
Collect Arguments information{0} - subscriptionId {1} - resourceGroupName {2} - virtualMachinesName {3} - apiVersion
Variables
private string azureDomain = "https://management.azure.com";
private string vmStartUri = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachines/{2}/start?api-version={3}";
private string _apiV_2019_12_01 = "2019-12-01";
Write a Method
public void StartVirtualMachine(string vmName)
{
string vmStartUrl = string.Format(azureDomain + vmStartUri, _subscriptionId, _resourceGroupName, vmName, _apiV_2019_12_01);
_apiRequest.PostRESTfulResponseWithToken(_token, vmStartUrl, "");
}
Once VM has been started. You can try to access, Finally you will get access on it.
Comments
Post a Comment