Dune PSModule - Examples¶
Login to Dune¶
# Login with social auth
Connect-Dune -Tenant "yendico"
# Disconnect and remove cached session
Disconnect-Dune
List dune collection and deployments¶
# List all collections
Get-DuneCollection
# List all deployments by displayname
Get-DuneDeployment
# Get a deployment by displayname
Get-DuneDeployment -DisplayName "Web Server"
# Get all deployments from web collection
Get-DuneCollection -Name "web" | Get-DuneDeployment
# List all DuneResourceGroup for a deployment
Get-DuneDeployment "webserver" | Get-DuneResourceGroup
List resources¶
# Llist all resources for a deployment
Get-DuneDeployment "webserver" | Get-DuneResource
# Get-DuneComputeNode
Get-DuneComputeNode -Hostname "server1"
# Get all ServiceAccounts
Get-DuneGenericResource -ExtType "dune/ServiceAccount"
# List all disks for a computenode
Get-DuneComputeNode -Name "webvm" | Get-DuneDisk
Display computenode insights¶
# Get pending updates for a computenode
Get-DuneComputeNode -Hostname "server1" | Get-DuneUpdate
# List services for a computenode
Get-DuneComputeNode -Hostname "server1" | Get-DuneService
# List package for a computenode
Get-DuneComputeNode -Hostname "server1" | Get-DunePackage
# Show facts for a computenode
Get-DuneComputeNode -Hostname "server1" | Get-DuneFacts
Deployment Operations¶
# Start a deployment
Get-DuneDeployment "webserver" | Start-DuneDeployment -Id <deployment-guid>
# Stop a deployment
Get-DuneDeployment "webserver" | Stop-DuneDeployment -Id <deployment-guid>
# Set deployment lifetime to expire in 30 days
Get-DuneDeployment "webserver" | Set-DuneDeploymentLifetime -ValidUntil (Get-Date).AddDays(30)
# Remove a deployment (use -WhatIf first to preview)
Remove-DuneDeployment -Id <deployment-guid> -Unstage -WhatIf
ComputeNode Operations¶
# Start ComputeNode
Get-DuneComputeNode -Hostname "server1" | Start-DuneComputeNode
# Stop ComputeNode
Stop-DuneComputeNode -Id <computenode-guid>
Actions & ActionAssignments¶
# List all actions
Get-DuneAction
# List actions assignments for a deployment
Get-DuneDeployment "webserver" | Get-DuneActionAssignment
# List resource for a action assignment
Get-DuneActionAssignment -Name "Start WebServer" | Get-DuneResource
# Start action assignment
Get-DuneComputeNode "webserver" | Get-DuneActionAssignment -Name "Start WebServer" | Start-DuneActionAssignment
# List all jobs for an action assignment
Get-DuneComputeNode "webserver" | Get-DuneActionAssignment -Name "Start WebServer" | Get-DuneJob
# Show JobEvents for the recent action job of an action assignment
Get-DuneComputeNode "webserver" | Get-DuneActionAssignment -Name "Start WebServer" | Get-DuneJob | Select -Last 1 | Get-DuneJobEvent
# Assign a action to a deployment
Get-DuneAction -Name "service-manager" | New-DuneActionAssignment -Deployment (Get-DuneDeployment "webserver")
# Assign a action to a resource
Get-DuneAction -Name "service-manager" | New-DuneActionAssignment -Resource (Get-DuneComputeNode -Hostname "server1")
Resource provider & configuration¶
# Create a new provider
New-DuneResourceProvider -Name "yendico-prod-sub" -Type "azure" -DefaultEnvironment Dev
# Initialize a provider
Get-DuneResourceProvider -Name "yendico-prod-sub" | Invoke-DuneResourceProviderInitialization
# Remove a provider (use -WhatIf)
Remove-DuneResourceProvider -Id <provider-guid>
Users, variables and settings¶
# List users
Get-DuneUser -FirstName "Jane"
# Get and remove a variable (resource or resource-group scoped)
Get-DuneVariable -ResourceGroup "rg-app"
Remove-DuneVariable -Name "MyVar" -ResourceGroup <id> -Confirm
Best Practices & Notes¶
- Use
Get-Help <cmdlet> -Examplesto see parameter-set examples added to each function. - Destructive cmdlets support
ShouldProcess; use-WhatIfand-Confirmto preview or require confirmation. - Use pipeline-friendly commands to compose operations (most
Get-*return objects accepted by child objectsGet-*,Start-*,Stop-*,Remove-*). - Keep credentials and tokens secure — prefer
Get-Credentialor external secret stores.
This guide is intentionally short — run Get-Help inside PowerShell for precise parameter sets and examples for each public function.