Giffyguy
Giffyguy

Reputation: 21282

Why can't Azure find the provisioning configuration within a PowerShell command?

I'm attempting to deploy an Azure VM using the PowerShell command below, and I'm receiving an unhelpful error.

Something is blocking Azure from recognizing the provisioning configuration.

I also removed the Antimalware JSON entirely from the command and tested, but it made no difference - so at least I know it's not an issue with all of the escaped quotation marks.

Note: this is executed all on one line - I added line breaks for readability on 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"

This is the error message that is displayed:

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

Upvotes: 2

Views: 726

Answers (1)

Giffyguy
Giffyguy

Reputation: 21282

I discovered several issues:

1) The Add-AzureProvisioningConfig command apparently requires the -AdminUsername argument, which I had omitted based on older (legacy) examples I found on the internet.

2) The -ResetPasswordOnFirstLogon flag is deprecated, and the command would not proceed until I removed it. Again, apparently I've been reading too many tutorials that are old and irrelevant.

3) The VM size should be ExtraSmall not extra small

The final command that worked, looked like this:

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"

Upvotes: 1

Related Questions