Hi there - I am currently setting up CI/CD and for the deployment stage I’d like to check if the site exists and create it (if needed).
When it comes to creating the new site, I run netlify sites:create --name $NETLIFY_SITE_NAME --disable-linking which works fine, however the CLI blocks and waits for input for the Team/account-slug. I noticed there is an --account-slug parameter, but is there a default value I can pass that will have it create the site in the default account?
If you’re using the API and you don’t provide the account_slug parameter, it will create it in the default account. I’d rather not have to require the account slug to be provided as an input variable to the pipeline if possible.
Hey @t0spl0 , you can find your account slug in the “Team Settings” section on your Netlify account. You should be able to use it as the default value in this instance, but let us know if you run into any issues!
Hi @amelia - thanks for this. In this case I want to avoid having to go into the Netlify portal to retrieve the account-slug. I was hoping that since the API doesn’t require you to provide it that there was a command in the CLI to avoid providing it also.
This is further enhanced by the fact that the CLI actually prompts you with the account name asking you to press enter, so it has the ability to retrieve the possible options. Because this will be running in a CI/CD pipeline, I can’t actually press enter as its asking, but if there were a flag to select the default account, that would be ideal.
There is no such flag at this time @t0spl0. If you want the CLI to default to the only account when there is one, that can be created as a feature request here:
I do have a question as Netlify doesn’t have the concept of a “default account”. If we make a feature request for this, how would you like for us to define that concept?
For example, if there is more than one account that a person belongs to, which account should be the “default”? Should that be the oldest account? Should it be the newest account? Should there be a user specific setting where you can set a default account?