I am trying to use New-AzureRmResource to create a new storage account. But I am running into something that is baffling me. My command is here:
New-AzureRmResource -Location "East US" -ResourceGroupName "myResGrp" -ResourceName "storagename" -ResourceType "microsoft.storage/storageaccounts" -Kind "Storage"
But this dumps the error
New-AzureRmResource : AccountTypeMissing : The accountType field is missing from the request.
So I add it in (tried both "AccountType" and "accountType"):
New-AzureRmResource -Location "East US" -ResourceGroupName "myResGrp" -ResourceName "storagename" -ResourceType "microsoft.storage/storageaccounts" -Kind "Storage" -AccountType "Standard_RAGRS"
Then I get the error:
New-AzureRmResource : A parameter cannot be found that matches parameter name 'AccountType'.
How do I pass this in? I assume I am missing something easy here. Thank you.
Answer thanks to the help below
$props = New-Object PSObject
$props | add-member AccountType "Standard_RAGRS"
$props | add-member Kind "Storage"
New-AzureRmResource -Location "East US" -ResourceGroupName "myResGrp" -ResourceName "storagename" -ResourceType "microsoft.storage/storageaccounts" -Properties $props -ApiVersion "2015-06-15"