Skip to content

Instantly share code, notes, and snippets.

View omiossec's full-sized avatar
:electron:
Powershell Saturday 2019 & Paris PS/WinOps Meetup co organisator

Olivier Miossec omiossec

:electron:
Powershell Saturday 2019 & Paris PS/WinOps Meetup co organisator
View GitHub Profile
BeforeDiscovery {
$policyRawContent = Get-content -Path "..\policies\auditVMExtension.json" -Raw
$policyContent = $policyRawContent | ConvertFrom-Json -Depth 16
$parametersList = $policyContent.parameters | Get-Member -MemberType NoteProperty | select-object -ExpandProperty name
}
beforeAll {
$policyRawContent = Get-content -Path "..\policies\auditVMExtension.json" -Raw
$policyContent = $policyRawContent | ConvertFrom-Json -Depth 16
$policyIfContent = $policyContent.policyrule.if.allOf.count + $policyContent.policyrule.if.anyOf.count
<#
.SYNOPSIS
Create Azure Application, Certificate, SP and link them to Azure Automation Account as Run As Account
.DESCRIPTION
Create Azure Application, Certificate, SP and link them to Azure Automation Account as Run As Account
.PARAMETER ResourceGroupName
Name of the resource group where are located Automation Account and Keyvault
.PARAMETER AutomationAccount
Automation Account Name
.PARAMETER KeyVaultName
trigger:
- master
resources:
- repo: self
variables:
resourceGroupName: 'demo-whatif'
templateFolder: "arm"
templateFile: "demo-arm.json"
@omiossec
omiossec / asg-vm-nsg.json
Last active September 8, 2020 10:58
ASG in ARM Template
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string"
},
"adminPassword": {
"type": "securestring"
}
# To copy a docker image from one registry to another
# Registry A registry.mycompagny.com
# Registry B azureregistrymycomp.azurecr.io
# First login
docker login registry.mycompagny.com -u XXX -p XX
docker login azureregistrymycomp.azurecr.io -u XXXXX -p XXXXX
# Pull the image
docker pull registry.mycompagny.com/project/myimage:latest
[CmdletBinding()]
param(
[parameter(Mandatory = $true, ParameterSetName = "ByKeyword")]
[parameter(Mandatory = $true, ParameterSetName = "BySessionId")]
[string]
$localFolder = "C:\work\ignite",
[parameter(Mandatory = $true, ParameterSetName = "ByKeyword")]
[string]
$Keyword = "powershell",
@omiossec
omiossec / sastoken.ps1
Created December 4, 2018 06:45
Create and use a SAS Token for an Azure blob container
$AzRessourceGroup = "StoragePerson-om"
$AzstorageAccount = "testomdemodata001"
$AzLocation = "FranceCentral"
$AzStorageType = "Standard_LRS"
$AzBlobContainerName = "imagesarchive"
$AzStorage = New-AzureRmStorageAccount -ResourceGroupName $AzRessourceGroup -Name $AzstorageAccount -Type $AzStorageType -Location $AzLocation