Enroll Tenant Portal Fails

Document ID : KB000111868
Last Modified Date : 22/08/2018
Show Technical Document Details
Issue:
Tenant Portal enrollment fails with the following error:
"There was an error while creating the tenant. Please check your connection to the servers and/or your json payload."
Environment:
API Portal 4.2.x

 
Cause:
If you had used different "PORTAL_TENANT_ID" other than "apim" when running ./config.sh, the curl POST command inside the "create-tenant.sh" script fails.
Resolution:
Update the POST command in  "create-tenant.sh" script with the "PORTAL_TENANT_ID" which is set in portal.conf file, before executing  "create-tenant.sh" script.

Eg:- If "test" is the "PORTAL_TENANT_ID" which is configured in conf/portal.conf , then POST command in "create-tenant.sh" script will look like...

function create_tenant {
        apim=$(get_conf PORTAL_TENANT_ID)
        apim=${apim:-apim}
        if [ -z "$data" ]; then
                STATUSCODE=$(curl --silent --output ./tenant_info --write-out "%{http_code}" \
                                -X POST -k https://test-ssg.${DOMAIN}:9443/provision/tenants \
                                --cert ${KEY_FILE} --key ${KEY_FILE} -H "Accept: application/json" \
                                -H "Content-Type: application/json" -d "$(generate_post_data)")
                if test $STATUSCODE -ne 201; then
                        echo "There was an error while creating the tenant. Please check your connection to the servers and/or your json payload."
                        exit 1
                else
                        print_steps
                fi
        elif [ -f "$data" ]; then
                STATUSCODE=$(curl --silent --output ./tenant_info --write-out "%{http_code}" \
                                -X POST -k https://test-ssg.${DOMAIN}:9443/provision/tenants \
                                --cert ${KEY_FILE} --key ${KEY_FILE} -H "Accept: application/json" \
                                -H "Content-Type: application/json" -d @${data})
                if test $STATUSCODE -ne 201; then
                        echo "There was an error while creating the tenant. Please check your connection to the servers and/or your json payload."
                        exit 1
                else
                        print_steps
                fi
        else
                echo "${data} Does not exist"
        fi
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Update /etc/hosts file by adding an entry with the "PORTAL_TENANT_ID".

<IP>    test-ssg.example.com

Substitute <IP> with the IP to your instance and example.com with "PORTAL_SUBDOMAIN" name accordingly.