Add resource hierarchy analyzer tool#57756
Draft
ArcturusZhang wants to merge 5 commits intoAzure:mainfrom
Draft
Conversation
Reflection-based tool that analyzes Azure SDK management-plane DLLs and outputs the resource hierarchy (parent/child relationships, scopes, data types, collections) as JSON and markdown. Uses MetadataLoadContext for safe, reflection-only analysis without loading assemblies into the runtime. Usage: dotnet run -- <path-to-Azure.ResourceManager.*.dll> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Changed ResourceTypeField from field type name to actual resource type value (e.g., 'Microsoft.ContainerInstance/containerGroups') - Added ResourceId field showing the resource ID pattern from CreateResourceIdentifier method parameters - Uses PEReader IL analysis to extract string literals from static constructors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use AssemblyLoadContext to load assemblies and read ResourceType static field value directly via FieldInfo.GetValue() - Get ResourceId pattern by invoking CreateResourceIdentifier with placeholder parameter names - Remove all PEReader/IL bytecode scanning code - Remove System.Reflection.Metadata/Ecma335 dependencies Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Filter out methods where the return type matches the resource type itself (e.g., AvailabilitySetResource.Get() returning AvailabilitySetResource). These are not child resources but self-referencing retrieval methods. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a reflection-based tool at
eng/packages/resource-hierarchy-analyzer/that analyzes Azure SDK management-plane DLLs and outputs the resource hierarchy as JSON (stdout) and markdown summary (stderr).What it does
ArmResource,ArmCollection, andResourceDatasubtypes viaMetadataLoadContext(reflection-only, no runtime loading)Get*()methodsUsage
Motivation
Useful for understanding and validating resource hierarchies during mgmt SDK migrations (e.g., Swagger -> TypeSpec).