Skip to content

Instantly share code, notes, and snippets.

View chelnak's full-sized avatar
👀
What's cooking?

Craig Gumbley chelnak

👀
What's cooking?
View GitHub Profile
@chelnak
chelnak / Export-Blueprints.ps1
Created September 21, 2016 14:48
Export vRA blueprints as content packages with PowervRA
#requires -version 5
<#
- Export vRA Blueprint content package and extract the archive
- Requires PowerShell 5
#>
# --- Set Filter
@chelnak
chelnak / New-CosmosDBRESTAuthToken.ps1
Last active November 28, 2017 14:58
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
function New-CosmosDBRESTAuthToken {
[CmdletBinding()]
Param(
[Parameter()]
[String]$Verb,
[Parameter()]
[String]$ResourceType,
[Parameter()]
[String]$ResourceId,
[Parameter()]
@chelnak
chelnak / o11nExecuteAction.ps1
Created May 4, 2017 10:53
o11n-gateway-service API execute action example
$Body = @"
{
"entries": [
{
"key": "name",
"value": {
"type": "string",
"value": "craig"
}
}
@chelnak
chelnak / o11nExecuteWorkflow.ps1
Created May 4, 2017 10:29
o11n-gateway-service API execute workflow example
$Body = @"
{
"requestHeader": null,
"requestData": {
"entries": [
{
"key": "host",
"value": {
"type": "string",
"value": "b89d15b9-b954-4046-9d76-778edd791b99"
@chelnak
chelnak / escapeDataString.ps1
Last active April 5, 2017 09:07
Escape URI String with PowerShell
$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 / ConfigureVMDiskEncryption.ps1
Last active March 11, 2017 19:19
Encrypt Azure VM Disks with PowerShell
<#
.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 February 7, 2017 09:54
Update IaaS Virtual Machine State
/*
- Update IaaS Virtual Machine State
- Input: virtualMachineName [String]
*/
var state = "Off";
var vCACVirtualMachine = Server.findAllForType("vCAC:VirtualMachine", "VirtualMachineName eq '" + virtualMachineName + "'");
@chelnak
chelnak / updateXaaSWorkflowAssociation.js
Last active November 23, 2016 20:20
Update the vRO Workflow Associated with an XaaS Blueprint
/*
- Update the vRO Workflow Associated with an XaaS Blueprint
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: blueprintId [String]
- Input: workflowId [String]
*/
var tenant = vCACCAFEHost.tenant;
@chelnak
chelnak / resetUserPrincipalPassword.js
Created October 4, 2016 12:56
Reset the password of a vRA local user principal with vRO
/*
- Reset the password of a local user principal
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: principalId [String]
- Input: password [SecureString]
- Input: confirmPassword [SecureString]
- Output: [Void]
*/
@chelnak
chelnak / Create a vCloud Air reservation.ps1
Last active September 27, 2016 15:34
Creating reservations with PowervRA - This gist contains examples for creating vSphere and vCloud Air reservations
# --- Create a vCloud Air Reservation
# --- Get the compute resource id
$ComputeResource = Get-vRAReservationComputeResource -Type "vCloud Air" -Name "uk-slough-1-6 - VDC1 (vCloud Air)"
# --- Get the network definition
$NetworkDefinitionArray = @()
$Network1 = New-vRAReservationNetworkDefinition -Type "vCloud Air" -ComputeResourceId $ComputeResource.Id -NetworkPath "isolated-network"
$NetworkDefinitionArray += $Network1