1
當我從PowerShell ISE中爲什麼New-AzureRmVM給出實體名稱錯誤?
New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $Location -VM $VM
運行這段代碼我得到這個錯誤
New-AzureRmVM : The entity name is invalid according to its validation rule: ^[^_\W][\w-._]{0,79}(?<![-.])$.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 'my-operation-id'
At line:1 char:1
+ New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $Location -VM $VM
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmVM], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand
$ ResourceGroupName包含我的資源組的名稱, 「foobar.com」 在這個例子中。
$位置包含「East US 2」。
$ VM包含以下
ResourceGroupName :
Id :
Name : foobar
Type :
Location :
Tags : null
AvailabilitySetReference : null
DiagnosticsProfile : {
"bootDiagnostics": {
"enabled": true,
"storageUri": "https://foobar.blob.core.windows.net/"
}
}
Extensions : null
HardwareProfile : {
"vmSize": "Basic_A0"
}
InstanceView : null
NetworkProfile : {
"networkInterfaces": [
{
"properties.primary": null,
"id": "/subscriptions/my-sub-id/resourceGroups/foobar.com/providers/Microsoft.Network/n
etworkInterfaces/foobar"
}
]
}
OSProfile : {
"computerName": "foobar",
"adminUsername": "admin",
"adminPassword": "password",
"customData": null,
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true,
"timeZone": "UTC-05:00",
"additionalUnattendContent": null,
"winRM": null
},
"linuxConfiguration": null,
"secrets": null
}
Plan : null
ProvisioningState :
StorageProfile : {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "Windows-Server-Technical-Preview",
"version": "latest"
},
"osDisk": {
"osType": null,
"encryptionSettings": null,
"name": "OS Disk",
"vhd": {
"uri": "https://foobar.blob.core.windows.net/vhds/foobar-os.vhd"
},
"image": null,
"caching": null,
"createOption": "fromImage",
"diskSizeGB": null
},
"dataDisks": [
{
"lun": 0,
"name": "Data Disk",
"vhd": {
"uri": "https://foobar.blob.core.windows.net/vhds/foobar-data.vhd"
},
"image": null,
"caching": null,
"createOption": "empty",
"diskSizeGB": 20
}
]
}
DataDiskNames : {Data Disk}
NetworkInterfaceIDs : {/subscriptions/my-sub-id/resourceGroups/foobar.com/providers/Microsoft.Network/networkInterf
aces/foobar}
我的虛擬機配置誰能告訴我什麼實體名稱,它指是什麼?它是虛擬機的名稱,其中一個存儲位置的名稱等? 據我所知,一切都與正則表達式匹配,所以我不明白爲什麼我得到這個錯誤。搜索命令名稱只會帶來幾個命中,並且根本沒有提到有關實體名稱的任何內容。
你會[接受答案](http://meta.stackexchange.com/q/5234/179419)通過點擊勾選標記。 – GregGalloway