How can I exclude emailTemplates when auth0 cli import

Hi there,

When I tried to import my tenant config.yaml to my non-production Auth0 tenant through the auth0 cli, I encountered the following error.
It says, in short, emailTemplates can not be imported if emailProvider is not enabled.

When I simply remove emailTemplates it works, but I want to share configs with other tenants.
I tried disabling template of emailTemplates or removing from but this doesn’t work.
I also tried the config options of cli, AUTH0_EXCLUDED_DEFAULTS and EXCLUDED_PROP, but this also doesn’t work though I may misused them because the usage is not documented.

2022-01-17T05:40:37.446Z - error: Problem running command import during stage processChanges when processing type emailTemplates
2022-01-17T05:40:37.446Z - error: From address cannot be set without an enabled email provider.
emailProvider:
  name: ses
  credentials:
    accessKeyId: '##SES_ACCESS_KEY_ID##' #I set a dummy value for non-production tenant
    secretAccessKey: '##SES_ACCESS_SECRET_KEY##' #I set a dummy value for non-production tenant
    region: ap-northeast-1
  default_from_address: support@mydomain.com
  enabled: ##EMAIL_PROVIDER_ENABLED## #This value is false for non-production tenant
emailTemplates:
  - template: verify_email
    body: ./emailTemplates/verify_email.html
    enabled: true
    from: support@mydomain.com
    resultUrl: '##MYAPP_FRONT_URL##'
    subject: Subject Message
    syntax: liquid
    urlLifetimeInSeconds: 86400

Hi @hayashi-ay,

Thanks for reaching out to the Auth0 Community!

I understand you have encountered issues with the Auth0 Deploy CLI.

First based on your tenant.yaml file, it appears that you have set enabled: false in the emailProvider object of your non-production tenant.

If you intend to include emailTemplates as you have in the script, you will need to set the emailProvider enabled: true for the script to work.

Otherwise, to exclude the emailTemplates when you use the Auth0 Deploy CLI, you have the option to remove it from the script or specify an empty object.

emailProvider: {}
emailTemplates: []

Please let me know if there’s anything else I can do to help.

Thank you.

Thank you for answering.

So, How can I switch the settings for each tenant using the same yaml file? Or, is it not possible?

1 Like

Hi @hayashi-ay,

Thank you for your response.

To migrate/copy settings from one tenant to another, you will need to create a new config.json file that specifies the new tenant. See below for an example.

{
    "AUTH0_DOMAIN": "YOUR_DOMAIN",
    "AUTH0_CLIENT_ID": "YOUR_CLIENT_ID",
    "AUTH0_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
    "AUTH0_KEYWORD_REPLACE_MAPPINGS": { "AUTH0_TENANT_NAME": "YOUR_TENANT_NAME" },
    "AUTH0_ALLOW_DELETE": false,
    "AUTH0_EXCLUDED_RULES": [ "rule-1-name" ]
  }

Then you can make an import call with the new config.json file with the previous tenant’s tenant.yaml file. Doing so will modify the new tenant with the settings imported from the previous tenant.

Please let me know if you have any further questions.

Thanks!

Thanks. I am sorry that the way I asked was bad. I’ve already know that I can use config.json. I really want to know is how can I switch settings of emailTemplates by config.json or something else?

I want to switch the setting of emailTemplates following values. I tried to achieve this by Keyword Mappings but I couldn’t.

# a non-production tenant
emailTemplates: []
# a production tenant
emailTemplates:
  - template: verify_email
    body: ./emailTemplates/verify_email.html
    enabled: true
    from: support@mydomain.com
    resultUrl: '##MYAPP_FRONT_URL##'
    subject: Subject Message
    syntax: liquid
    urlLifetimeInSeconds: 86400

Hi @hayashi-ay,

Thank you for your response.

Unfortunately, it’s still unclear to me what you are trying to accomplish.

To backtrack, you can exclude emailTemplates using the Auth0 Deploy CLI by either not specifying the emailTemplates in the tenant.yaml file or by providing an empty array.

Now, if you want to switch settings, you will have to modify your tenant.yaml file with the appropriate templates you prefer (e.g welcome email, change password, etc). Then import the file to your corresponding tenant.

Does that help?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.