Skip to content

Instantly share code, notes, and snippets.

View dabedin's full-sized avatar
🏠
Working from home

Davide Bedin dabedin

🏠
Working from home
View GitHub Profile
@dabedin
dabedin / Automation_SimpleGetAzureVMs.ps1
Created July 5, 2018 16:17
A simple (and highly improvable) PS script to retrieve VMs informations.
function Login
{
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
$output = Add-AzureRmAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationID $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
}
function FlattenTags ($tags) {
if ($tags -ne $NULL) {
$result = ($tags.GetEnumerator() | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join ';'
}
else {
@dabedin
dabedin / VMListLogicApp-template.json
Created July 5, 2018 16:09
Template of a logic app invoking an Automation script collecting info of VMs, processing and formattin output and sending it via Office 365
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"defaultValue": "dbreportVMlist",
"metadata": {
"description": "Name of the Logic App."
}