Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
What's cooking?

Craig Gumbley chelnak

👀
What's cooking?
View GitHub Profile
@chelnak
chelnak / CustomPowerShellProfilePrompt.ps1
Created Jun 24, 2019
Custom prompt for PowerShell that displays your current Az subscription in the tile bar
View CustomPowerShellProfilePrompt.ps1
function Prompt {
$CurrentTitle = $Host.UI.RawUI.WindowTitle
$Host.UI.RawUI.WindowTitle = "Loading Az ..."
Set-Location -Path $ENV:USERPROFILE/code -ErrorAction stop
$IsElevated = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if ($IsElevated) {
Write-Host "$([char]9788) " -ForegroundColor Red -NoNewline
@chelnak
chelnak / New-CosmosDBRESTAuthToken.ps1
Last active Nov 28, 2017
Generate a CosmosDB REST API Auth token with PowerShell See here for more information https://docs.microsoft.com/en-us/rest/api/documentdb/access-control-on-documentdb-resources
View New-CosmosDBRESTAuthToken.ps1
function New-CosmosDBRESTAuthToken {
[CmdletBinding()]
Param(
[Parameter()]
[String]$Verb,
[Parameter()]
[String]$ResourceType,
[Parameter()]
[String]$ResourceId,
[Parameter()]
@chelnak
chelnak / o11nExecuteAction.ps1
Created May 4, 2017
o11n-gateway-service API execute action example
View o11nExecuteAction.ps1
$Body = @"
{
"entries": [
{
"key": "name",
"value": {
"type": "string",
"value": "craig"
}
}
@chelnak
chelnak / o11nExecuteWorkflow.ps1
Created May 4, 2017
o11n-gateway-service API execute workflow example
View o11nExecuteWorkflow.ps1
$Body = @"
{
"requestHeader": null,
"requestData": {
"entries": [
{
"key": "host",
"value": {
"type": "string",
"value": "b89d15b9-b954-4046-9d76-778edd791b99"
@chelnak
chelnak / escapeDataString.ps1
Last active Apr 5, 2017
Escape URI String with PowerShell
View escapeDataString.ps1
$EscapedBusinessGroupName = [URI]::EscapeDataString($BusinessGroupName)
$URI = "/identity/api/tenants/$($TenantId)/subtenants?`$filter=name%20eq%20'$($EscapedBusinessGroupName)'"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference
@chelnak
chelnak / Get-AzureRMResourceTypeAPIVersion.ps1
Created Mar 10, 2017
Small profile function to easily retrieve a list of API versions for a given Resource Type
View Get-AzureRMResourceTypeAPIVersion.ps1
function Get-AzureRMResourceTypeAPIVersion {
<#
.SYNOPSIS
Retrieve a list of API versions for a given ResourceTypeName
.DESCRIPTION
Retrieve a list of API versions for a given ResourceTypeName
.PARAMETER ProviderNamespace
@chelnak
chelnak / ConfigureVMDiskEncryption.ps1
Last active Mar 11, 2017
Encrypt Azure VM Disks with PowerShell
View ConfigureVMDiskEncryption.ps1
<#
.SYNOPSIS
Enables disk encrption on a VM
.DESCRIPTION
Enables disk encryption on a VM. The script will create a new Key Vault, Azure Active Directory Application and Service principal
.PARAMETER ResourceGroupName
The name of the resource group that contains the key vault and virtual machine
@chelnak
chelnak / setVirtualMachineState.js
Created Feb 7, 2017
Update IaaS Virtual Machine State
View setVirtualMachineState.js
/*
- Update IaaS Virtual Machine State
- Input: virtualMachineName [String]
*/
var state = "Off";
var vCACVirtualMachine = Server.findAllForType("vCAC:VirtualMachine", "VirtualMachineName eq '" + virtualMachineName + "'");
@chelnak
chelnak / vco-cli.jar-help.md
Last active Aug 12, 2019
vco-cli.jar help
View vco-cli.jar-help.md

vCO Package import/export command line tool

Description:

Command line tool, that provides basic vCO package import and export operations. As source or target it can have either .package file, or directory.

Usage:

java <java-parameters> -jar PackageToolCli.jar <command> <command-parameters>
@chelnak
chelnak / updateXaaSWorkflowAssociation.js
Last active Nov 23, 2016
Update the vRO Workflow Associated with an XaaS Blueprint
View updateXaaSWorkflowAssociation.js
/*
- Update the vRO Workflow Associated with an XaaS Blueprint
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: blueprintId [String]
- Input: workflowId [String]
*/
var tenant = vCACCAFEHost.tenant;
You can’t perform that action at this time.