New-AzDisk: Missing required parameter StorageAccountId #26573
Labels
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Compute
customer-reported
Service Attention
This issue is responsible by Azure service team.
Description
Source documentation: https://learn.microsoft.com/en-us/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-managed-disk-from-vhd
When I run the script
New-AzDisk -DiskName $diskName -Disk $diskConfig -ResourceGroupName $resourceGroupName -StorageAccountId $storageAccountId
it complains about the parameterStorageAccountId
which cannot be found.However when I omit this parameter, it complains about a missing required parameter 'StorageAccountId'.
So it can't run with or without this parameter. How to proceed?
Issue script & Debug output
Run script with parameter 'StorageAccountId':
New-AzDisk: /home/rick/createdisk.ps1:61
Line |
61 | … onfig -ResourceGroupName $resourceGroupName -StorageAccountId $storag …
| ~~~~~~~~~~~~~~~~~
| A parameter cannot be found that matches parameter name 'StorageAccountId'.
Run script without parameter 'StorageAccountId':
New-AzDisk: /home/rick/createdisk.ps1:61
Line |
61 | New-AzDisk -DiskName $diskName -Disk $diskConfig -ResourceGroupName $ …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Required parameter 'storageAccountId' is missing (null). ErrorCode: BadRequest ErrorMessage: Required parameter 'storageAccountId' is missing (null). ErrorTarget: StatusCode: 400 ReasonPhrase: Bad Request OperationID : 399f6f8b-e088-4ec6-aff7-1c584c0b457e
Environment data
PS /home/rick> $PSVersionTable
Name Value
PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS CBL-Mariner/Linux
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
PS /home/rick> Get-Module Az*
ModuleType Version PreRelease Name ExportedCommands
Script 3.0.4 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 8.4.0 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
Script 7.9.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGatewayBackendHttpSetting, Add-AzApplicationGatewayBackendSetting…}
Script 6.15.1 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Script 7.4.0 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRule, Close-AzStorageFileHandle…}
Script 1.1.3 Az.Tools.Predictor {Disable-AzPredictor, Enable-AzPredictor, Open-AzPredictorSurvey, Send-AzPredictorRating}
Script 0.0.0.10 AzureAD.Standard.Preview {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredOwner, Add-AzureADDeviceRegisteredUser, Add-AzureADDirectoryRoleMember…}
Script 0.9.3 AzurePSDrive
Error output
PS /home/rick> Resolve-AzError -Last
HistoryId: 32
Message : A parameter cannot be found that matches parameter name 'storageAccountId'.
StackTrace : at System.Management.Automation.CmdletParameterBinderController.VerifyArgumentsProcessed(ParameterBindingException originalBindingException)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection
1 arguments) at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection
1 arguments)at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
--- End of stack trace from previous location ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.ParameterBindingException
InvocationInfo : {New-AzDisk}
Line : New-AzDisk -DiskName $diskName -Disk $diskConfig -ResourceGroupName $resourceGroupName -storageAccountId $storageAccountId
Position : At /home/rick/createdisk.ps1:61 char:88
+ … onfig -ResourceGroupName $resourceGroupName -storageAccountId $storag …
+ ~~~~~~~~~~~~~~~~~
HistoryId : 32
The text was updated successfully, but these errors were encountered: