Skillable Studio allows execution of scripts against a cloud subscription, as well as executing scripts that do not have a target. Scripts are used in Automated Activities and Life Cycle Actions.
Using Directives
C# scripts in Skillable Studio can use the Using
directive at the beginning of a script, to help simplify your code.
//To allow the use of types in a namespace so that you do not have to qualify the use of a type in that namespace:
using System.Text;
//To allow you to access static members and nested types of a type without having to qualify the access with the type name.
using static System.Math;
//To create an alias for a namespace or a type. This is called a using alias directive.
using Project = PC.MyCompany.Project;
Interacting with Skillable Studio
Your scripts can communicate success or failure to Skillable Studio in one of two ways.
Return a Boolean value
//do stuff... all good
return true;
//do stuff... uh oh
return false;
Use setActivityResult
//do stuff... all good
#Set-ActivityResult -Correct -Message 'Nice job'
//do stuff... uh oh
#Set-ActivityResult -Incorrect -Message 'Please try again'
You can also report the result as a score percentage...
//do stuff... we want to report success and set the score value as 50%
Set-ActivityResult -Percentage .5 -Message "You received half credit"
Send a Notification to the User
Notifications appear as real-time toast notification in the lab client.
Send-LabNotification 'Hello from Azure CLI'
Lab Variables
Lab variables are always string name/value pairs. Variable values are scoped to the lab instances and become available within the lab instructions as well as subsequent script executions.
Set-LabVariable -Name 'firstName' -Value 'John'
You can "receive" a variable in your script...
#a variable set elsewhere in the lab, but we can use it in our script
var myVariable1 = "@lab.Variable(myVariable1)";