Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage?api-version=2024-03-01
URI Parameters
Name |
In |
Required |
Type |
Description |
instanceId
|
path |
True
|
string
|
The instance ID of the virtual machine.
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group.
|
subscriptionId
|
path |
True
|
string
|
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
vmScaleSetName
|
path |
True
|
string
|
The name of the VM scale set.
|
api-version
|
query |
True
|
string
|
Client Api Version.
|
Request Body
Responses
Name |
Type |
Description |
200 OK
|
|
OK
|
202 Accepted
|
|
Accepted
|
Other Status Codes
|
CloudError
|
Error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen
Sample Request
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/aaaaaaaaaaaaaaaa/virtualMachines/aaaaaaaaaaaaaaaaaaaaaaaaaaaaa/reimage?api-version=2024-03-01
{
"forceUpdateOSDiskForEphemeral": true,
"tempDisk": true
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python virtual_machine_scale_set_vm_reimage_maximum_set_gen.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
client.virtual_machine_scale_set_vms.begin_reimage(
resource_group_name="rgcompute",
vm_scale_set_name="aaaaaaaaaaaaaaaa",
instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
).result()
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json
func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVmReimageMaximumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: &armcompute.VirtualMachineScaleSetVMReimageParameters{
TempDisk: to.Ptr(true),
ForceUpdateOSDiskForEphemeral: to.Ptr(true),
},
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @summary Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json
*/
async function virtualMachineScaleSetVMReimageMaximumSetGen() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "rgcompute";
const vmScaleSetName = "aaaaaaaaaaaaaaaa";
const instanceId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
const vmScaleSetVMReimageInput = {
forceUpdateOSDiskForEphemeral: true,
tempDisk: true,
};
const options = {
vmScaleSetVMReimageInput,
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachineScaleSetVMs.beginReimageAndWait(
resourceGroupName,
vmScaleSetName,
instanceId,
options,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
location: https://foo.com/operationstatus
VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen
Sample Request
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/aaaaaaa/virtualMachines/aaaaaaaaaaaaa/reimage?api-version=2024-03-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python virtual_machine_scale_set_vm_reimage_minimum_set_gen.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
client.virtual_machine_scale_set_vms.begin_reimage(
resource_group_name="rgcompute",
vm_scale_set_name="aaaaaaa",
instance_id="aaaaaaaaaaaaa",
).result()
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json
func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVmReimageMinimumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginReimage(ctx, "rgcompute", "aaaaaaa", "aaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @summary Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json
*/
async function virtualMachineScaleSetVMReimageMinimumSetGen() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "rgcompute";
const vmScaleSetName = "aaaaaaa";
const instanceId = "aaaaaaaaaaaaa";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachineScaleSetVMs.beginReimageAndWait(
resourceGroupName,
vmScaleSetName,
instanceId,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
location: https://foo.com/operationstatus
Definitions
ApiError
Api error.
Name |
Type |
Description |
code
|
string
|
The error code.
|
details
|
ApiErrorBase[]
|
The Api error details
|
innererror
|
InnerError
|
The Api inner error
|
message
|
string
|
The error message.
|
target
|
string
|
The target of the particular error.
|
ApiErrorBase
Api error base.
Name |
Type |
Description |
code
|
string
|
The error code.
|
message
|
string
|
The error message.
|
target
|
string
|
The target of the particular error.
|
CloudError
An error response from the Compute service.
Name |
Type |
Description |
error
|
ApiError
|
Api error.
|
InnerError
Inner error details.
Name |
Type |
Description |
errordetail
|
string
|
The internal error message or exception dump.
|
exceptiontype
|
string
|
The exception type.
|
OSProfileProvisioningData
Specifies information required for reimaging the non-ephemeral OS disk.
Name |
Type |
Description |
adminPassword
|
string
|
Specifies the password of the administrator account.
Minimum-length (Windows): 8 characters
Minimum-length (Linux): 6 characters
Max-length (Windows): 123 characters
Max-length (Linux): 72 characters
Complexity requirements: 3 out of 4 conditions below need to be fulfilled Has lower characters Has upper characters Has a digit Has a special character (Regex match [\W_])
Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"
For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM
For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension
|
customData
|
string
|
Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. Note: Do not pass any secrets or passwords in customData property. This property cannot be updated after the VM is created. The property customData is passed to the VM to be saved as a file, for more information see Custom Data on Azure VMs. If using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation.
|
VirtualMachineScaleSetVMReimageParameters
Parameters for the Reimaging Virtual machine in ScaleSet.
Name |
Type |
Description |
exactVersion
|
string
|
Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk is reimaged to the existing version of OS Disk.
|
forceUpdateOSDiskForEphemeral
|
boolean
|
Parameter to force update ephemeral OS disk for a virtual machine scale set VM
|
osProfile
|
OSProfileProvisioningData
|
Specifies information required for reimaging the non-ephemeral OS disk.
|
tempDisk
|
boolean
|
Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk.
|