This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| terraform { | |
| required_providers { | |
| okta = { | |
| source = "okta/okta" | |
| version = "~> 3.10" | |
| } | |
| } | |
| } | |
| # Configure the Okta Provider - API token set in env var. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| variable "org_name" { | |
| default = "dev-123456" | |
| } | |
| variable "base_url" { | |
| default = "okta.com" | |
| } | |
| variable "password" { | |
| sensitive = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run a PowerShell command on a specific interval. | |
| $Timer = [System.Timers.Timer]::new(3000) | |
| Register-ObjectEvent -InputObject $Timer -EventName Elapsed -Action { Get-Item } | |
| $Timer.Start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .DESCRIPTION | |
| Get last login of Guest user in Azure AD | |
| Adapted from https://cloudtech.nu/2020/05/03/export-azure-ad-last-logon-with-powershell-graph-api/#comments | |
| .NOTES | |
| Requries an Azure App registered with Add AuditLog.Read.All, Directory.Read.All, User.Read.All permissions. | |
| Set clientID, tenantName, clientSecret in $env: vars. | |
| #> | |
| $clientID = $env:clientID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enter ~ . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - name: Create security group that allows SSH | |
| azure_rm_securitygroup: | |
| resource_group: "{{ rg_name }}" | |
| name: "{{ nsg_name }}" | |
| rules: | |
| - name: SSH | |
| protocol: Tcp | |
| destination_port_range: 22 | |
| access: Allow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: localhost | |
| gather_facts: false | |
| tasks: | |
| - name: Get the public IP address of the network. | |
| uri: | |
| url: https://api.ipify.org?format=json | |
| method: Get | |
| changed_when: false | |
| register: public_ip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Converts the string 'my-app' to base64 | |
| [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes('my-app')) | |
| # Converts the string assigned to the variable 'theString' and assigns the base64 string to the variable 'convertedString' | |
| $theString = 'hello' | |
| $convertedString = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($theString)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #region Beginner | |
| <# | |
| The challenge is simple: get the sum of the even numbers between 1 and 100. | |
| You should be able to do this in at least 3 different ways. Show all 3 ways. You don’t need to write any functions or scripts. | |
| #> | |
| # Method 1, foreach loop | |
| $sum = 0 | |
| foreach ($n in 1..100) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Test-ForAccessToken { | |
| if ($null -eq $env:PAT) { | |
| throw 'No Personal Access Token environment variable set. Set with $env:pat = Read-Host' | |
| } | |
| } | |
| function Start-BuildDashboard { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter()] |