Skip to content

Instantly share code, notes, and snippets.

View garrytrinder's full-sized avatar
👨‍💻
CLI for Microsoft 365

Garry Trinder garrytrinder

👨‍💻
CLI for Microsoft 365
View GitHub Profile
@garrytrinder
garrytrinder / reset-env-values.ps1
Created November 24, 2023 10:08
Reset Teams Toolkit environment files
param (
[Parameter(Mandatory=$true)]
[string]$Path
)
# Define the files to search for
$filesToSearch = ".env.local", ".env.local.user", ".env.dev", ".env.dev.user"
# Define the keys to ignore
$keysToIgnore = "SPO_HOSTNAME", "SPO_SITE_URL", "APP_NAME_SUFFIX"
@garrytrinder
garrytrinder / remove-sideloaded-teams-apps.ps1
Last active November 24, 2023 09:23
Remove sideloaded Teams apps for the current user
# assumes you are logged into tenant using CLI for Microsoft 365 (https://aka.ms/cli-m365)
$apps = m365 teams user app list --userId "@meId" | ConvertFrom-Json
$apps | Where-Object { $_.teamsApp.distributionMethod -eq "sideloaded" } | ForEach-Object { m365 teams user app remove --id $_.id --userId "@meId" --force }
@garrytrinder
garrytrinder / remove-teams-org-apps.ps1
Last active November 24, 2023 09:23
Remove custom apps from the Teams organisation store
# assumes you are logged into tenant using CLI for Microsoft 365 (https://aka.ms/cli-m365)
$apps = m365 teams app list --distributionMethod organization | ConvertFrom-Json
$apps | ForEach-Object { m365 teams app remove --id $_.id --force }
@garrytrinder
garrytrinder / remove-outlook-apps.js
Last active November 24, 2023 09:18
Remove personal apps from Outlook web
(async (window) => {
const ootbApps = [
"Bookings",
"Files",
"Go to Excel",
"Go to OneNote",
"Go to PowerPoint",
"Go to Word",
"SurveyMonkey: Surveys for Feedback",
"Viva Engage"
@garrytrinder
garrytrinder / remove-bf-bots.js
Last active July 4, 2024 09:37
Remove all bots from dev.botframework.com
// Remove all bots from your account
// 1. Go to https://dev.botframework.com/bots
// 2. Open the console (F12)
// 3. Paste the following code and press enter
(async () => {
// select the first bot element
let bot = document.querySelector('.bot-content > a');
while (bot) {
// click the element link
@garrytrinder
garrytrinder / remove-az-resource-groups.ps1
Last active November 24, 2023 09:25
Remove all Azure Resource Groups
# assumes you are logged into azure subscription using Azure CLI (https://aka.ms/azcli)
az group list --query "[].name" -o tsv | ForEach-Object { az group delete --name $_ --yes --no-wait }
@garrytrinder
garrytrinder / remove-apps-from-tdp.js
Last active November 24, 2023 09:21
Remove apps from Teams Developer Portal
// Remove all apps from Teams Developer Portal
// 1. Open Teams Developer Portal (https://dev.teams.microsoft.com/apps)
// 2. Scroll down to the bottom of the page, loading all apps in the table
// 3. Open browser console (F12)
// 4. Manually delete one app from the table
// 5. Inspect the DELETE network request to get the bearer token
// 6. Paste this code into the console
// 7. Update the token variable with the bearer token
// 8. Run the code
@garrytrinder
garrytrinder / remove-aad-apps.ps1
Last active November 24, 2023 09:44
Remove Azure AD app registrations
# assumes you are logged into tenant using CLI for Microsoft 365 (https://aka.ms/cli-m365)
$notToRemove = @("app1","app2")
$apps = m365 aad app list | ConvertFrom-JSON
$apps | Where-Object { $_.displayName -notin $notToRemove } | ForEach-Object { m365 aad app remove --appId $_.appId --force }
@garrytrinder
garrytrinder / launch.json
Last active August 8, 2023 16:41
Teams Toolkit VSCode
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Frontend in Teams (Edge)",
"type": "msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${{local:TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "all",
@garrytrinder
garrytrinder / .env.local
Last active August 7, 2023 08:54
Bring your existing project to Teams Toolkit for Visual Studio 2022
TEAMSFX_ENV=local
BOT_DOMAIN=
CONNECTION_NAME=
MICROSOFT_APP_ID=
MICROSOFT_APP_TYPE=
MICROSOFT_APP_TENANT_ID=
TEAMS_APP_ID=