PowerShell Maintenance Scripts Page
Overview
PowerShell scripting is an essential part of our DevOps and server management strategy for the Alliance Business Suite. The following page provides a detailed description of the PowerShell functions that are most often used in our development environment. These functions are located in the Scripts folder within our main code repository and are designed to be self-explanatory and easy to use.
How to Access the Scripts
The scripts are located at the following path:
.\Scripts
Importance of Running start.ps1
Running the start.ps1 script is a crucial initial step for setting up your Alliance Business Suite development environment. This script accomplishes several important tasks:
-
Enables Suite PowerShell Functions: The script activates a range of functions designed to streamline your development workflow, from building and testing to deploying Alliance Business Suite projects.
-
Updates PowerShell Profile: If you already have a PowerShell profile, the script will append a line to it. This ensures that the Suite PowerShell functions are loaded every time you start a new PowerShell session. If the profile doesn't exist, the script will create one for you.
-
Ensures Consistency: By standardizing the environment setup, we ensure that every developer, whether junior or senior, has access to the same set of tools and functionalities. This minimizes errors and inconsistencies that can occur due to environment differences.
-
Time-Saving: Without the script, you'd have to manually configure your environment, a process that could be error-prone and time-consuming. The script automates these tasks, allowing you to focus on development work.
-
Simplicity: Even for those who are not familiar with PowerShell or our development workflow, running a single script makes the setup process as straightforward as possible.
So, before diving into any development tasks, make sure you've run start.ps1 to set yourself up for success.
How to Run start.ps1
Running the start.ps1 script is straightforward and can be accomplished through a few simple steps. Here's how to do it:
-
Open PowerShell: Navigate to the 'Start' menu, type in 'PowerShell', and select the Windows PowerShell application.
-
Run as Administrator: Right-click on the Windows PowerShell and choose 'Run as administrator' to launch PowerShell with administrative privileges. This may be required to modify the PowerShell profile.
-
Navigate to the Script's Directory: Use the
cdcommand to navigate to the directory where yourstart.ps1script is located. For example:cd path\to\your\script\directory -
Run the Script: Execute the script by typing the following command and pressing Enter:
.\start.ps1Note: The dot (
.) before the backslash is important; it's used to source the script in the current session. -
Follow On-screen Prompts: The script may provide on-screen prompts or messages. Read them carefully and proceed as directed.
-
Verify Installation: Once the script finishes executing, you should see a 'Done' message or something similar. You can also open a new PowerShell window and check if the functions are available by typing one of the function names and pressing Enter.
-
Restart PowerShell: Finally, it's a good idea to close and reopen PowerShell to ensure that all changes are effectively loaded into your profile.
By following these steps, you'll enable a suite of functions and features that will streamline your development workflow in the Alliance Business Suite.
Listing available Maintenance Commands
To list all the available SuiteCommands, you can run the following command:
Get-SuiteCommands
Common Functions
Update-SuitePackageVersion
Synopsis: Updates the version of a package within the Suite.
Start-SuiteOperation
Synopsis: Initiates a given Suite operation.
Get-SuiteHelp
Synopsis: Provides help documentation for Suite functions.
Write-SuiteVariable
Synopsis: Writes a variable to the Suite environment.
New-SuiteDatabaseBackup
Synopsis: Creates a new database backup.
Remove-SuiteDatabaseMigration
Synopsis: Removes a specified database migration.
Build-SuiteApi
Synopsis: Builds the Suite API.
Restore-Suite
Synopsis: Restores the Suite to a previous state.
Test-Suite
Synopsis: Runs the test sequences for the Suite.
Publish-Suite
Synopsis: Publishes the Suite.
Install-SuiteNodeModules
Synopsis: Installs Node modules required for the Suite.
New-SuiteBastionHost_PSSession
Synopsis: Creates a new PowerShell session for the Bastion Host.
Update-SuiteCDN
Synopsis: Updates the Suite's Content Delivery Network.
Update-SuiteStudioTheme
Synopsis: Updates the Suite's UI theme.
Push-SuiteRepos
Synopsis: Pushes changes to the Suite repositories.
Set-SuiteBranch
Synopsis: Switches to a different Suite branch.
Release-SuiteWebsiteVersion
Synopsis: Releases a new version of the Suite website.
Build-SuiteEngineeringHandbook
Synopsis: Builds the engineering handbook.
Best Practices
- Follow Naming Conventions: Ensure that function names are self-explanatory and stick to a consistent naming pattern.
- Modularize Code: Make sure to break down tasks into smaller, reusable functions.
- Comment: Add comments to the scripts for better understanding and easier debugging.
Related Links
- PowerShell Extended with Posh-Git and Oh-My-Posh
- Alliance Business Cloud Azure Repository
- Engineering Handbook
FAQs
For common queries about PowerShell scripting, refer to the Frequently Asked Questions page.
Support
If you encounter any issues, please use the Azure Issue Tracker.
Last Updated
This page was last updated on September 9, 2023.
This handbook page aims to serve as a comprehensive guide for all levels of developers, from junior to senior, on how to utilize the PowerShell functions for the Alliance Business Suite effectively. Feel free to add or modify sections as needed.