Last active
December 22, 2017 08:13
-
-
Save rasmusgude/eb4b6a4d9c6a3eea44e2e43e51ec5605 to your computer and use it in GitHub Desktop.
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
# Function for easily querying the Azure Instance Metadata Service | |
Function AzMeta { | |
Param( [Parameter(ValueFromPipeline)] $p ) | |
Invoke-RestMethod ` | |
-Headers @{"Metadata"="true"} ` | |
-URI "http://169.254.169.254/metadata/instance/$($p)?api-version=2017-08-01&format=text" | |
} | |
# Get the public IP if your Azure instance | |
"network/interface/0/ipv4/ipAddress/0/publicIpAddress" | AzMeta | |
# Get the Virtual Machine Size/SKU, e.g. "Standard_B2s" | |
"compute/vmSize" | AzMeta |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment