Azure / template-specs

MIT License
31 stars 4 forks source link

Error: Operation returned an invalid status code 'NotFound' #76

Closed captainhook closed 9 months ago

captainhook commented 9 months ago

Hi folks,

I am using PS 7.4.0 locally and Az module 2.9.1, all latest as of today.

az login
az account set --subscription "[redacted]"
Get-AzTemplateSpec
Get-AzTemplateSpec: Operation returned an invalid status code 'NotFound'

I have also tried through Azure Cloud Shell and I get an empty return from Get-AzTemplateSpec. There is most definitely a Template Spec in that subscription.

I have tried passing all other parameters but I get the same error.

Any idea why this is happening?

There was mention of it in #1

alex-frankel commented 9 months ago

Can you run the command with the -Debug switch. Also, setting the subscription with the az CLI is not going to affect the subscription used in PowerShell. These are two different settings. For powershell you would use Set-AzContext

captainhook commented 9 months ago

Thanks @alex-frankel After running with -debug switch, I was able to identify that the command was indeed running inside a different subscription, hence it was returning nothing. I was able to use Set-AzContext to switch subscription and then it worked!