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 Get-AzureOpenAIToken1{ | |
<# .SYNOPSIS | |
Get an azure token for user or managed identity thats required to authenticate to Azure OpenAI with Rest API. | |
Also construct the header if you are using an Azure OpenAI API key instead of Azure AD authentication. | |
.PARAMETER ManagedIdentity | |
Use this parameter if you want to use a managed identity to authenticate to Azure OpenAI. | |
.PARAMETER User | |
Use this parameter if you want to use a user to authenticate to Azure OpenAI. | |
.PARAMETER APIKey | |
Use this parameter if you want to use an API key to authenticate to Azure OpenAI. |
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
, | |
"additionalLoginParams": [ | |
"response_type=code id_token", | |
"https://graph.microsoft.com", | |
"(String)" | |
] |
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
using namespace System.Net | |
using namespace System.IO | |
# Input bindings are passed in via param block. | |
param($Request, $TriggerMetadata) | |
# Write to the Azure Functions log stream. | |
Write-Host "PowerShell HTTP trigger function processed a request." |
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
$AzureSpeechSubscriptionKey = 'enter your key here' | |
$AzureSpeechRegion = 'norwayeast' | |
$Language = 'en-IE' | |
$VoiceName = 'en-IE-EmilyNeural' | |
$FetchTokenHeader = @{ | |
'Content-type'='application/x-www-form-urlencoded'; | |
'Content-Length'= '0'; | |
'Ocp-Apim-Subscription-Key' = $AzureSpeechSubscriptionKey | |
} |
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
$AzureSpeechSubscriptionKey = 'enter your key here' | |
$AzureSpeechRegion = 'norwayeast' | |
$Language = 'en-us' | |
$VoiceName = 'en-US-JennyNeural' | |
$Style = 'whispering' | |
$FetchTokenHeader = @{ | |
'Content-type'='application/x-www-form-urlencoded'; | |
'Content-Length'= '0'; | |
'Ocp-Apim-Subscription-Key' = $AzureSpeechSubscriptionKey |
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
{ | |
"definition": { | |
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", | |
"actions": { | |
"Bot_User": { | |
"inputs": { | |
"variables": [ | |
{ | |
"name": "BotUserID", | |
"type": "string" |
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
$csvFile = "C:\temp\teamslist.csv" | |
#List of team object IDs. Header in CSV is ID. | |
$table = Import-Csv $csvFile -Delimiter "," | |
$source = Connect-Tenant -Domain contoso.onmicrosoft.com -Browser | |
$destination = Connect-Tenant -Domain tailspin.onmicrosoft.com -Browser | |
foreach ($row in $table) { | |
$team = Get-Team -id $($row.id) -Tenant $source |
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
$TenantID = "xxxxxx" | |
$LogicAppSeObjectID = "xxxxxxx" | |
$ServicePrincipalId = $LogicAppSeObjectID | |
$GraphResource = Get-MgServicePrincipal -Filter "AppId eq '00000003-0000-0000-c000-000000000000'" | |
$application_role_to_assign_name = "Chat.Read.All" | |
$Permission = $GraphResource.AppRoles | Where-Object {$_.value -in $application_role_to_assign_name} | |
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $ServicePrincipalId -PrincipalId $ServicePrincipalId -AppRoleId $Permission.Id -ResourceId $GraphResource.Id |
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
{ | |
"properties": { | |
"choices": { | |
"items": { | |
"properties": { | |
"content_filter_results": { | |
"properties": { | |
"hate": { | |
"properties": { | |
"filtered": { |
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
{ | |
"items": { | |
"properties": { | |
"content": { | |
"type": "string" | |
}, | |
"role": { | |
"type": "string" | |
} | |
}, |