mspnp / AzureNamingTool

The Azure Naming Tool is a .NET 8 Blazor application, with a RESTful API. The UI consists of several pages to allow the configuration and generation of Azure Resource names. The API provides a programmatic interface for the functionality.
https://aka.ms/azurenamingtool
MIT License
308 stars 604 forks source link

Issue generating names via API call from a PowerShell script #26

Closed blaqvikin closed 9 months ago

blaqvikin commented 9 months ago

Describe the bug I am experiencing an issue when calling the API via rest method, I get the error that some required resources have no values provided. Actual error "Invoke-RestMethod: {"resourceName":"RESOURCE NAME NOT GENERATED","message":"You must supply the required components. ResourceIdentifier value was not provided. ResourceTypeSubset value was not provided. ResourceEnvironments value was not provided. ","success":false}"

To Reproduce Steps to reproduce the behavior:

  1. Review the PowerShell script on the right side.
  2. Create a file called requestBody.json which contains the API request body
  3. Create a custom entry on the Azurenaming tool config section, call it ResourceTypeSubset [array of entries]
  4. Create a custom entry called ResourceIdentifier [array of entries]
  5. Run the PS script and verify if the error is the same.

Expected behavior I expect to see the generated name, this worked well up until yesterday the 25th of September 2023

Screenshots I've attached a screenshot of my config as well as the error from VSCode

Installation Method I am running this from container app.

Additional context Add any other context about the problem here. Selected September 26 2023 13:53:37

BryanSoltis commented 9 months ago

Hello @blaqvikin,

Thank you for your feedback. When you create a Custom Component, you must specify those in an array when calling the API.

Your payload should look similar to the following:

{ "resourceEnvironment": "nonprod", "resourceFunction": "security", "resourceLocation": "san", "resourceType": "nsg", "customComponents": { "ResourceTypeSubset": "subn", "ResourceIdentifier": "db" } }

Hope this helps!

blaqvikin commented 9 months ago

Awesome, thanks @BryanSoltis it works.