Train::Pwsh
A train-pwsh connection has 7 fields that are needed for authentication, which are listed below:
- client_id
- tenant_id
- client_secret
- certificate_path
- certificate_password
- organization
- sharepoint_admin_url
These fields need to be defined in the config file stored at this directory: ~/.inspec/config.json. Particularly, under the credentials key of the json file, create a pwsh key with the value being another dictionary. This dictionary should have a key named pwsh-options with the value being another dictionary. This dictionary should contain the names of the seven fields above as well as their values. Please refer to this link for more detailed instructions.
Alternatively, if train is being invoked using code, this is how it can be used:
Pwsh
require 'train'
train = Train.create('pwsh',
client_id: '1', tenant_id: '2', client_secret: '3', certificate_path: '4', certificate_password: '5', organization: '6', sharepoint_admin_url: '7')
Installation
Install the gem and add to the application's Gemfile by executing:
$ bundle add train-pwsh
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install train-pwsh
Usage
Train-pwsh should be used alongside inspec-pwsh, which is a resource pack that is used by profiles to help maintain persisten sessions for the different modules that are called Powershell-based profiles.
Please refer to the following link for inspec-pwsh documentation
To test if train-pwsh and inspec-pwsh is working correctly on your system, try running the o365_example_baseline profile and check the results. If it runs correctly based on your Microsoft 365 configurations, then train-pwsh and inspec-pwsh are properly set.
Please refer to the following link for o365_example_baseline documentation
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/train-pwsh. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Train::Pwsh project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.