Skip to content

Instantly share code, notes, and snippets.

View andrewmatveychuk's full-sized avatar
☁️

Andrew Matveychuk andrewmatveychuk

☁️
View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

Configuration sampleConfiguration {
#Importing required DSC resources
Import-DscResource -ModuleName @{ModuleName="PackageManagement"; RequiredVersion="1.4.5"}
Import-DscResource -ModuleName xPSDesiredStateConfiguration
#Common variables
#Download location for software package
$packageLocalPath = "C:\Deploy\<package_name>.exe"
#Install Chocolatey as a package manager
cChocoInstaller installChocolatey {
InstallDir = "C:\ProgramData\Chocolatey"
DependsOn = "[PackageManagement]cChoco"
}
#Install the software package you need
cChocoPackageInstaller requiredPackage {
Name = "<package_name>"
Ensure = "Present"
#Installing build tools specified in configurationData.psd1 file
$Node.packages.foreach(
{
cChocoPackageInstaller $_ {
Name = $_
Ensure = "Present"
AutoUpgrade = $True
DependsOn = "[cChocoInstaller]installChocolatey"
}
}
# configurationData.psd1 file
@{
AllNodes = @(
@{NodeName = "localhost";
#List of packages to be installed
Packages = @(
"netfx-4.8-devpack",
"visualstudio2017buildtools",
"visualstudio2017testagent",
"visualstudio2017-workload-manageddesktopbuildtools",
@andrewmatveychuk
andrewmatveychuk / azure-pipelines-snippet.yml
Created November 11, 2019 10:50
Sample snippet for an Azure DevOps release pipeline to enable Application Insights web tests
steps:
- task: AzurePowerShell@4
displayName: 'Enable Application Insights web avaliability tests'
inputs:
azureSubscription: <your_service_connection> # Your service connection, i.g., a subscription or resource group name
@andrewmatveychuk
andrewmatveychuk / disableWebTest.ps1
Created November 11, 2019 10:51
PowerShell script to disable all web tests in a specific resource group
$alertResourceIds = Get-AzResource -ResourceGroupName $env:resourceGroupName | Where-Object -Property ResourceType -EQ "microsoft.insights/webtests" | Select-Object -ExpandProperty ResourceId
ForEach ($Id in $alertResourceIds) {
$alerts = Get-AzResource -ResourceId $Id
$alerts.Properties.Enabled = "False"
$alerts | Set-AzResource -Force
}
{
"field": "location",
"notIn": [
"[[resourcegroup().location]",
"global"
]
},
{
"field": "location",
"parameters": {
"allowedLocations": {
"type": "Array",
"metadata": {
"displayName": "Allowed locations",
"description": "The list of locations that can be specified when deploying resources.",
"strongType": "location"
}
}
}
@andrewmatveychuk
andrewmatveychuk / sample-policy-definition-in-arm-template.json
Last active April 24, 2020 17:22
Sample Azure Policy definition in an ARM template
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"policyName": "restrict-allowed-locations-policy",
"policyDisplayName": "Restrict allowed locations for resources",
"policyDescription": "This policy restrict the locations you can specify when deploying resources. Excludes resource groups, Microsoft.AzureActiveDirectory/b2cDirectories, and resources that use the 'global' region."
},
"resources": [
{