This file contains 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
# 1. Import the OpenAI API Key from the local securely exported credential | |
$chatGPTCred = Import-Clixml .\chatGPTAPIKey.xml | |
# 2. Use the Set-OpenAIKey cmdlet to take the secure credential and set the OpenAIKey environment variable | |
Set-OpenAIKey -Key $chatGPTCred.Password | |
# 3. Import the PowerShellAI Module | |
Import-Module PowerShellAI | |
# 4. Start the GUI |
This file contains 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
# 1. Import the OpenAI API Key from the local securely exported credential | |
$chatGPTCred = Import-Clixml .\chatGPTAPIKey.xml | |
# 2. Use the Set-OpenAIKey cmdlet to take the secure credential and set the OpenAIKey environment variable | |
Set-OpenAIKey -Key $chatGPTCred.Password | |
# 3. Import the PowerShellAI Module | |
Import-Module PowerShellAI |
This file contains 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
# 1. Get API Credential via prompt. | |
# Only need the password which is your API Key | |
$gptAPI = Get-Credential | |
# 2. Export to a file in the local directory | |
$gptAPI | Export-Clixml ./chatGPTAPIKey.xml | |
# 3. Ongoing you only need to put the following two lines at the top of your scripts | |
# Make sure you copy your chatGPTAPIKey.xml file to other directories for scripts for OpenAI. | |
$chatGPTCred = Import-Clixml .\chatGPTAPIKey.xml |
This file contains 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
$Global:headers = $null | |
$Global:SSFBaseURI = "https://api10preview.sapsf.com/odata/v2/" | |
$Global:SSFBusinessEmailType = "159139" | |
$Global:SSFPersonalEmailType = "159140" | |
Function Connect-SSF { | |
[cmdletbinding()] | |
param( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
[string]$SSFBaseURI |
This file contains 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
import msal | |
import jwt | |
import json | |
import sys | |
import requests | |
from datetime import datetime | |
global accessToken | |
global requestHeaders | |
global tokenExpiry |
This file contains 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
# V2 APIs | |
# Basic AuthN | |
$userID = 'yourWordpressAccountAlias' | |
$userPassword = 'ABCD wTUZ pIST 9jEo 99LV 1234' | |
$Bytes = [System.Text.Encoding]::utf8.GetBytes("$($userID):$($userPassword)") | |
$encodedAuth = [Convert]::ToBase64String($Bytes) | |
$header = @{Authorization = "Basic $($encodedAuth)" } | |
Invoke-RestMethod -method get -uri "https://yourwordpressURL/wp-json/wp/v2/posts" -headers $header |
This file contains 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
import-module PKCE | |
import-module JWTDetails | |
$clientID = '<your AAD clientID>' | |
$tenantID = '<your AAD tenantID' | |
$clientSecret = '<your AAD App Client Secret>' | |
$replyURL = 'https://localhost/' | |
$scopes = 'user.read.all' | |
Function Get-AuthCode { |
This file contains 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
# Get Service Principals | |
$spList = az ad sp list --all | |
$spListObj = $spList | ConvertFrom-Json | |
# Get Graph Permissions | |
$graphSP = $spListObj | Where-Object {$_.appID -eq '00000003-0000-0000-c000-000000000000'} | Select-Object | |
# List of Application Scopes | |
$adminScopes = $graphSP.oauth2Permissions | Where-Object {$_.type -eq 'Admin'} | Sort-Object value | Select-Object id, isEnabled, type, adminConsentDescription, adminConsentDisplayName, value |
This file contains 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
#Install-Module MSAL.PS | |
Import-Module MSAL.PS | |
$resource = "https://graph.windows.net" # AzureAD Graph | |
$apiVersion = "api-version=1.6-internal" # Internal API | |
$scope = "user_impersonation" # Delegated User Impersonation | |
$clientID = "1b730954-1685-4b74-9bfd-dac224a7b894" # PowerShell | |
$tenantID = "yourcompanyAADName.com" # AAD | |
$myUPN = "[email protected]" # User UPN |
This file contains 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
import msal | |
import jwt | |
import json | |
import sys | |
import requests | |
from datetime import datetime | |
from msal_extensions import * | |
# Microsoft Azure PowerShell Client ID | |
clientID = '1950a258-227b-4e31-a9cf-717495945fc2' |
NewerOlder