Azure / deployment-stacks

Contains Deployment Stacks CLI scripts and releases
MIT License
89 stars 7 forks source link

Get-AzResource -ResourceGroupName <resource-group-name> not working #36

Closed Agazoth closed 2 years ago

Agazoth commented 2 years ago

Describe the bug when running Get-AzResource -ResourceGroupName <resource-group-name> nothing is returned from resource groups deployed with New-AzSubscriptionDeploymentStack

To Reproduce Follow the tutorial. When running the line above, nothing is returned.

Expected behavior the storage accounts are returned

Screenshots image

PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

get-module az.resources -ListAvailable

    Directory: C:\Users\axel\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   9.0.0                 Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRole…
Script     4.3.1                 Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRole…
snarkywolverine commented 2 years ago

Do you mind sharing the deployment stack resource ID and, if available, the correlation ID?

Agazoth commented 2 years ago
Id                : /subscriptions/40074199-2a8f-4f6c-b7f4-d8fbca5adf12/providers/Microsoft.Resources/deploymentStacks/
                    mySubStack
Name              : mySubStack
ProvisioningState : succeeded
UpdateBehavior    : purgeResources
Location          : westeurope
CreationTime(UTC) : 12-11-2021 11:33:00
DeploymentId      : /subscriptions/40074199-2a8f-4f6c-b7f4-d8fbca5adf12/providers/Microsoft.Resources/deployments/mySub
                    Stack-2021-11-12-11-45-00-b1c47
SnapshotId        : /subscriptions/40074199-2a8f-4f6c-b7f4-d8fbca5adf12/providers/Microsoft.Resources/deploymentStacks/
                    mySubStack/snapshots/2021-11-12-11-45-00-b1c47
snarkywolverine commented 2 years ago

Can you double-check the template which you were trying to apply? The snapshot referenced above (ending in b1c47) shows an empty template (no resources, parameters, outputs, etc...). I see two deleted resources and no managed resources, which seems consistent with an empty template uploaded.

Agazoth commented 2 years ago

I followed the tutorial, and ended up with a detached storage account in the resource group.

Shouldn't I be able to use Get-AzResource -ResourceGroupName <resource-group-name> to retrieve a storage account provisioned by deployment stacks?

If I remove the 9.0.0 Az.Resources module and just use the one from Az, the cmdlet works.

I'll make a complete re-run in a few hours and check in the result.

Agazoth commented 2 years ago

Just re-ran the entire tutorial, and it works as expected now. Sorry for the inconvenience.