图像部署混合驱动器号 [英] Image deployment mixes drive letters

查看:88
本文介绍了图像部署混合驱动器号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一个大型供应商提供的解决方案,使用驱动器号C:对于操作系统和F:为数据部署它的vms。在Azure门户中,这意味着数据磁盘已连接到Lun 1.在创建通用vm的映像并重新部署后,门户网站显示
数据仍然连接到Lun 1,但Windows现在将数据磁盘连接到E:导致prgramms无效。

I have a solution from a big vendor that deploys it's vms using drive letter C: for OS and F: for data. In the Azure Portal this means that the data disk is attached to Lun 1. After creating an image of the generalized vm and redeploying it the portal shows that data is still connected to Lun 1 but Windows now attaches the data disk to E: which leads to prgramms not working.

如何在部署映像时确保驱动器号保持不变?

How can I ensure that the drive letter remain the same when deploying images?

创建映像通过Azure门户。部署由于某些原因通过PowerShell Runbook使用此代码段发生:

The image is created through the Azure portal. Deployment happens for some reasons via PowerShell Runbook using this snippet:

$image = Get-AzureRMImage -ImageName $imageName -ResourceGroupName $rgImage
Get-AzureRmResourceGroup -Name $rgVm -ErrorVariable notPresent -ErrorAction SilentlyContinue
if ($notPresent)
{
    # ResourceGroup doesn't exist
    New-AzureRmResourceGroup -Name $rgVm -Location $location
}

$nsgRuleRDP = New-AzureRmNetworkSecurityRuleConfig -Name AllowRDP -Protocol Tcp -Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389 -Access Allow
$nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName $rgVm -Location $location -Name $vmNamePrefix-nsg -SecurityRules $nsgRuleRDP

for ($i=1; $i -le $vmNumber; $i++) {
	$vnet = Get-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $rgVnet
	$pip = New-AzureRmPublicIpAddress -ResourceGroupName $rgVm -Location $location -AllocationMethod Dynamic -Name $vmNamePrefix-$i-pip
	$nic = New-AzureRmNetworkInterface -ResourceGroupName $rgVm -Location $location -Name $vmNamePrefix-$i-nic -SubnetId $vnet.Subnets[0].Id -Tag @{belongsToVm="$vmNamePrefix-$i";} -PublicIpAddressId $pip.Id -NetworkSecurityGroupId $(Get-AzureRmNetworkSecurityGroup -Name $vmNamePrefix-nsg -ResourceGroupName $rgVm).Id
	$vm = New-AzureRmVMConfig -VMName $vmNamePrefix-$i -VMSize $vmSize
	$vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $vmNamePrefix-$i -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate
	$vm = Set-AzureRmVMSourceImage -VM $vm -Id $image.Id
	$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id
	New-AzureRmVM -ResourceGroupName $rgVm -Location $location -VM $vm -AsJob
}

推荐答案

您使用此模板进行部署的频率如何? 

How often are you deploying using this template? 

您可以合作nsider运行
diskpart
作为启动脚本,以确保驱动器号是已更改

You could consider running diskpart as a startup script to ensure the drive letter is changed

我知道更新的驱动器号将在重新启动和重新部署时保留,但我不确定从映像部署时是否仍保留这些设置。 

I know that the updated drive letter will persist through reboots and redeployments but I am not sure if those settings remain when deploying from an image. 

您是否肯定在拍摄图像之前更改了驱动器号? 

Are you positive you changed the drive letter prior to capturing the image? 


这篇关于图像部署混合驱动器号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆