【发布时间】:2016-05-19 09:01:38
【问题描述】:
我尝试从 VMWare 映像在 Azure 门户中创建虚拟计算机。我使用了本教程:
- https://azure.microsoft.com/de-de/documentation/articles/virtual-machines-windows-upload-image/#uploadvm (德语)
- https://buildwindows.wordpress.com/2015/12/20/how-to-add-a-nic-to-an-azure-virtual-machine-arm/ (英文)
在德语教程中你会发现
$vm = Set-AzureRmVMOperatingSystem -VM $vmConfig -Windows -ComputerName $computerName -Credential $cred -ProvisionVMAgent -EnableAutoUpdate
为了获得我使用的 $cred:
$cred = Get-Credentials
将出现一个登录窗口以输入凭据
我必须在这里输入什么样的凭据?映像或 Azure 的凭据?我必须以什么格式输入?我尝试了 Computername\User 和密码(例如 ARES\Administrator 和密码。
编辑 1
使用机器凭据 MyMachineName\Administrator 我收到以下错误:
PS C:\WINDOWS\system32> $cred = Get-Credential
Cmdlet Get-Credential an der Befehlspipelineposition 1
Geben Sie Werte für die folgenden Parameter an:
Credential
PS C:\WINDOWS\system32> $vm = Set-AzureRmVMOperatingSystem -VM $vmConfig -Windows -ComputerName $computerName -Credential $cred -ProvisionVMAgent -EnableAutoUpdate
PS C:\WINDOWS\system32> $result = New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm
New-AzureRmVM : Windows admin user name cannot be more than 20 characters long, end with a period(.), or contain the following characters: \ / " [ ] : | < > + = ; , ? * @.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : ''
In Zeile:1 Zeichen:11
+ $result = New-AzureRmVM -ResourceGroupName $rgName -Location $locatio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmVM], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand
编辑 2
在阅读https://msdn.microsoft.com/en-us/library/mt603843.aspx 示例的提示之后,我得到了这个。我的用户是管理员,但我收到消息,不允许吗?!
PS C:\WINDOWS\system32> $SecurePassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force
PS C:\WINDOWS\system32> $Credential = New-Object System.Management.Automation.PSCredential ("Administrator", $SecurePassword);
PS C:\WINDOWS\system32> $AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "KGSCloud"
PS C:\WINDOWS\system32> $vmName = "titan"
PS C:\WINDOWS\system32> $computerName = "TITAN"
PS C:\WINDOWS\system32> $vm = Set-AzureRmVMOperatingSystem -VM $vmConfig -Windows -ComputerName $computerName -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate
PS C:\WINDOWS\system32> $result = New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm
New-AzureRmVM : The Admin Username specified is not allowed.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : ''
In Zeile:1 Zeichen:11
+ $result = New-AzureRmVM -ResourceGroupName $rgName -Location $locatio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmVM], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand
有人可以帮我吗?
亲切的问候
【问题讨论】:
标签: powershell azure azure-powershell