In this blog post we discuss the Command Line Interfaces (CLI) Enablement in SAS®Viya. Keep reading to learn more about SAS® Viya Administration – Command Line Interfaces (CLI).
What is SAS® Viya Command Line Interfaces?
SAS® Viya contains administrative command-line interfaces (CLIs). In SAS Viya, a CLI is a user interface to the SAS® Viya REST services where we enter commands on a command line and receive a response from the system. We can use a CLI to interact directly with SAS® Viya programmatically without a GUI.
Implementation for CLI Enablement in SAS® Viya (for UNIX Environment)
Step 1: Download and unzip the CLI Plug-in from below link:
Step 2: Set the SSL_CERT_FILE Environment Variable:
If the environment is enabled for Transport Layer Security (TLS), then we must set the SSL_CERT_FILE environment variable to the path location of the trustedcerts.pem file. If the SSL_CERT_FILE environment variable is not already set, complete these steps:
- In a command window on the SAS Viya machine, navigate to the following directory: /opt/sas/viya/home/bin
Set the environment variable as follows:export SSL_CERT_FILE=/opt/sas/viya/config/etc/SASSecurityCertificateFramework/cacerts/trustedcerts.pem
Figure 1: Setting SSL_CERT_FILE Environment Variable
Step 3: Setup the default profile:
The first task is to set up the default profile. We should create atleast one profile.
- Go to the directory where we unzip the CLI Plug-in (sas-admin) and run the following command: ./sas-admin –profile <profile_name> profile init
- Enter the SAS® Viya Endpoint URL, for example “https://host.example.com”
- Enter the Output Type (text|json|fulljson)
- Specify whether to enable ANSI colored output or not (y/n)
Figure 2: Creating default profile
Step 4: Log On to SAS® Viya Using CLI:
We have created default profile in above step. Now, we can login using same profile.
- Run this command to log on to a SAS Viya environment that is specified in the profile called test_profile: ./sas-admin –profile test_profile auth login
- Enter the username and password at the prompt. If the login credentials are correct then it will show the message “Logic succeeded. Token saved.
- By default, this authentication remains active for 12 hours.
Figure 3: Login to SAS Viya using CLI
SAS® Administration CLI Repositories:
Following is the list of repositories which we can install and use further in CLI: