That means that your $diskConfig
variable doesn't have a value. You need to step through this script to figure out where the failure is occurring. Stepping back from the command that failed it is creating a managed disk on the step before. It appears that the call is failing. It could be bad parameters or something related to your account. You'll need to verify each of your variables. Note that the script is hard coding some values so you may need to adjust them for your subscription (e.g. resource group).
Out of the box PS will display errors and continue on anyway. If you want to stop the script when an error occurs then add the following to the top of the script $ErrorActionPreference = "Stop"
. This will make it easier to track down the error in larger scripts.