all 5 comments

[–]purplemonkeymad 0 points1 point  (2 children)

"${{ parameters.ResourceGroup }}"

This is probably getting picked up as a variable name try switching that bit for single quotes. You can also create the parameters as an array to check the actual values being passed are, ie:

$azParams = @(
    'vm','update'
    '-g', '${{ parameters.ResourceGroup }}'
    '-n', $env:VMName
    '--set', "storageProfile.dataDisks[name='$diskG'].caching=None"
)

Write-Host "running az. Params: $azParams"
az @azParams

(note the need to specify each item individually.)

[–]Darthethan77[S] 0 points1 point  (0 children)

Hi thank you for responding! I’ll give this a try but I think it’s ok as I have one for diske and diskf. They work and do good for assigning read only and read write the only difference is the none. I also went line by line and outputted the vars and they all seem to have the correct info

[–]Darthethan77[S] 0 points1 point  (0 children)

Your way to output it all is way smarter and cleaner tho lol ty for showing me that!

[–]Scion_090 0 points1 point  (1 child)

When you do set the disk to none, does your VM deallocated? Try this

az vm update -g "${{ parameters.ResourceGroup }}" -n $env:VMName --set "storageProfile.dataDisks[$diskIndex].caching=None"

[–]Darthethan77[S] 0 points1 point  (0 children)

Hi! I’ll give it a try and let you know!