Howto: Connect using sas-admin CLI

The featured guide is about how to connect to your SaasNow Viya environment using the SAS Administration Command Line Interface (CLI). Our colleague, Jelle Daemen, was willing to help a step further and give some examples of the most common options used.

The guide: https://www.saasnow.com/static/2019/08/SaasNow_Guide_Viya_Admin_CLI.pdf

Jelle’s examples:

# Some examples of using the sas-admin cli:

# For the examples below, there are some of the most common options used, however there are more options available. To check them all, make sure to use the –help option with the sas-admin command!

# these examples are ran in a Windows environment, as most users are using Windows environments on a daily basis.

# Before being able to execute commands in the sas-cli, first make sure to login to the sas-cli environment.

# Make sure to use your servername and a user having admin privileges in SAS, and use the correct password:

set SSL_CERT_FILE=C:\SAS\trustedcerts.pem

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” auth login –user “sas-admin” –password “S3cr3t”

# Make sure to check what plugins are available in the sas-admin tool;

# Check what plugins currently are installed:

sas-admin plugins list

# Check what plugins can be installed:

sas-admin plugins list-repo-plugins

# Install a new plugin (the “–repo SAS” means the plugin will be downloaded by a repository hosted by SAS, so you are sure it is a supported plugin):

sas-admin plugins install –repo SAS authorization

# Set permissions to cas libraries:

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” cas caslibs add-control –server cas-shared-default –caslib test –table CLASS –group SASAdministrators –grant ReadInfo

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” cas caslibs add-control –server cas-shared-default –caslib test –table CLASS –user username –grant Select

# Permissions to CAS tables:

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” cas tables add-control –server cas-shared-default –caslib test –table CLASS –group SASAdministrators –grant ReadInfo

# Set conditional grant permissions to a CAS table:

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” cas tables add-control –server cas-shared-default –caslib test –table CLASS –group SASAdministrators –grant Select –where “b=’c'”

# the –where statement enables you to setup a conditional grant. In this example we are using a variable called “B” to contain the text ‘c’.

# Configure Viya rules (In the Web Environment you would find this in the tab: Manage Environment -> Rules):

# Receive existing rules:

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” authorization list-rules > C:\temp\rules.txt

# This writes a file to the locaton “C:\temp\rules.txt”. In this files are the rules listed.

# To change an existing rule:

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” authorization update-rule –object-uri “/folders/folders/7e460b5b-579a-46f7-b3ae-4e89f036e885/**” –group SASAdministrators –reason “A descriptive reason” –description “A description that explains what you are doing and why” –id c82e2540-e294-4e91-9178-3782618d3fb4 –permissions Read,Add

# Create a new rule:

sas-admin –sas-endpoint “https://example-saasdemo.saasnow.com/” authorization create-rule –object-uri “/folders/folders/7e460b5b-579a-46f7-b3ae-4e89f036e885/**” –group SASAdministrators –reason “A descriptive reason” –description “A description that explains what you are doing and why” –permissions Read

2020 © Saas Now bv - Privacy disclaimer