Azure / AzOps

AzOps is a PowerShell module which deploys (Push) ARM Resource Templates & Bicep files at all Azure scope levels and exports (Pull) ARM resource hierarchy.
https://aka.ms/AzOps
MIT License
393 stars 164 forks source link

Bug report - naming conventions for resource deletion #903

Open Freakling opened 3 weeks ago

Freakling commented 3 weeks ago

Describe the bug The code seems a bit complicated, but from what I can figure out AzOps deletion of custom resources seems to require following the AzOps naming convention for resolving the diffdeletedfiles to "statepath", that is resourceprovider+resource+childpath i.e microsoft.authoriation_policydefinitions_somename.json/bicep.

I believe this is a product of how AzOpsScopes are built, see the below link for more information. https://github.com/Azure/AzOps/blob/c3ad03a4f7624b0f7e7406cb9ae2785dd9ef14cc/src/internal/classes/AzOpsScope.ps1#L543

It would be great if this is more obvious in the wiki, perhaps some statement that azops requires the naming convention to be followed, and also a separate wiki page detailing exactly how azops builds the file names and a disclaimers that they need to be followed if resource deletion is wanted. https://github.com/azure/azops/wiki/ResourceDeletion

A good bonus to this might be that the validate.yaml could screen for naming convention resource type prefix.

Steps to reproduce

  1. Create a file with naming that does not follow azops standards
  2. deploy file
  3. delete file
  4. nothing gets deleted