-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New-AzureRMVM Object reference not set to an instance of an object - previously working script #6847
Comments
@jeanfrancoislarente Thanks for the report, cna you also provide the output when executing @singhkays @hyonholee can you take a look? |
Issue with error "Object reference not set to an instance of an object." also applies to Get-AzureRmVm. I had a prior working script suddenly start failing after 6.6.0 update and after discovering that the example powershell at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-disk-ps also now fails with the same error i rolled back to an earlier module and it succeeded. The only time Update-AzureRmVm would acccept the vm object on 6.6.0 was via a pipestream, but, at least in the adding-a-data-disk flow, something still wasn't actually functioning. |
@singhkays @hyonholee @markcowl Here is the error for New-AzureRMVm
|
Read another thread about storage account type names changing with/without the underscore. Since the disk is being created as Premium, is it possible that the New-AzureRMVm command, which is trying to create boot diagnostics in basic storage is using the wrong name for the "standard" storage account type? |
Works correctly in 6.3.0. Didn't try any newer versions except for the reproducible 6.6.0 version. |
Faced same issue yesterday on 5.4.0. Solved by specifying StorageAccountType in the Set-AzureRmVMOSDisk phase, before creating the VM with New-AzureRmVm:
Previously I was specifying storage sku only in New-AzureRmDiskConfig, as per official documentation, and New-AzureRMVm stopped working after last update. |
Fantastic @OmegaMadLab - re-installed 6.6.0 and tried by adding the StorageAccountType to the Set-AzureRmVMOSDisk CmdLet and it worked like a charm. Interesting that it works in 6.3.0 without setting that value but not in 5.4.0 and 6.6.0 |
The root cause is the generated client library has a converter for storage account type, and even the value is null, it tries to write the value by calling value.ToString() (below line). |
@hyonholee @singhkays Is there an update on this issue? Many customers are still facing the same issue. Is there a timeline on when this be fixed? Thanks. |
FYI: @OmegaMadLab 's fix is also working when calling
|
Cleaning up old issues from 2016 - 2018. Please reopen this issue if it is still a concern. |
Currently on 6.6.0
Had a script to create a new VM from a stored VHD (been using for ~8 months now).
I'm all of a sudden getting New-AzureRmVM : Object reference not set to an instance of an object.
Omitting the creation of RG, networking, etc. Below is the script to create OS disk and VM.
Has anything changed in the latest releases?
The text was updated successfully, but these errors were encountered: