2017-03-22 11 views
0

一般化されたイメージから新しいVMを展開するためにPowershell(MS docsに従う)を使用しようとしましたが、このエラーが発生し続けます。Azure:一般化されたイメージからVMを展開するエラー(イメージ展開不能)

New-AzureRmVM : Long running operation failed with status 'Failed'. 
ErrorCode: OSProvisioningClientError 
ErrorMessage: OS provisioning for VM 'MyVM' failed. Error details: This installation of Windows is undeployable. Make sure the image has been properly prepared (generalized). 
Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/ 
StartTime: 22/03/2017 10:06:24 
EndTime: 22/03/2017 10:10:37 
OperationID: 549f97d1-ca39-4bc5-bd6c-65e37a8d398f 
Status: Failed 
At C:\Visual Studio Projects\Deployment\VmSetup.ps1:97 char:1 
+ New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : CloseError: (:) [New-AzureRmVM], ComputeCloudException 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand 

問題は、sysprepを実行してイメージを一般化したことです。

Code   : OSState/generalized 
Level   : Info 
DisplayStatus : VM generalized 
Message  : 
Time   : 

VMが一般化されていると言われているので、VMを再開することもできません。

Failed to start virtual machine 'OtherVM'. Error: Operation 'start' is not allowed on VM 'OtherVM' since the VM is generalized. 

スクリプトを保存する画像:

#Script to save image 
$vmName = "OtherVM" 
$rgName = "MyResourceGroup" 
#Stop-AzureRmVM -ResourceGroupName $rgName -Name $vmName 
Set-AzureRmVM -ResourceGroupName $rgName -Name $vmName -Generalized 
$vm = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName -Status 
$vm.Statuses 

#Save VM Image 
Save-AzureRmVMImage -ResourceGroupName $rgName -Name $vmName ` 
-DestinationContainerName "generalisedimages" -VHDNamePrefix "gen" ` 
#-Path "C:\VMTemplate\VmTemplate.json" 
Write-Output "Imaged saved." 

とデプロイスクリプト。

# 
# VmDeploy.ps1 
# 
#Sign into Azure account 
#Login-AzureRmAccount 

# Name of the virtual machine. This example sets the VM name as "myVM". 
$vmName = "MyVM" 

#Set resource group and subnet name 
$rgName = "MyResourceGroup" 
$subnetName = "default" 
$singleSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24 

#Set location and vNet name 
$location = "UK South" 
$vnetName = "{0}-vnet" -f $rgName 
$vnet = New-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $rgName -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $singleSubnet 

#Create public IP 
$ipName = "{0}-ip" -f $vmName 
$pip = New-AzureRmPublicIpAddress -Name $ipName -ResourceGroupName $rgName -Location $location -AllocationMethod Dynamic 

#Create NIC 
$nicName = "{0}-nic" -f $vmName 
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName -Location $location -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id 

#Create network security group and allow RDP 
$nsgName = "{0}-nsg" -f $vmName 
$rdpRule = New-AzureRmNetworkSecurityRuleConfig -Name Rdp -Description "Allow RDP" ` 
    -Access Allow -Protocol Tcp -Direction Inbound -Priority 110 ` 
    -SourceAddressPrefix Internet -SourcePortRange * ` 
    -DestinationAddressPrefix * -DestinationPortRange 3389 
$httpRule = New-AzureRmNetworkSecurityRuleConfig -Name Http -Description "Allow HTTP" ` 
    -Access Allow -Protocol Tcp -Direction Inbound -Priority 120 ` 
    -SourceAddressPrefix Internet -SourcePortRange * ` 
    -DestinationAddressPrefix * -DestinationPortRange 80 
$httpsRule = New-AzureRmNetworkSecurityRuleConfig -Name Https -Description "Allow HTTPS" ` 
    -Access Allow -Protocol Tcp -Direction Inbound -Priority 130 ` 
    -SourceAddressPrefix Internet -SourcePortRange * ` 
    -DestinationAddressPrefix * -DestinationPortRange 443 
$nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName $rgName -Location $location -Name $nsgName -SecurityRules $rdpRule, $httpRule, $httpsRule 

#Get completed virtual network 
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName 

#Uri of VM image 
$imageURI = "https://*******.blob.core.windows.net/system/Microsoft.Compute/Images/generalisedimages/genosDisk.86g419f6-0de6-4331-hi54-32hse8de6bd4.vhd" 
# Enter a new user name and password to use as the local administrator account 
# for remotely accessing the VM. 
$cred = Get-Credential 
# Name of the storage account where the VHD is located. This example sets the 
# storage account name as "myStorageAccount" 
$storageRgName = $rgName 
$storageAccName = "mystorage" 

# Size of the virtual machine. This example creates "Standard_D2_v2" sized VM. 
# See the VM sizes documentation for more information: 
# https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/ 
$vmSize = "Standard_A1" 

# Computer name for the VM. This examples sets the computer name as "myComputer". 
$computerName = "New VM" 

# Name of the disk that holds the OS. This example sets the 
# OS disk name as "myOsDisk" 
$osDiskName = "OsDisk" 

# Assign a SKU name. This example sets the SKU name as "Standard_LRS" 
# Valid values for -SkuName are: Standard_LRS - locally redundant storage, Standard_ZRS - zone redundant 
# storage, Standard_GRS - geo redundant storage, Standard_RAGRS - read access geo redundant storage, 
# Premium_LRS - premium locally redundant storage. 
$skuName = "Standard_LRS" 

# Get the storage account where the uploaded image is stored 
$storageAcc = Get-AzureRmStorageAccount -ResourceGroupName $storageRgName -AccountName $storageAccName 
Write-Output $storageAcc 

# Set the VM name and size 
$vmConfig = New-AzureRmVMConfig -VMName $vmName -VMSize $vmSize 

#Set the Windows operating system configuration and add the NIC 
$vm = Set-AzureRmVMOperatingSystem -VM $vmConfig -Windows -ComputerName $computerName ` 
    -Credential $cred -ProvisionVMAgent -EnableAutoUpdate 
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id 

# Create the OS disk URI 
$osDiskUri = '{0}vhds/{1}-{2}.vhd' ` 
    -f $storageAcc.PrimaryEndpoints.Blob.ToString(), $vmName.ToLower(), $osDiskName 
Write-Output "OS Disk URI:" $osDiskUri 

# Configure the OS disk to be created from the existing VHD image (-CreateOption fromImage). 
$vm = Set-AzureRmVMOSDisk -VM $vm -Name $osDiskName -VhdUri $osDiskUri -CreateOption fromImage -SourceImageUri $imageURI -Windows 
Write-Output $vm 

# Create the new VM 
New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm 

$vmList = Get-AzureRmVM -ResourceGroupName $rgName 
$vmList.Name 
+0

をバックアップすることをお勧めします「トラブルは、私はSysprepを実行し、画像を一般なかったことですか。」?一般化されたVHDには問題があるようです。あなたはそれを一般化しましたか?はいの場合、この一般化されたVHDからのVM​​をプロビジョニングしようとしましたか? – alwayslearning

答えて

0

VM 'myvmに' のOSのプロビジョニングに失敗しました。エラーの詳細:Windowsのこのインストール は展開できません。イメージが正しく (一般化された)であることを確認してください。

エラーメッセージによると、ではなく、汎用VMが正しく表示されているようです。 システム準備ツールダイアログボックスでRDPをAzure VMに実行し、システム準備ツールのダイアログボックスでを選択し、システムのアウトボックスエクスペリエンス(OOBE)を入力し、Generalizeチェックボックスが選択されていることを確認します。シャットダウンオプションで、シャットダウンを選択します。 enter image description here

Windows仮想マシンの一般化の詳細については、linkを参照してください。

それはそれは 一般

だ私に言っていますので、私はまた再びVMを起動することができないよアズールの画像をキャプチャは、VMをwidnowsそれは後に、このプロセス元の仮想マシンを削除します捕らえられた
Azureの仮想マシンのイメージをキャプチャする前に、ターゲット仮想マシンがなぜ言うか

+0

さらなるサポートをご希望の場合はお知らせください。 –

関連する問題