Using the suggested:
$instanceTwo = $instancePool | New-AzSqlInstance -Name "mi-pool-name" -VCore 4 -StorageSizeInGB 512
returns:
New-AzSqlInstance : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any ofthe parameters that take pipeline input.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@igomat Thank you for bringing this to our attention. We are evaluating this and will take correction or provide feedback as appropriate.
I believe the issue is that in the documentation the $instanceOne and $instanceTwo PowerShell examples reference that same managed pool (-Name "mi-pool-name")
$instanceOne = $instancePool | New-AzSqlInstance -Name "mi-pool-name" -VCore 2 -StorageSizeInGB 256
$instanceTwo = $instancePool | New-AzSqlInstance -Name "mi-pool-name" -VCore 4 -StorageSizeInGB 512
Assigning to the content team for review (@stevestein). A person reading this doc would need to realize that -Name needs to equate to a unique "mi-pool-name" between $instanceOne and $instanceTwo.
@Mike-Ubezzi-MSFT No, it's not the issue that both $instanceOne and $instanceTwo reference the same managed pool. You can execute just a single one but the error will pop up.
The source of the error is that the New-AzSqlInstance accept pipeline object only for InstancePool parameter but the rest of mandatory parameters like Edition, Location, ComputeGeneration, SubnetId have Accept pipeline input: False. According to: https://docs.microsoft.com/en-us/powershell/module/az.sql/new-azsqlinstance?view=azps-2.6.0
To sum up, the example in doc should be corrected to include providing the other mandatory parameters as well. For me worked with those as minimum:
New-AzSqlInstance -Name „sql-instance01” -VCore 4 -StorageSizeInGB 256 -SubnetId $pool.SubnetId -ComputeGeneration $pool.ComputeGeneration -Location $pool.Location -AdministratorCredential $Credential -Edition $pool.Edition -AsJob -ResourceGroupName $pool.ResourceGroupName
Thank you for this additional detail. This has been assigned to the content owner for review. @stevestein for awareness.
Hi, and thank you for the valuable feedback. Parameters you are referring to (Edition, Location, ComputeGeneration, SubnetId) are not required for creating instance inside the instance pools, as all these parameters are inherited from the pool. That is why we have created demo instruction using command with minimal input parameters supplied.
Of course, there are other ways to create instance inside the pool (including your example) and you have found proper guidelines using PowerShell doc page https://docs.microsoft.com/en-us/powershell/module/az.sql/new-azsqlinstance?view=azps-3.2.0 Maybe linking to this page with full list of available parameters and examples would be good.
@igomat We will now proceed to close this thread. If there are further questions regarding this matter, please comment and we will gladly continue the discussion.
Most helpful comment
@Mike-Ubezzi-MSFT No, it's not the issue that both $instanceOne and $instanceTwo reference the same managed pool. You can execute just a single one but the error will pop up.
The source of the error is that the New-AzSqlInstance accept pipeline object only for InstancePool parameter but the rest of mandatory parameters like Edition, Location, ComputeGeneration, SubnetId have Accept pipeline input: False. According to: https://docs.microsoft.com/en-us/powershell/module/az.sql/new-azsqlinstance?view=azps-2.6.0
To sum up, the example in doc should be corrected to include providing the other mandatory parameters as well. For me worked with those as minimum:
New-AzSqlInstance -Name „sql-instance01” -VCore 4 -StorageSizeInGB 256 -SubnetId $pool.SubnetId -ComputeGeneration $pool.ComputeGeneration -Location $pool.Location -AdministratorCredential $Credential -Edition $pool.Edition -AsJob -ResourceGroupName $pool.ResourceGroupName