Skip to content

Instantly share code, notes, and snippets.

jamesbannan

Block or report user

Report or block jamesbannan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jamesbannan
jamesbannan / azureRegionCountry.ps1
Last active May 8, 2018
Get all Azure regions in the same country based on IP address
View azureRegionCountry.ps1
# Get all Azure regions accessible with my subscription
$regions = az account list-locations | ConvertFrom-Json
$locations = $regions | Select-Object displayName,latitude,longitude | Sort-Object displayName
# Get my location based on IP address
$request = (Invoke-WebRequest -Uri http://ip-api.com/json).Content | ConvertFrom-Json
$latitude = $request.lat
$longitude = $request.lon
$countryCode = $request.countryCode
@jamesbannan
jamesbannan / nearestAzureRegion.ps1
Created May 8, 2018
Find nearest Azure region based on IP address
View nearestAzureRegion.ps1
# Get all Azure regions accessible with my subscription
$regions = az account list-locations | ConvertFrom-Json
$locations = $regions | Select-Object displayName,latitude,longitude | Sort-Object displayName
# Get my location based on IP address
$request = (Invoke-WebRequest -Uri http://ip-api.com/json).Content | ConvertFrom-Json
$latitude = $request.lat
$longitude = $request.lon
$hash = [ordered]@{
View azuredeploy.parameters.json
"chefValidationKey": {
"reference": {
"keyVault": {
"id": "/subscriptions/<SUBSCRIPTIONID>/resourceGroups/<RESOURCEGROUPNAME>/providers/Microsoft.KeyVault/vaults/<VAULTNAME>"
},
"secretName": "chef-org-validator"
}
}
View New-KeyVaultChefCertSecret.ps1
## Log in to Azure Resource Manager
Add-AzureRmAccount
## Create Resource Group
$resourceGroupName = 'keyvault'
$location = 'Australia Southeast'
$resourceGroup = New-AzureRmResourceGroup `
-Name $resourceGroupName `
You can’t perform that action at this time.