This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.DESCRIPTION | |
An example runbook which gets all the ARM resources using the Managed Identity | |
.NOTES | |
AUTHOR: Azure Automation Team | |
LASTEDIT: Oct 26, 2021 | |
#> | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Interactive read the storage account name | |
read -p "Storage account name: " STORAGE_ACCOUNT | |
# Or set variable directly here | |
# STORAGE_ACCOUNT=azurestorageaccountname | |
STORAGE_CONTAINER=bazel-cpp-tutorial | |
ACCESS_TOKEN=$(az account get-access-token \ | |
--resource="https://${STORAGE_ACCOUNT}.blob.core.windows.net/" \ | |
--query accessToken --output tsv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://s3.amazonaws.com/cfn-resource-specifications-us-east-1-prod/schemas/2.15.0/all-spec.json | |
AWSTemplateFormatVersion: 2010-09-09 | |
Resources: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Purposefully left blank for naming |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## For debugging | |
#PS4='Line ${LINENO}: ' | |
#set -o xtrace | |
RG_NAME=pontitest | |
COMMON_ARGS=(--resource-group $RG_NAME --location australiaeast) | |
az group show --resource-group $RG_NAME > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool: | |
vmImage: 'ubuntu-latest' | |
jobs: | |
- job: Job1 | |
steps: | |
- script: | | |
LABELS_JSON=$(curl -H "Authorization: Bearer ${SYSTEM_ACCESSTOKEN}" "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_apis/git/repositories/$(Build.Repository.Name)/pullRequests/$(System.PullRequest.PullRequestId)/labels?api-version=5.1-preview.1") | |
echo $LABELS_JSON | |
env: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from OpenSSL import crypto | |
key = crypto.PKey() | |
key.generate_key(crypto.TYPE_RSA, 2048) | |
cert = crypto.X509() | |
subj = cert.get_subject() | |
subj.CN = "localhost" | |
cert.gmtime_adj_notAfter(365*24*60*60) | |
cert.set_pubkey(key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Map variables retrieved from Key Vault to environment variables such as: | |
# env: | |
# CERT_DATA: $(certData) | |
# CERT_PASSWORD: $(certPassword) | |
# Read in the PFX data and save as pfx file | |
echo "${CERT_DATA}" | base64 --decode > cert.pfx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %% | |
# !python -m pip install -qU azure-mgmt-dns acme azure-keyvault | |
# %% | |
import os | |
import hashlib | |
import base64 | |
import logging | |
import datetime | |
from typing import List, Tuple, Optional, Callable, Generator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add your use account as "Storage Blob Data Contributor" RBAC to the Access Control of the storage account | |
STORAGE_ACCOUNT=<account-name> | |
STORAGE_ACCESS_TOKEN=$(az account get-access-token --resource https://storage.azure.com/ --query accessToken -o tsv) | |
curl \ | |
-H "Authorization: Bearer $STORAGE_ACCESS_TOKEN" \ |
NewerOlder