Skip to content

Instantly share code, notes, and snippets.

@FH-Inway
FH-Inway / Get-ConsumedArtifacts.ps1
Last active November 6, 2024 12:14
PowerShell script to get consumed artifacts of an Azure DevOps pipeline run
$token = Read-Host -Prompt "Enter your PAT"
$ORG_NAME = "MyOrg"
$PROJECT_NAME = "MyProject"
$BUILD_ID = "12345"
$tokenEncoded = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$token"))
$url = "https://dev.azure.com/$ORG_NAME/_apis/Contribution/HierarchyQuery/project/$($PROJECT_NAME)?api-version=5.1-preview.0"
$buildResults = @{
@FH-Inway
FH-Inway / Create-D365FO.Tools-Cmdlets-As-Draft-Issues.ps1
Last active October 22, 2024 20:29
Draft for some module functions for powershelling the GitHub ProjectV2 GraphQL API
# Example showcasing the use of the GitHub-Project-Manager.ps1
# Iterates over all cmdlets of the d365fo.tools module
# and creates a draft issue for each cmdlet that is missing a draft issue.
Import-Module .\TempPoint\GitHub-Project-Manager.ps1
$project = Get-UserProject -User FH-Inway -ProjectNumber 2
$existingItems = Get-ProjectItems -ProjectId $project.id
# Import-Module d365fo.tools
@FH-Inway
FH-Inway / Invoke-PSMDTemplate.Test.ps1
Last active October 5, 2024 12:15
Test Invoke-PSMDTemplate
Import-Module PSFramework -MaximumVersion 1.11.343
Import-Module PSModuleDevelopment -MaximumVersion 2.2.11.168
Invoke-PSMDTemplate CommandTest -Name Invoke-PSMDTemplate
$certificateThumbprint = Read-Host -Prompt 'Enter certificate thumbprint'
$applicationId = Read-Host -Prompt 'Enter application id'
$tenantId = Read-Host -Prompt 'Enter tenant id'
Connect-AzAccount -CertificateThumbprint $certificateThumbprint -ApplicationId $applicationId -TenantId $tenantId -Verbose
@FH-Inway
FH-Inway / New-AzureAppRegistrationMSGraph.ps1
Last active August 13, 2024 14:42
New-AzureAppRegistrationMSGraph.ps1
<#
To execute the steps, the id of an Azure application must be provided. The application must have the following API permissions:
- Microsoft Graph (User.Read and Mail.Send permissions of the Application type).
#>
# Based on https://blog.icewolf.ch/archive/2022/12/02/create-azure-ad-app-registration-with-microsoft-graph-powershell
# original gist: https://gist.github.com/FH-Inway/4fc4d4f263900ce1fe240f4d32df23e9
[CmdletBinding()]
@FH-Inway
FH-Inway / Get-ADOWorkItemDiscussion.ipynb
Last active August 5, 2024 16:33
Get-ADOWorkItemDiscussion
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$models = Get-D365Model -BinDir "C:\Users\UnifiedDevExpTest01\AppData\Local\Microsoft\Dynamics365\10.0.1935.29\PackagesLocalDirectory\bin" -PackageDirectory "C:\Users\UnifiedDevExpTest01\AppData\Local\Microsoft\Dynamics365\10.0.1935.29\PackagesLocalDirectory" -Verbose
$module = "AAA"
$model = $module
$metadataDir = "C:\Repositories\MyRepo\Metadata"
$packagesLocalDirectory = "C:\Users\UnifiedDevExpTest01\AppData\Local\Microsoft\Dynamics365\10.0.1935.29\PackagesLocalDirectory"
$binDir = "$packagesLocalDirectory\bin"
$logPath = "C:\Temp\d365fo.tools\Logs"
$params = @{
Module = $module
@FH-Inway
FH-Inway / New-EntraIDAndD365FOUser.ps1
Created August 3, 2024 10:27
D365FO User Management Automation
# This script creates a new guest user in Azure Entra ID and a list of
# Microsoft Dynamics 365 Finance and Operations environments.
# It takes the user's tenant id, email address, first and last name as input parameters.
# It also takes an array of Azure Entra ID group IDs to which the user should be added.
# It uses the existing d365fo.integrations configurations to determine the environments
# where the user is to be added with the system administrator security role.
# Install the PowerShell module "Microsoft.Graph" if it is not already installed.
# Install-Module -Name Microsoft.Graph.Authentication -Scope CurrentUser -Force
# Install-Module -Name Microsoft.Graph.Users -Scope CurrentUser -Force
@FH-Inway
FH-Inway / DefaultTopologyDataWithRetail.xml
Last active April 4, 2025 15:32
Dynamics 365 Finance and Operations topology file
<?xml version="1.0" encoding="utf-8"?>
<!--
To populate topology data for command line package installation, refer to:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/deployment/install-deployable-package#collect-topology-configuration-data
-->
<TopologyData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>AX topology</Name>
<MachineList>
<Machine>
<Name>localhost</Name>
@FH-Inway
FH-Inway / Untitled-1.ipynb
Created June 23, 2024 12:00
New notebook with valid first F# code cell and invalid second cell
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.