Skip to content

Instantly share code, notes, and snippets.

Get-AzureOpenAIToken -APIKey "Enter API Key here"
$DeploymentName = "TextModel"
$ResourceName = "AzureOpenAIAlex"
$Prompt = "What is microsoft teams?"
$Request = Get-Completion -DeploymentName $DeploymentName -ResourceName $ResourceName -Maxtokens 100 -Prompt $Prompt
"Genetrated text:"
$Request.choices.text
https://azureopenaialex.openai.azure.com/openai/deployments/TextGenerator/completions?api-version=2022-12-01
{
"prompt": "Is the following text possitive, negative or neutral? ",
"max_tokens": 2000
}
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"object": {
"type": "string"
},
"created": {
#Connect using your tenants SharePoint admin url.
Connect-PnPOnline -Url M365x28850929-admin.sharepoint.com -Interactive
#Enter the App ID you coped from the Enterprise Application.
$ManagedIdentityID = "4bf49741-7819-47f1-9e30-c36ef6b9d1aa"
Add-PnPAzureADServicePrincipalAppRole -Principal $ManagedIdentityID -AppRole "Sites.ReadWrite.All" -BuiltInType MicrosoftGraph
Add-PnPAzureADServicePrincipalAppRole -Principal $ManagedIdentityID -AppRole "Sites.FullControl.All" -BuiltInType MicrosoftGraph
#set your sensitivity label.
$sensitivitylabel = "18fd20ce-627f-4b00-84ab-b768550d6446"
#set the url of the site/group you want to monitor and set assign label to.
$url = "https://m365x28850929.sharepoint.com/sites/testnogroup"
#connect to your SharePoint admin site.
$connection = connect-pnponline -managedidentity -url "https://m365x28850929-admin.sharepoint.com/" -returnconnection
$site = get-pnptenantsite -url $url -connection $connection
#Requires -Modules Microsoft.Graph
# Install the module. (You need admin on the machine.)
# Install-Module Microsoft.Graph
# Set Static Variables
$TenantID="enter here"
$AutomationAccountDisplayname ="enter here"
$LogicAppDisplayname = "enter here"
# Define dynamic variables
#Enter email account you want to send email reminders from
$Email = "enter email here"
#Enter Logicapp URL
$LogicAppURL = "enter webhook url here"
#If subject is hidden in meeting room calendar, set this to true so we get the subject from organizers calendar instead.
$HiddenSubject = $true
{
"queries": {
"myString": "Test123"
}
}
{
"properties": {
"MeetingID": {
"type": "string"
},
"MeetingRoomUPN": {
"type": "string"
}
},
"type": "object"