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

validate resource name before deployment #69

Open
fajterini opened this issue Jan 15, 2023 · 5 comments
Open

validate resource name before deployment #69

fajterini opened this issue Jan 15, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@fajterini
Copy link

Describe the bug
If name prefix is longer than 7 character deployment will fail on Keyvault step but RG, LAW and MI is created.

documentation not specifying what is allowed here.
-NamePrefix | Replaces the default resource prefix of "ipam" with an alternative prefix

To Reproduce
Deploy IPAM with parameter -NamePrefix "ipam-test" `

Expected behavior
Successful deployment

Screenshots
If applicable, add screenshots to help explain your problem.

Result:
Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details. (Code: DeploymentFailed)

  • {
    "error": {
    "code": "VaultNameNotValid",
    "message": "The vault name 'ipam-test-kv-2jhngm4kxwuh4' is invalid. A vault's name must be between 3-24 alphanumeric characters. The name must begin with a letter, end with a letter or digit, and not contain consecutive hyphens. Follow this link for more information: https://go.microsoft.com/fwlink/?linkid=2147742"
    }
    } (Code:BadRequest)

i recommend either to change naming standard for kv or stop deployment script before bicep deployment mode.
It's not a blocer but nice to have feature ;)

@DCMattyG
Copy link
Contributor

Good morning @fajterini, thanks so much for posting this issue!

Fortunately, I'm already aware of this after working with some other folks, and I have a fix that should de deployed shortly to address this. In the meantime, you could workaround this by using the -ResourceNames switch and providing a hashtable of custom names for each resource, if you so desire.

You can read more about the -ResourceNames switch in the deployment guide here:

https://azure.github.io/ipam/#/deployment/README

@DCMattyG DCMattyG self-assigned this Jan 15, 2023
@DCMattyG
Copy link
Contributor

Just a quick follow-on....

The fix will essentially be the script checking that the provided prefix is 7 characters or less. This is because with the -NamePrefix we are just appending some default suffixes, and as such we must factor in the lowest common denominator (e.g. which Azure resource has the smallest character limit). If that isn't flexible enough, you can use the -ResourceNames switch, as described in my previous reply.

Hope that adds some better clarity as to what's coming!

@fajterini
Copy link
Author

fajterini commented Jan 16, 2023

Thanks, i was thinking about -ResourceNames but I just stating deployment in my demo tennant for testing purpose. :)
I have more question but i will ask in discussion.

Edit: On other hand, I am doing Azure DevOps pipelines with biceps and for me also valid options to use parameter file also for resource naming and full deployment would be great. But this is offtopic for this issue.

@fajterini
Copy link
Author

I was testing API calls and this is how my APP registrations looks like in Azure AD after multiple failed deployments :)
have you been thinking about generating same unique name for app registrations like other resources have ?
For me it's hard to know what can i delete :(

image

@DCMattyG
Copy link
Contributor

I agree @fajterini, it may be better to append the same suffix so that users can align the App Registrations to the deployment. Currently, the suffix is created in the Bicep Template, which happens after the App Registrations are created, but it would be easy enough to move that process outside.

I'll add this to my work items list right away. Thank you for bringing this concern to my attention.

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

No branches or pull requests

2 participants