Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么可以';Azure是否在PowerShell命令中找到配置?_Powershell_Azure_Deployment_Provisioning_Piping - Fatal编程技术网

为什么可以';Azure是否在PowerShell命令中找到配置?

为什么可以';Azure是否在PowerShell命令中找到配置?,powershell,azure,deployment,provisioning,piping,Powershell,Azure,Deployment,Provisioning,Piping,我正在尝试使用下面的PowerShell命令部署Azure VM,但收到一个无用的错误 有东西阻止Azure识别资源调配配置 我还完全从命令中删除了反恶意软件JSON并进行了测试,但没有任何区别——因此,至少我知道所有转义引号都没有问题 注意:这是在一行上执行的-我在StackOverflow上添加了换行符以提高可读性 New-AzureVMConfig -Name "TestVM" -Label "TestVM" -InstanceSize "extra small" -HostCaching

我正在尝试使用下面的PowerShell命令部署Azure VM,但收到一个无用的错误

有东西阻止Azure识别资源调配配置

我还完全从命令中删除了反恶意软件JSON并进行了测试,但没有任何区别——因此,至少我知道所有转义引号都没有问题

注意:这是在一行上执行的-我在StackOverflow上添加了换行符以提高可读性

New-AzureVMConfig -Name "TestVM" -Label "TestVM" -InstanceSize "extra small" -HostCaching "ReadWrite" -AvailabilitySetName "TestAvailabilitySet" -ImageName "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201412.01-en.us-127GB.vhd" -MediaLocation "https://teststorageaccount.blob.core.windows.net/vhds/TestDisk.vhd" -DiskLabel "TestDisk"
| Add-AzureProvisioningConfig -Windows –Password "xxxxxxxx" -ResetPasswordOnFirstLogon -NoRDPEndpoint -NoWinRMEndpoint -TimeZone "Pacific Time (US & Canada)"
| Set-AzureVMMicrosoftAntimalwareExtension -AntimalwareConfiguration "{ `"AntimalwareEnabled`": true, `"RealtimeProtectionEnabled`": true, `"ScheduledScanSettings`": { `"isEnabled`": true, `"day`": 1, `"time`": 120, `"scanType`": `"Full`" } }"
| Set-AzureSubnet –SubnetNames "TestSubnet"
| Set-AzureStaticVNetIP -IPAddress "x.x.x.x"
| New-AzureVM -ServiceName "TestService" -DeploymentLabel "TestDeployment" -DeploymentName "TestDeployment" -VNetName "TestNetwork"
这是显示的错误消息:

New-AzureVM : Virtual Machine TestVM is missing provisioning configuration
At line:1 char:829
+ New-AzureVMConfig -Name "TestVM" -Label "TestVM" -InstanceSize "extra  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureVM], ArgumentException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewAzureVMCommand

我发现了几个问题:

1)
addazureprovisiongconfig
命令显然需要
-AdminUsername
参数,基于我在internet上找到的旧(遗留)示例,我省略了该参数

2)
-ResetPasswordOnFirstLogon
标志已被弃用,在我将其删除之前,该命令不会继续执行。同样,显然我已经读了太多陈旧和不相关的教程

3) 虚拟机大小应该是
超小
而不是
超小

最后一个有效的命令如下所示:

New-AzureVMConfig -Name "TestVM" -Label "TestVM" -InstanceSize "ExtraSmall" -HostCaching "ReadWrite" -AvailabilitySetName "TestAvailabilitySet" -ImageName "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201412.01-en.us-127GB.vhd" -MediaLocation "https://teststorageaccount.blob.core.windows.net/vhds/TestDisk.vhd" -DiskLabel "TestDisk"
| Add-AzureProvisioningConfig -Windows -AdminUsername "LocalAdmin" –Password "xxxxxxxx" -NoRDPEndpoint -NoWinRMEndpoint -TimeZone "Pacific Time (US & Canada)"
| Set-AzureVMMicrosoftAntimalwareExtension -AntimalwareConfiguration "{ `"AntimalwareEnabled`": true, `"RealtimeProtectionEnabled`": true, `"ScheduledScanSettings`": { `"isEnabled`": true, `"day`": 1, `"time`": 120, `"scanType`": `"Full`" } }"
| Set-AzureSubnet –SubnetNames "TestSubnet"
| Set-AzureStaticVNetIP -IPAddress "x.x.x.x"
| New-AzureVM -ServiceName "TestService" -DeploymentLabel "TestDeployment" -DeploymentName "TestDeployment" -VNetName "TestNetwork"