Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the same unique suffix to used in all resource naming #78

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cocallaw
Copy link

@cocallaw cocallaw commented Feb 9, 2023

This PR updates the logic for the unique suffix used when naming resources deployed and applies the suffix to the display names of the two AAD app registration created.

Addresses comment by fajterini #69 (comment) and acknowledged by DCMattyG

Added

  • Function New-UniqueIPAMDeployString
  • Variable $unique and $uniqueSuffix

Removed

  • Bicep param guid

Updated Flow

  • The deploy.ps1 script is started by the user
  • function New-UniqueIPAMDeployString called after initial setup and validation for the script occurs
    -- Function creates a unique 13 character string of numbers and lowercase letters and stores in $unique
    -- UIAppName and EngineAppName values are updated
    -- The value of $unique is returned from the function
  • Function Deploy-IPAMApplications runs using the updated app name variables
  • Variable $unique is passed into into function Deploy-Bicep as the value for uniqueSuffix
  • Bicep Templates use uniqueSuffix value to build string variables for resource names

Added logic to deployment script that will generate a unique suffix per deployment, that will be used in naming of all resources created
Updated parameter and variables to accept uniqueSuffix value and concat into resource names for deployment
@cocallaw
Copy link
Author

cocallaw commented Feb 9, 2023

Deployment example

image

image

@DCMattyG
Copy link
Contributor

DCMattyG commented Feb 9, 2023

Hey there @cocallaw, thank you so much for submitting this PR. I will thoroughly review this later today and provide some feedback. I had already been working on a solution for this on my end, so I just want to make sure we take the most holistic approach to solving this problem.

@DCMattyG
Copy link
Contributor

DCMattyG commented Feb 9, 2023

At first glance, I see an issue with a use case where customers may have strict naming conventions for App Registrations and pass in a specific value for EngineAppName or UIAppName and don't want that modified with a uniqueString. Does that make sense @cocallaw?

@cocallaw
Copy link
Author

I see what you are @DCMattyG, checking to see if the suffix could possibly be set somewhere else on the App Registration objects such as internal notes to help with identification if user has deployed multiple times or failure on deployment.

@DCMattyG
Copy link
Contributor

DCMattyG commented Feb 10, 2023

Perhaps a more "simple" solution is to check and see if the values do NOT match the defaults (provided at the top), which means a user has chosen a specific value. However, that doesn't address the other point that even if they do specify a value, what happens if the deploy fails and they need to redo it without creating the same SP's over and over.

In the latter case, maybe we just add a cleanup to remove the created App Registrations if the deployment fails for any reason. That may solve the problem outright without needing to append a suffix as the root issue was end users having overlapping App Registrations after many failed deployment attempts.

Thoughts?

@cocallaw
Copy link
Author

The command New-AzADApplication has a -tag parameter that is defined as "Custom strings that can be used to categorize and identify the application" and appears to not be Azure Tags. Testing to see how the value of tag is exposed and options for filtering based on xyz value.

Could possibly store the suffix in tag, allowing users to specify any name they would like for the app registrations. To perform cleanup of the app registrations if the deployment fails, filter the registrations based on the value of tag if it matches the suffix, then require user confirmation before deletion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants