# How can I exclude emailTemplates when auth0 cli import

**URL:** <https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514>\
**Category:** Get Help\
**Tags:** cli, email-template, auth0\
**Created:** [January 17, 2022, 8:34am UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514 "2022-01-17T08:34:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hayashi-ay](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hayashi-ay/32/19643_2.png) [@hayashi-ay](https://community.auth0.com/u/hayashi-ay)\
**Post date:** [January 17, 2022, 8:34am UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514/1 "2022-01-17T08:34:45Z")

</div>

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.

```bash
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.

```

```yaml
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

```

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 18, 2022, 10:55pm UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514/3 "2022-01-18T22:55:22Z")

</div>

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.

```auto
emailProvider: {}
emailTemplates: []

```

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

Thank you.

---

<div class="post-metadata">

**Author:** ![hayashi-ay](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hayashi-ay/32/19643_2.png) [@hayashi-ay](https://community.auth0.com/u/hayashi-ay)\
**Post date:** [January 19, 2022, 6:10am UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514/4 "2022-01-19T06:10:48Z")

</div>

Thank you for answering.

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

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 19, 2022, 6:27pm UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514/5 "2022-01-19T18:27:42Z")

</div>

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.

```auto
{
    "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!

---

<div class="post-metadata">

**Author:** ![hayashi-ay](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hayashi-ay/32/19643_2.png) [@hayashi-ay](https://community.auth0.com/u/hayashi-ay)\
**Post date:** [January 21, 2022, 4:52am UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514/6 "2022-01-21T04:52:27Z")

</div>

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.

```auto
# a non-production tenant
emailTemplates: []

```

```auto
# 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

```

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 21, 2022, 8:02pm UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514/7 "2022-01-21T20:02:17Z")

</div>

Hi @hayashi-ay,

Thank you for your response.

> [@hayashi-ay](#):
>
> I really want to know is how can I switch settings of emailTemplates by config.json or something else?

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?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 5, 2022, 8:02pm UTC](https://community.auth0.com/t/how-can-i-exclude-emailtemplates-when-auth0-cli-import/76514/8 "2022-02-05T20:02:34Z")

</div>

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