Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

new-azurermvm

$
0
0

Hi everyone,

I'm struggling to find instructions I can understand for the proper usage of the new-azurermvm syntax.  My starting point is here:

https://msdn.microsoft.com/en-us/library/mt603754.aspx?f=255&MSPPError=-2147217396

Parameter Set: Default
New-AzureRmVM [-ResourceGroupName] <String> [-Location] <String> [-VM] <PSVirtualMachine> [[-DisableBginfoExtension]] [-LicenseType <System.String> ] [-Tags <Hashtable[]> ] [ <CommonParameters>]

I'm brand new to Azure Powershell and I'm trying to equate it to commands I am more family with like the new-vm command in PowerCLI, for that I would use syntax similar to this:

New-vm -vmhost esxihost1.mydomain.ca -Name newserver01 -Template W2K12_SQL_Build1.2 -Datastore "DatastoreCluster Prod" -OSCustomizationspec "Windows 2012 Build 1.4" -Location Deploy

My preference is to avoid setting 20+ variables like they do in the example and instead just put the minimum requirements in order to deploy the VM and work on adding to it from there.  With that in mind I'm thinking:

Run Login-AzureRmAccount
#Before proceeding verify you are connected to the subscription you intend to deploy to
$VirtualMachine = New-AzureRmVMConfig -VMName PwrShellvm1 -VMSize "Standard_A2"
## Storage
$StorageName = "pwrshelltestacct"
$StorageType = "Premium_LRS"
New-AzureRmVM -ResourceGroupName PwrShellResGrp1 -Location eastus2 -VM $VirtualMachine

I'm getting:

New-AzureRmVM : Unable to cast object of type
'WhereEnumerableIterator`1[Microsoft.Azure.Management.Storage.Models.StorageAccount]' to type
'Microsoft.Azure.Management.Storage.Models.StorageAccountListResponse'.
At line:1 char:1

The example doesn't seem to specify the storage account within the new-azurermvm command, so I don't see how setting it as a variable would help anyway, am I correct in saying that or am I misunderstanding how PowerShell works?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>