Azure Site Recovery Change Azure VM Properties
I already have VM's replicating to Azure, but I need to change the properties of a couple of VM's since the onprem name will be different than the Azure name. I have already found the location to make the change, but it will not let me save the information since a target network in not in place which I understand. My question is will updating the VM properties via Powershell let me get around the target network requirement?
Azure Site Recovery
-
Boris Von Dahle 2,661 Reputation points
2023-11-13T20:43:58.52+00:00 Hello,
The requirement for a target network is crucial for the proper functioning of Azure Site Recovery.
If you bypass this requirement using PowerShell, you might set up a configuration that leads to issues during failover.
Regards -
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-14T09:45:13.7066667+00:00 @rr-4098 Thank you for contacting us. To change the network settings you can refer to the instructions here - https://learn.microsoft.com/en-us/azure/site-recovery/site-recovery-manage-network-interfaces-on-premises-to-azure
-
rr-4098 921 Reputation points
2023-11-14T15:33:29.8666667+00:00 Thank you everyone for the feedback. When I setup ASR our first step was to just get replication working and it let you setup the replication without a target network. Right now I need to change the Azure VM name on some replicated VMs. I can do this in the GUI if the target network was in place. To be clear, can I change the properties of a replicated VM in powershell if the target network is not in place?
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-15T14:17:21.59+00:00 @rr-4098 VM name is the internal property and you should be able to do it at source VM only and that will replicate to the target VM. For network, both portal and PowerShell should work.
-
rr-4098 921 Reputation points
2023-11-15T15:55:54.3666667+00:00 Ok... here is what I need to be sure of... I have a number of onprem VM's in VM with a VMware display name that lists one name, but the guest OS is something else. I need to make sure the replicated VM's, when restored, that the guest OS name does not take on the VMware display name. I hope this my concern make sense......Also I need to change the VM size via Powershell since I cannot do it in the GUI with the target network requirement
-
rr-4098 921 Reputation points
2023-11-17T13:30:25.51+00:00 I wanted to follow up to see if anyone could shed some light on my concern.
Thanks again...
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-18T09:42:46.0233333+00:00 @rr-4098 ASR will pick the same name as it read when it was enabled for DR, we don't allow changing display name. Display name can be anything. You will see the same name as that of the OS name in the target machine. Because there is no relation between OS name and display name.
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-20T06:14:34.6233333+00:00 @rr-4098 Just checking in to see if you got a chance to see my response and if it helped, I would request you to "Accept Answer and Upvote" so that the relevancy of this post will improve when anyone in the community search for a similar query.
-
rr-4098 921 Reputation points
2023-11-20T16:28:05.48+00:00 Sorry for the delay. Just to confirm ASR will use the same display name as VMware and match the guest OS name even if it is different from the VM display name correct?
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-21T13:40:45.2766667+00:00 @rr-4098 Yes, that is correct. Azure Site Recovery (ASR) will use the guest operating system (OS) name as the name of the replicated virtual machine (VM) in the target location, even if it is different from the display name of the VM in VMware.
ASR does not allow changing the display name of the VM during the replication process, so the name of the replicated VM in the target location will always match the guest OS name of the source VM.
-
rr-4098 921 Reputation points
2023-11-21T15:39:21.04+00:00 Excellent!!!! One final question, how do I change the VM size of a ASR VM via Powershell?
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-24T20:28:22.53+00:00 @rr-4098 It takes the right VM size automatically.
Out of curiosity, why do you want to change the VM size?
-
rr-4098 921 Reputation points
2023-11-26T10:00:53.8333333+00:00 Sorry for the delay in responding. We want to restrict VM sizes to either A or D and the smallest VM size possible for cost reasons. So far I have not be able to find a way to change the VM size in ASR via powershell.
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-28T07:03:09.23+00:00 @rr-4098 Restricting it to a particular VM size is not possible. Because the VM size selection depends on the amount of data replication to Azure.
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-29T07:52:28.17+00:00 @rr-4098 Are there any follow up questions for us?
-
rr-4098 921 Reputation points
2023-11-29T13:54:58.7066667+00:00 Sorry for the delay. I know you stated restricting the VM to a specific size not not possible, yet in the GUI, for ASR it lets you change the VM's size. We have some VM's that have more resources than they need and can run on a much smaller VM in Azure.
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-11-30T14:55:32.28+00:00 @rr-4098 Are you talking about changing the VM size through Azure portal?
If yes, you can change the VM size via PowerShell. Refer to the guide here - https://learn.microsoft.com/en-us/azure/virtual-machines/resize-vm?tabs=powershell#change-the-vm-size
# Set variables $resourceGroup = "myResourceGroup" $vm = "myVM" $size = "Standard_DS3_v2" # Check if the desired VM size is available if ((az vm list-vm-resize-options --resource-group $resourceGroup --name $vm --query "[].name" | ConvertFrom-Json) -notcontains $size) { Write-Host "The desired VM size is not available." exit 1 } # Deallocate the VM az vm deallocate --resource-group $resourceGroup --name $vm # Resize the VM az vm resize --resource-group $resourceGroup --name $vm --size $size # Start the VM az vm start --resource-group $resourceGroup --name $vm
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-12-01T19:22:46.8166667+00:00 @rr-4098 Just checking in to see if you got a chance to see my response and if it helped, I would request you to "Accept Answer and Upvote" so that the relevancy of this post will improve when anyone in the community search for a similar query.
-
rr-4098 921 Reputation points
2023-12-02T10:31:18.6133333+00:00 Sorry for the delay. So my problem is I know how to change the VM size on a existing \ running VM in Azure. The problem is how to I change the selected VM size ASR chooses for an onprem VMware VM.
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-12-04T07:54:35.2433333+00:00 @rr-4098 In VMware scenario we try to match the source however we don't update the size on portal with the revised configuration. Can you perform a test failover, based on the latest size on Prem it should pick the right size.
Refer to the common questions here - https://learn.microsoft.com/en-us/azure/site-recovery/vmware-azure-common-questions#can-i-change-the-target-vm-size-or-vm-type-before-failover
-
rr-4098 921 Reputation points
2023-12-04T19:33:33.2866667+00:00 This states using the portal which I cannot since I do not have the target network setup. This is why I was asking if it can be done via Powershell.
-
SadiqhAhmed-MSFT 33,006 Reputation points • Microsoft Employee
2023-12-05T10:41:34.4066667+00:00 @rr-4098 Here are the steps to do so:
Open Azure PowerShell and connect to your Azure account.
Run the following command to get the replication protected item.
Get-AzRecoveryServicesAsrReplicationProtectedItem -FriendlyName <VM name> -ProtectionContainer <Protection container>
Replace
<VM name>
with the name of the replicated VM and<Protection container>
with the name of the protection container.Run the following command to get the replication protected item properties:
$replicatedVMProperties = replicatedVM.ReplicationProtectedItemProperties
Run the following command to set the new VM size or type:
$replicatedVMProperties.TargetVmSize = <new VM size or type>
Replace
<new VM size or type>
with the new VM size or type that you want to use.Run the following command to update the replication protected item:
Set-AzRecoveryServicesAsrReplicationProtectedItem -InputObject $replicatedVM
Once you have changed the VM size or type, the replicated VM will use the new settings after failover. Note that changing the VM size or type may affect the performance and functionality of the replicated VM, so you should test the changes before failover to ensure that they meet your requirements.
Let us know how it goes!
Sign in to comment