├── CODEOWNERS.md ├── .gitattributes ├── .github ├── reviewers.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── General.md │ ├── Resource_proposal.yml │ └── Problem_with_resource.yml ├── workflows │ ├── commit-message-validator.yaml │ ├── megalinter.yaml │ ├── dependabot.yaml │ ├── labelling.yaml │ └── tagging.yaml ├── dependabot.yml ├── labeler.yml └── PULL_REQUEST_TEMPLATE.md ├── .idea ├── .gitignore ├── misc.xml ├── vcs.xml ├── modules.xml └── xoap-powershell-dsc-module-template.iml ├── .markdownlint.json ├── LICENSE ├── .pre-commit-config.yaml ├── aws-ps ├── connect │ └── wip_set-awscredential.ps1 ├── workspaces │ ├── aws-ps-reboot-workspace.ps1 │ └── aws-ps-create-workspace.ps1 └── ec2 │ └── aws-ps-create-ec2-instance.ps1 ├── SECURITY.md ├── aws-cli ├── ec2 │ ├── aws-cli-stop-instance.ps1 │ ├── aws-cli-start-instance.ps1 │ ├── aws-cli-terminate-instance.ps1 │ ├── aws-cli-allocate-elastic-ip.ps1 │ ├── aws-cli-create-ec2-key-pair.ps1 │ ├── aws-cli-create-ec2-instance.ps1 │ └── e2evc-aws-cli-create-ec2-instance.ps1 ├── workspaces │ ├── wip_aws-cli-modify-workspace-properties.ps1 │ ├── aws-cli-reboot-workspace.ps1 │ ├── aws-cli-stop-worksapce.ps1 │ ├── aws-cli-rebuild-workspace.ps1 │ ├── aws-cli-start-workspace.ps1 │ ├── aws-cli-terminate-workspace.ps1 │ ├── wip_aws-cli-create-workspace.ps1 │ ├── aws-cli-deregister-workspace-directory.ps1 │ ├── aws-cli-create-tag.ps1 │ ├── aws-cli-delete-tag.ps1 │ ├── aws-cli-register-workspace-directory.ps1 │ ├── aws-cli-modify-workspace-state.ps1 │ ├── aws-cli-migrate-workspace.ps1 │ ├── wip_aws-cli-modify-workspace-creation-properties.ps1 │ └── aws-cli-restore-workspace.ps1 ├── security │ ├── aws-cli-delete-ec2-security-group.ps1 │ ├── wip_aws-cli-create-ec2-security-group.ps1 │ └── aws-cli-authorize-ec2-security-group.ps1 ├── organizations │ └── aws-cli-create-account.ps1 ├── storage │ └── aws-cli-create-s3-bucket.ps1 ├── network │ └── aws-cli-create-subnet.ps1 └── xoap │ └── aws-cli-register-node.ps1 ├── azure-ps ├── avd │ └── stack │ │ ├── Remove-AzWvdHostPool.ps1 │ │ ├── Remove-AzWvdWorkspace.ps1 │ │ ├── Remove-AzResourceGroup.ps1 │ │ ├── Remove-AzWvdScalingPlan.ps1 │ │ ├── Remove-AzWvdApplicationGroup.ps1 │ │ ├── Remove-AzWvdRegistrationInfo.ps1 │ │ ├── Remove-AzWvdApplication.ps1 │ │ ├── Remove-AzWvdMsixPackage.ps1 │ │ ├── Remove-AzWvdSessionHost.ps1 │ │ ├── New-AzWvdRegistrationInfo.ps1 │ │ ├── Register-AzWvdApplicationGroup.ps1 │ │ ├── Unregister-AzWvdApplicationGroup.ps1 │ │ ├── Remove-AzWvdScalingPlanPooledSchedule.ps1 │ │ ├── Remove-AzWvdUserSession.ps1 │ │ ├── Remove-AzWvdScalingPlanPersonalSchedule.ps1 │ │ ├── Remove-AzWvdPrivateEndpointConnection.ps1 │ │ ├── Send-AzWvdUserSessionMessage.ps1 │ │ ├── Update-AzWvdDesktop.ps1 │ │ ├── Update-AzWvdSessionHost.ps1 │ │ ├── Update-AzWvdApplicationGroup.ps1 │ │ ├── Update-AzWvdMsixPackage.ps1 │ │ ├── Set-AzKeyVaultSecret.ps1 │ │ ├── New-AzResourceGroup.ps1 │ │ └── Update-AzWvdWorkspace.ps1 ├── az-ps-install-nginx-linux-vm.ps1 ├── Remove-UnusedImages.ps1 └── az-ps-install-webserver-windows.ps1 ├── azure-cli ├── avd │ ├── az-cli-avd-hostpool-delete.ps1 │ ├── az-cli-avd-hostpool-list.ps1 │ ├── az-cli-avd-workspace-list.ps1 │ ├── az-cli-avd-hostpool-show.ps1 │ ├── az-cli-avd-workspace-show.ps1 │ ├── az-cli-avd-application-group-show.ps1 │ ├── az-cli-avd-hostpool-retrieve-registration-token.ps1 │ ├── az-cli-avd-workspace-delete.ps1 │ ├── az-cli-avd-application-group-list.ps1 │ ├── az-cli-avd-application-group-delete.ps1 │ ├── az-cli-avd-workspace-create.ps1 │ └── todo │ │ └── az-cli-avd-vm-ephemeral-disk-create.ps1 ├── storage │ ├── az-cli-delete-storage-account.ps1 │ └── az-cli-delete-share.ps1 ├── vms │ ├── az-cli-enable-EntraID-login-linux-vm.ps1 │ ├── az-cli-create-image-gallery.ps1 │ ├── az-cli-install-webserver-vm.ps1 │ ├── az-cli-share-image-gallery.ps1 │ ├── az-cli-create-vm-scale-set.ps1 │ └── wip_az-cli-delete-image-builder-linux.ps1 ├── xoap │ └── az-cli-register-node.ps1 └── resource-manager │ └── az-cli-delete-resource-group.ps1 ├── Readme.md └── .gitignore /CODEOWNERS.md: -------------------------------------------------------------------------------- 1 | @ssokolic 2 | @xoap_io -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/reviewers.yml: -------------------------------------------------------------------------------- 1 | reviewers: 2 | defaults: 3 | - repository-owners 4 | - bbrauneck -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # GitHub Copilot persisted chat sessions 5 | /copilot/chatSessions 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "MD029": { 4 | "style": "one" 5 | }, 6 | "MD013": true, 7 | "MD024": false, 8 | "MD034": false, 9 | "no-hard-tabs": true 10 | } 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: "Virtual PowerShell User Group #DSC channel" 4 | url: https://dsccommunity.org/community/contact/ 5 | about: "To talk to the community and maintainers of DSC Community, please visit the #DSC channel." 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/General.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: General question or documentation update 3 | about: If you have a general question or documentation update suggestion around the resource module. 4 | --- 5 | 6 | 9 | -------------------------------------------------------------------------------- /.github/workflows/commit-message-validator.yaml: -------------------------------------------------------------------------------- 1 | name: Commit linter 2 | on: 3 | pull_request: 4 | branches: [main, master] 5 | jobs: 6 | commitlint: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v3 10 | with: 11 | fetch-depth: 0 12 | - uses: wagoid/commitlint-github-action@v5 13 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: github-actions 5 | directory: / 6 | target-branch: dev 7 | schedule: 8 | interval: daily 9 | labels: 10 | - github-actions 11 | - dependencies 12 | - package-ecosystem: terraform 13 | directory: / 14 | target-branch: dev 15 | schedule: 16 | interval: daily 17 | labels: 18 | - terraform 19 | - dependencies 20 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | Feature: 2 | - head-branch: ['^feature', 'feature'] 3 | Hotfix: 4 | - head-branch: ['^hotfix', 'hotfix'] 5 | Documentation: 6 | - changed-files: 7 | - any-glob-to-any-file: '**/*.md' 8 | CICD: 9 | - changed-files: 10 | - any-glob-to-any-file: '.github/**' 11 | 12 | typescript: 13 | - changed-files: 14 | - any-glob-to-any-file: '**/*.ts' 15 | css: 16 | - changed-files: 17 | - any-glob-to-any-file: '**/*.css' 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/workflows/megalinter.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Linting files 3 | on: 4 | pull_request: 5 | branches: [main, master] 6 | concurrency: 7 | group: ${{ github.ref }}-${{ github.workflow }} 8 | cancel-in-progress: true 9 | jobs: 10 | build: 11 | name: MegaLinter 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout Code 15 | uses: actions/checkout@v3 16 | with: 17 | token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} 18 | fetch-depth: 0 19 | -------------------------------------------------------------------------------- /.idea/xoap-powershell-dsc-module-template.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/workflows/dependabot.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Dependabot Pull Request Approve and Merge 3 | on: pull_request_target 4 | permissions: 5 | pull-requests: write 6 | contents: write 7 | jobs: 8 | dependabot: 9 | runs-on: ubuntu-latest 10 | if: ${{ github.actor == 'dependabot[bot]' }} 11 | steps: 12 | - name: Dependabot metadata 13 | id: dependabot-metadata 14 | uses: dependabot/fetch-metadata@v1.6.0 15 | with: 16 | github-token: ${{ secrets.GITHUB_TOKEN }} 17 | - name: Approve a PR 18 | run: gh pr review --approve "$PR_URL" 19 | env: 20 | PR_URL: ${{ github.event.pull_request.html_url }} 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 22 | - name: Enable auto-merge for Dependabot PRs 23 | if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} 24 | run: gh pr merge --auto --squash "$PR_URL" 25 | env: 26 | PR_URL: ${{ github.event.pull_request.html_url }} 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2024 XOAP.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | repos: 3 | - repo: https://github.com/compilerla/conventional-pre-commit 4 | rev: v2.4.0 5 | hooks: 6 | - id: conventional-pre-commit 7 | stages: [commit-msg] 8 | args: [] 9 | - repo: https://github.com/pre-commit/pre-commit-hooks 10 | rev: v4.4.0 11 | hooks: 12 | - id: trailing-whitespace 13 | - id: end-of-file-fixer 14 | - id: check-yaml 15 | - id: check-added-large-files 16 | - id: check-builtin-literals 17 | - id: fix-byte-order-marker 18 | - id: check-json 19 | - id: check-xml 20 | - id: check-yaml 21 | - id: check-merge-conflict 22 | - id: check-shebang-scripts-are-executable 23 | - id: check-symlinks 24 | - id: mixed-line-ending 25 | - id: detect-private-key 26 | - id: no-commit-to-branch 27 | args: 28 | - -b master 29 | - id: no-commit-to-branch 30 | args: 31 | - -b main 32 | - repo: https://github.com/sirosen/check-jsonschema 33 | rev: 0.27.0 34 | hooks: 35 | - id: check-github-workflows 36 | - repo: https://github.com/pre-commit/mirrors-prettier 37 | rev: v3.0.3 38 | hooks: 39 | - id: prettier 40 | stages: [commit] 41 | -------------------------------------------------------------------------------- /.github/workflows/labelling.yaml: -------------------------------------------------------------------------------- 1 | name: label PRs 2 | on: 3 | pull_request: 4 | branches: [dev, master] 5 | jobs: 6 | size-label: 7 | needs: pr-reviewer 8 | permissions: 9 | contents: read 10 | pull-requests: write 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: size-label 14 | uses: "pascalgn/size-label-action@v0.5.0" 15 | env: 16 | GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 17 | with: 18 | sizes: > 19 | { 20 | "0": "XS", 21 | "20": "S", 22 | "50": "M", 23 | "200": "L", 24 | "800": "XL", 25 | "2000": "XXL" 26 | } 27 | - name: general-labels 28 | uses: actions/labeler@v5 29 | with: 30 | sync-labels: true 31 | pr-reviewer: 32 | permissions: 33 | contents: read 34 | pull-requests: write 35 | runs-on: ubuntu-latest 36 | steps: 37 | - name: Checkout 38 | uses: actions/checkout@v3 39 | with: 40 | token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} 41 | fetch-depth: 0 42 | - name: Request review and assign 43 | uses: necojackarc/auto-request-review@v0.13.0 44 | with: 45 | token: ${{ secrets.GITHUB_TOKEN }} 46 | config: .github/reviewers.yml 47 | use_local: true 48 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. 4 | 5 | Fixes # (issue) 6 | 7 | ## Type of change 8 | 9 | Please delete options that are not relevant. 10 | 11 | - [ ] Bug fix (non-breaking change which fixes an issue) 12 | - [ ] New feature (non-breaking change which adds functionality) 13 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 14 | - [ ] This change requires a documentation update 15 | 16 | # How Has This Been Tested? 17 | 18 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration 19 | 20 | - [ ] Test A 21 | - [ ] Test B 22 | 23 | 24 | # Checklist: 25 | 26 | - [ ] My code follows the style guidelines of this project 27 | - [ ] I have performed a self-review of my code 28 | - [ ] I have commented my code, particularly in hard-to-understand areas 29 | - [ ] I have made corresponding changes to the documentation 30 | - [ ] My changes generate no new warnings 31 | - [ ] I have added tests or screenshots that prove my fix is effective or that my feature works 32 | - [ ] Any dependent changes have been merged and published in downstream modules 33 | 34 | -------------------------------------------------------------------------------- /aws-ps/connect/wip_set-awscredential.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Short description 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .NOTES 9 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 10 | The use of the scripts does not require XOAP, but it will make your life easier. 11 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 12 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 13 | the use and the consequences of the use of this freely available script. 14 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 15 | 16 | .COMPONENT 17 | 18 | 19 | .LINK 20 | https://github.com/xoap-io/scripted-actions 21 | 22 | .PARAMETER AzResourceGroup 23 | Defines the name of the Azure Resource Group. 24 | 25 | #> 26 | [CmdletBinding()] 27 | param( 28 | [Parameter(Mandatory)] 29 | [string]$AzResourceGroup 30 | ) 31 | 32 | #Set Error Action to Silently Continue 33 | $ErrorActionPreference = "Stop" 34 | 35 | # Add your code here... 36 | 37 | 38 | Set-AWSCredential -SourceProfile sourceAccountProfile -RoleArn arn:aws:iam::123456789012:role/my_role -ExternalId idValue -StoreAs myRoleProfile 39 | 40 | New-AWSCredential ` 41 | -ExternalID ` 42 | -RoleArn 43 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Security 2 | 3 | XOAP takes the security of our modules seriously, which includes all source code repositories managed through our GitHub organization. 4 | 5 | If you believe you have found a security vulnerability in any XOAP owned repository, please report it to us as described below. 6 | 7 | ## Reporting Security Issues 8 | 9 | **Please do not report security vulnerabilities through public GitHub issues.** 10 | 11 | Instead, please report them to one or several members of the XOAP organization. 12 | The easiest way to do so is to send us a direct message via Twitter. 13 | 14 | You should receive a response within 48 hours. If for some reason you do not, please follow up to other members of the community. 15 | 16 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 17 | 18 | - Type of issue 19 | - Full paths of source file(s) related to the manifestation of the issue 20 | - The location of the affected source code (tag/branch/commit or direct URL) 21 | - Any special configuration required to reproduce the issue 22 | - Step-by-step instructions to reproduce the issue 23 | - Proof-of-concept or exploit code (if possible) 24 | - Impact of the issue, including how an attacker might exploit the issue 25 | 26 | This information will help us triage your report more quickly. 27 | 28 | ## Preferred Languages 29 | 30 | We prefer all communications to be in English. 31 | -------------------------------------------------------------------------------- /aws-cli/ec2/aws-cli-stop-instance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Stop an AWS EC2 instance. 4 | 5 | .DESCRIPTION 6 | This script stops an AWS EC2 instance. The script uses the following AWS CLI command: 7 | aws ec2 stop-instances --instance-ids $AwsInstanceId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsInstanceId 28 | Defines the ID of the AWS EC2 instance. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsInstanceId = "myInstanceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws ec2 stop-instances ` 41 | --instance-ids $AwsInstanceId 42 | -------------------------------------------------------------------------------- /aws-cli/workspaces/wip_aws-cli-modify-workspace-properties.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Short description 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .NOTES 9 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 10 | The use of the scripts does not require XOAP, but it will make your life easier. 11 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 12 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 13 | the use and the consequences of the use of this freely available script. 14 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 15 | 16 | .COMPONENT 17 | 18 | 19 | .LINK 20 | https://github.com/xoap-io/scripted-actions 21 | 22 | .PARAMETER AzResourceGroup 23 | Defines the name of the Azure Resource Group. 24 | 25 | #> 26 | [CmdletBinding()] 27 | param( 28 | [Parameter(Mandatory)] 29 | [string]$AzResourceGroup 30 | ) 31 | 32 | #Set Error Action to Silently Continue 33 | $ErrorActionPreference = "Stop" 34 | 35 | # Add your code here... 36 | 37 | 38 | aws workspaces modify-workspace-properties ` 39 | --workspace-id ws-dk1xzr417 ` 40 | --workspace-properties RunningMode=string,RunningModeAutoStopTimeoutInMinutes=integer,RootVolumeSizeGib=integer,UserVolumeSizeGib=integer,ComputeTypeName=string,Protocols=string,string,OperatingSystemName=string 41 | -------------------------------------------------------------------------------- /aws-cli/ec2/aws-cli-start-instance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Start an AWS EC2 instance. 4 | 5 | .DESCRIPTION 6 | This script starts an AWS EC2 instance. The script uses the following AWS CLI command: 7 | aws ec2 start-instances --instance-ids $AwsInstanceId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsInstanceId 28 | Defines the ID of the AWS EC2 instance. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsInstanceId = "myInstanceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | 41 | aws ec2 start-instances ` 42 | --instance-ids $AwsInstanceId 43 | -------------------------------------------------------------------------------- /aws-cli/ec2/aws-cli-terminate-instance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Terminate an AWS EC2 instance. 4 | 5 | .DESCRIPTION 6 | This script terminates an AWS EC2 instance. The script uses the following AWS CLI command: 7 | aws ec2 terminate-instances --instance-ids $AwsInstanceId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsInstanceId 28 | Defines the ID of the AWS EC2 instance. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsInstanceId = "myInstanceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws ec2 terminate-instances ` 41 | --instance-ids $AwsInstanceId 42 | -------------------------------------------------------------------------------- /aws-ps/workspaces/aws-ps-reboot-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script reboots an AWS WorkSpace. 4 | 5 | .DESCRIPTION 6 | This script reboots an AWS WorkSpace. 7 | The script uses the AWS PowerShell module to reboot the specified AWS WorkSpace. 8 | The script uses the following AWS PowerShell command: 9 | Restart-WKSWorkspace -WorkspaceId $AwsWorkspaceId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS PowerShell 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | The ID of the WorkSpace to reboot. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsWorkspaceId = "myWorkspaceId" 35 | ) 36 | 37 | #Set Error Action to Stop 38 | $ErrorActionPreference = "Stop" 39 | 40 | Restart-WKSWorkspace -WorkspaceId $AwsWorkspaceId 41 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-reboot-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script reboots an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script reboots an AWS Workspace. 7 | The script uses the AWS CLI to reboot the specified AWS Workspace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces reboot-workspaces --reboot-workspace-requests $AwsWorkspaceId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | Defines the ID of the AWS Workspace. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsWorkspaceId = "myWorkspaceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws workspaces reboot-workspaces ` 41 | --reboot-workspace-requests $AwsWorkspaceId 42 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-stop-worksapce.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script stops an AWS WorkSpace. 4 | 5 | .DESCRIPTION 6 | This script stops an AWS WorkSpace. 7 | The script uses the AWS CLI to stop the specified AWS WorkSpace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces stop-workspaces --stop-workspace-requests WorkspaceId=$AwsWorkspaceId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | The ID of the WorkSpace to stop. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AzResourceGroup = "myResourceGroup" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws workspaces stop-workspaces ` 41 | --stop-workspace-requests WorkspaceId=$AwsWorkspaceId 42 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-rebuild-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script rebuilds an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script rebuilds an AWS Workspace. 7 | The script uses the AWS CLI to rebuild the specified AWS Workspace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces rebuild-workspaces --rebuild-workspace-requests $AwsWorkspaceId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | Defines the ID of the AWS Workspace. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsWorkspaceId = "myWorkspaceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws workspaces rebuild-workspaces ` 41 | --rebuild-workspace-requests $AwsWorkspaceId 42 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-start-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script starts an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script starts an AWS Workspace. 7 | The script uses the AWS CLI to start the specified AWS Workspace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces start-workspaces --start-workspace-requests WorkspaceId=$AwsWorkspaceId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | Defines the ID of the AWS Workspace. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsWorkspaceId = "myWorkspaceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws workspaces start-workspaces ` 41 | --start-workspace-requests WorkspaceId=$AwsWorkspaceId 42 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-terminate-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script terminates an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script terminates an AWS Workspace. 7 | The script uses the AWS CLI to terminate the specified AWS Workspace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces terminate-workspaces --terminate-workspace-requests $AwsWorkspaceId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | Defines the ID of the AWS Workspace. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsWorkspaceId = "myWorkspaceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws workspaces terminate-workspaces ` 41 | --terminate-workspace-requests $AwsWorkspaceId -------------------------------------------------------------------------------- /aws-cli/workspaces/wip_aws-cli-create-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Short description 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .NOTES 9 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 10 | The use of the scripts does not require XOAP, but it will make your life easier. 11 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 12 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 13 | the use and the consequences of the use of this freely available script. 14 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 15 | 16 | .COMPONENT 17 | 18 | 19 | .LINK 20 | https://github.com/xoap-io/scripted-actions 21 | 22 | .PARAMETER AzResourceGroup 23 | Defines the name of the Azure Resource Group. 24 | 25 | #> 26 | [CmdletBinding()] 27 | param( 28 | [Parameter(Mandatory)] 29 | [string]$AzResourceGroup = 'myResourceGroup' 30 | ) 31 | 32 | #Set Error Action to Silently Continue 33 | $ErrorActionPreference = "Stop" 34 | 35 | aws workspaces create-workspaces ` 36 | --workspaces "DirectoryId=string,UserName=string,BundleId=string,VolumeEncryptionKey=string,UserVolumeEncryptionEnabled=boolean,RootVolumeEncryptionEnabled=boolean,WorkspaceProperties={RunningMode=string,RunningModeAutoStopTimeoutInMinutes=integer,RootVolumeSizeGib=integer,UserVolumeSizeGib=integer,ComputeTypeName=string,Protocols=[string,string],OperatingSystemName=string},Tags=[{Key=string,Value=string},{Key=string,Value=string}],WorkspaceName=string" 37 | -------------------------------------------------------------------------------- /aws-cli/security/aws-cli-delete-ec2-security-group.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete an AWS Security Group. 4 | 5 | .DESCRIPTION 6 | This script deletes an AWS Security Group. 7 | 8 | The script uses the AWS CLI to delete the specified AWS Security Group. 9 | 10 | The script uses the following AWS CLI command: 11 | aws ec2 delete-security-group ` 12 | --group-id $AwsSecurityGroupId 13 | 14 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 15 | 16 | It does not return any output. 17 | 18 | .NOTES 19 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 20 | The use of the scripts does not require XOAP, but it will make your life easier. 21 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 22 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 23 | the use and the consequences of the use of this freely available script. 24 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 25 | 26 | .COMPONENT 27 | AWS CLI 28 | 29 | .LINK 30 | https://github.com/xoap-io/scripted-actions 31 | 32 | .PARAMETER AwsSecurityGroupId 33 | Defines the ID of the AWS Security Group. 34 | 35 | #> 36 | [CmdletBinding()] 37 | param( 38 | [Parameter(Mandatory)] 39 | [string]$AwsSecurityGroupId = "mySecurityGroupId" 40 | ) 41 | 42 | #Set Error Action to Silently Continue 43 | $ErrorActionPreference = "Stop" 44 | 45 | aws ec2 delete-security-group ` 46 | --group-id $AwsSecurityGroupId 47 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-deregister-workspace-directory.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Deregister an AWS Directory from Workspaces. 4 | 5 | .DESCRIPTION 6 | This script deregisters an AWS Directory from Workspaces. 7 | The script uses the AWS CLI to deregister the specified AWS Directory from Workspaces. 8 | The script uses the following AWS CLI command: 9 | aws workspaces deregister-workspace-directory --directory-id $AwsDirectoryId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsDirectoryId 28 | Defines the ID of the AWS Directory. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsDirectoryId = "myDirectoryId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws workspaces deregister-workspace-directory ` 41 | --directory-id $AwsDirectoryId 42 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-create-tag.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Tag an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script tags an AWS Workspace. 7 | The script uses the AWS CLI to tag the specified AWS Workspace. The script uses the following AWS CLI command: 8 | aws workspaces create-tags --resource-id $AwsWorkspaceId --tags $AwsTagSpecifications 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | It does not return any output. 11 | 12 | .NOTES 13 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 14 | The use of the scripts does not require XOAP, but it will make your life easier. 15 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 16 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 17 | the use and the consequences of the use of this freely available script. 18 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 19 | 20 | .COMPONENT 21 | AWS CLI 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .PARAMETER AwsWorkspaceId 27 | Defines the ID of the AWS Workspace. 28 | 29 | .PARAMETER AwsTagSpecifications 30 | Defines the tags for the AWS Workspace. 31 | 32 | #> 33 | [CmdletBinding()] 34 | param( 35 | [Parameter(Mandatory)] 36 | [string]$AwsWorkspaceId = "myWorkspaceId" 37 | ) 38 | 39 | #Set Error Action to Silently Continue 40 | $ErrorActionPreference = "Stop" 41 | 42 | aws workspaces create-tags ` 43 | --resource-id $AwsWorkspaceId ` 44 | --tags $AwsTagSpecifications 45 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-delete-tag.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete tags from an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script deletes tags from an AWS Workspace. 7 | The script uses the AWS CLI to delete the specified tags from the AWS Workspace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces delete-tags --resource-id $AwsWorkspaceId --tag-keys $AwsTagKeys 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | Defines the ID of the AWS Workspace. 29 | 30 | .PARAMETER AwsTagKeys 31 | Defines the keys of the tags to be deleted. 32 | 33 | #> 34 | [CmdletBinding()] 35 | param( 36 | [Parameter(Mandatory)] 37 | [string]$AwsWorkspaceId = "myWorkspaceId" 38 | ) 39 | 40 | #Set Error Action to Silently Continue 41 | $ErrorActionPreference = "Stop" 42 | 43 | aws workspaces delete-tags ` 44 | --resource-id $AwsWorkspaceId ` 45 | --tag-keys $AwsTagKeys 46 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-register-workspace-directory.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script registers a directory with Amazon WorkSpaces. 4 | 5 | .DESCRIPTION 6 | This script registers a directory with Amazon WorkSpaces. You can use this script to enable Amazon WorkDocs for your directory. 7 | The script uses the following AWS CLI command: 8 | aws workspaces register-workspace-directory --directory-id $AwsDirectoryId --no-enable-work-docs 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | It does not return any output. 11 | 12 | .NOTES 13 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 14 | The use of the scripts does not require XOAP, but it will make your life easier. 15 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 16 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 17 | the use and the consequences of the use of this freely available script. 18 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 19 | 20 | .COMPONENT 21 | AWS CLI 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .PARAMETER AwsDirectoryId 27 | The identifier of the directory to register with WorkSpaces. 28 | 29 | #> 30 | [CmdletBinding()] 31 | param( 32 | [Parameter(Mandatory)] 33 | [string]$AwsDirectoryId = "myDirectoryId" 34 | ) 35 | 36 | #Set Error Action to Silently Continue 37 | $ErrorActionPreference = "Stop" 38 | 39 | aws workspaces register-workspace-directory ` 40 | --directory-id $AwsDirectoryId ` 41 | --no-enable-work-docs 42 | -------------------------------------------------------------------------------- /aws-cli/organizations/aws-cli-create-account.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an AWS account. 4 | 5 | .DESCRIPTION 6 | This script creates an AWS account. The script uses the following AWS CLI command: 7 | aws organizations create-account --email $AwsAccountEmail --account-name $AwsAccountName 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsAccountEmail 28 | Defines the email address of the AWS account. 29 | 30 | .PARAMETER AwsAccountName 31 | Defines the name of the AWS account. 32 | 33 | #> 34 | [CmdletBinding()] 35 | param( 36 | [Parameter(Mandatory)] 37 | [string]$AwsAccountEmail = "myEmail", 38 | [Parameter(Mandatory)] 39 | [string]$AwsAccountName = "myAccountName" 40 | ) 41 | 42 | #Set Error Action to Silently Continue 43 | $ErrorActionPreference = "Stop" 44 | 45 | aws organizations create-account ` 46 | --email $AwsAccountEmail ` 47 | --account-name $AwsAccountName 48 | -------------------------------------------------------------------------------- /aws-cli/ec2/aws-cli-allocate-elastic-ip.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script associates an AWS Elastic IP with an EC2 instance. 4 | 5 | .DESCRIPTION 6 | This script associates an AWS Elastic IP with an EC2 instance. The script uses the following AWS CLI command: 7 | aws ec2 associate-address --instance-id $AwsInstanceId --allocation-id $AwsElasticIpId 8 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 9 | 10 | It does not return any output. 11 | 12 | .NOTES 13 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 14 | The use of the scripts does not require XOAP, but it will make your life easier. 15 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 16 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 17 | the use and the consequences of the use of this freely available script. 18 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 19 | 20 | .PARAMETER AwsInstanceId 21 | Defines the ID of the AWS EC2 instance. 22 | 23 | .PARAMETER AwsElasticIpId 24 | Defines the ID of the AWS Elastic IP. 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | AWS CLI 31 | #> 32 | 33 | [CmdletBinding()] 34 | param( 35 | [Parameter(Mandatory)] 36 | [string]$AwsInstanceId, 37 | [Parameter(Mandatory)] 38 | [string]$AwsElasticIpId 39 | ) 40 | 41 | #Set Error Action to Silently Continue 42 | $ErrorActionPreference = "Stop" 43 | 44 | 45 | aws ec2 associate-address ` 46 | --instance-id $AwsInstanceId ` 47 | --allocation-id $AwsElasticIpId 48 | -------------------------------------------------------------------------------- /aws-cli/ec2/aws-cli-create-ec2-key-pair.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an AWS EC2 Key Pair. 4 | 5 | .DESCRIPTION 6 | This script creates an AWS EC2 Key Pair. The script uses the following AWS CLI commands: 7 | aws ec2 create-key-pair --key-name $AwsKeyPairName --query 'KeyMaterial' --output text > MyKeyPair.pem 8 | aws ec2 describe-key-pairs --key-name $AwsKeyPairName 9 | 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | 12 | It does not return any output. 13 | 14 | .NOTES 15 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 16 | The use of the scripts does not require XOAP, but it will make your life easier. 17 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 18 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 19 | the use and the consequences of the use of this freely available script. 20 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 21 | 22 | .COMPONENT 23 | AWS CLI 24 | 25 | .LINK 26 | https://github.com/xoap-io/scripted-actions 27 | 28 | .PARAMETER AwsKeyPairName 29 | Defines the name of the AWS Key Pair. 30 | 31 | #> 32 | [CmdletBinding()] 33 | param( 34 | [Parameter(Mandatory)] 35 | [string]$AwsKeyPairName = "myKeyPair" 36 | ) 37 | 38 | #Set Error Action to Silently Continue 39 | $ErrorActionPreference = "Stop" 40 | 41 | aws ec2 create-key-pair ` 42 | --key-name $AwsKeyPairName ` 43 | --query 'KeyMaterial' ` 44 | --output text > MyKeyPair.pem 45 | 46 | aws ec2 describe-key-pairs ` 47 | --key-name $AwsKeyPairName 48 | -------------------------------------------------------------------------------- /.github/workflows/tagging.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Create tag and release 3 | 4 | on: 5 | push: 6 | branches: 7 | - master 8 | - main 9 | 10 | jobs: 11 | tag: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v3 16 | with: 17 | token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} 18 | fetch-depth: 0 19 | - name: Github Tag with semantic versioning 20 | # You may pin to the exact commit or the version. 21 | # uses: hennejg/github-tag-action@2cd21a8413aa58e36a69cb22e64d5ad20aeb9b99 22 | id: tag_version 23 | uses: hennejg/github-tag-action@v4.4.0 24 | with: 25 | tag_prefix: "" 26 | # Required for permission to tag the repo. 27 | github_token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} 28 | - name: Zip Release 29 | # You may pin to the exact commit or the version. 30 | # uses: TheDoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 31 | id: zip 32 | uses: TheDoctor0/zip-release@0.7.1 33 | with: 34 | type: 'zip' 35 | filename: 'XOAPModuleTemplateDSC_${{ steps.tag_version.outputs.new_tag }}.zip' 36 | exclusions: '*.git* /*License/* CONTRIBUTING.md CODEOWNERS.md CODE_OF_CONDUCT.md .pre-commit.yaml .gitignore .gitattributes .github /templates/* New-CompositeResource.ps1 /test/*' 37 | - name: Create a GitHub release 38 | uses: ncipollo/release-action@v1 39 | with: 40 | artifacts: 'XOAPModuleTemplateDSC_${{ steps.tag_version.outputs.new_tag }}.zip' 41 | tag: ${{ steps.tag_version.outputs.new_tag }} 42 | name: ${{ steps.tag_version.outputs.new_tag }} 43 | body: ${{ steps.tag_version.outputs.changelog }} 44 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdHostPool.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes a host pool from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified host pool from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER Name 9 | The name of the host pool. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .EXAMPLE 15 | PS C:\> .\Remove-AzWvdHostPool.ps1 -Name "MyHostPool" -ResourceGroup "MyResourceGroup" 16 | 17 | .LINK 18 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdhostpool?view=azps-12.2.0 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .COMPONENT 27 | Azure PowerShell 28 | 29 | #> 30 | 31 | [CmdletBinding()] 32 | param ( 33 | [Parameter(Mandatory=$true)] 34 | [ValidateNotNullOrEmpty()] 35 | [string]$Name, 36 | 37 | [Parameter(Mandatory=$true)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$ResourceGroup 40 | ) 41 | 42 | # Splatting parameters for better readability 43 | $parameters = @{ 44 | Name = $Name 45 | ResourceGroup = $ResourceGroup 46 | } 47 | 48 | # Set Error Action to Stop 49 | $ErrorActionPreference = "Stop" 50 | 51 | try { 52 | # Remove the host pool and capture the result 53 | $result = Remove-AzWvdHostPool @parameters 54 | 55 | # Output the result 56 | Write-Output "Host pool removed successfully:" 57 | Write-Output $result 58 | 59 | } catch [System.Exception] { 60 | 61 | Write-Error "Failed to remove the host pool: $($_.Exception.Message)" 62 | 63 | } finally { 64 | # Cleanup code if needed 65 | Write-Output "Script execution completed." 66 | } 67 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdWorkspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes an Azure Virtual Desktop Workspace. 4 | 5 | .DESCRIPTION 6 | This script removes an Azure Virtual Desktop Workspace. 7 | 8 | .PARAMETER Name 9 | The name of the workspace. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .EXAMPLE 15 | PS C:\> .\Remove-AzWvdWorkspace.ps1 -Name "MyWorkspace" -ResourceGroup "MyResourceGroup" 16 | 17 | .LINK 18 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdworkspace?view=azps-12.3.0 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .COMPONENT 27 | Azure PowerShell 28 | 29 | #> 30 | 31 | [CmdletBinding()] 32 | param ( 33 | [Parameter(Mandatory=$true)] 34 | [ValidateNotNullOrEmpty()] 35 | [string]$Name, 36 | 37 | [Parameter(Mandatory=$true)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$ResourceGroup 40 | ) 41 | 42 | # Splatting parameters for better readability 43 | $parameters = @{ 44 | Name = $Name 45 | ResourceGroup = $ResourceGroup 46 | } 47 | 48 | # Set Error Action to Stop 49 | $ErrorActionPreference = "Stop" 50 | 51 | try { 52 | # Remove the Azure Virtual Desktop Workspace and capture the result 53 | $result = Remove-AzWvdWorkspace @parameters 54 | 55 | # Output the result 56 | Write-Output "Azure Virtual Desktop Workspace removed successfully:" 57 | Write-Output $result 58 | 59 | } catch [System.Exception] { 60 | 61 | Write-Error "Failed to remove the Azure Virtual Desktop Workspace: $($_.Exception.Message)" 62 | 63 | } finally { 64 | # Cleanup code if needed 65 | Write-Output "Script execution completed." 66 | } 67 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzResourceGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script deletes an Azure Resource Group with the Azure PowerShell. 4 | 5 | .DESCRIPTION 6 | This script deletes an Azure Resource Group with the Azure PowerShell. The script requires the following parameter: 7 | - AzResourceGroup: Defines the name of the Azure Resource Group. 8 | 9 | The script will delete the Azure Resource Group with all its resources. 10 | 11 | .PARAMETER AzResourceGroup 12 | Defines the name of the Azure Resource Group. 13 | 14 | .EXAMPLE 15 | .\Remove-AzResourceGroup.ps1 -AzResourceGroup "myResourceGroup" 16 | 17 | .LINK 18 | https://learn.microsoft.com/en-us/powershell/module/az.Resources 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.resources/remove-azresourcegroup?view=azps-12.3.0 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .COMPONENT 27 | Azure PowerShell 28 | #> 29 | 30 | [CmdletBinding()] 31 | param( 32 | [Parameter(Mandatory=$true)] 33 | [ValidateNotNullOrEmpty()] 34 | [string]$AzResourceGroup 35 | ) 36 | 37 | # Splatting parameters for better readability 38 | $parameters = @{ 39 | Name = $AzResourceGroup 40 | } 41 | 42 | # Set Error Action to Stop 43 | $ErrorActionPreference = "Stop" 44 | 45 | try { 46 | # Remove the Resource Group 47 | Remove-AzResourceGroup @parameters -Force 48 | 49 | # Output the result 50 | Write-Output "Azure Resource Group '$($ResourceGroup)' deleted successfully." 51 | 52 | } catch { 53 | # Log the error to the console 54 | 55 | Write-Output "Error message $errorMessage" 56 | 57 | 58 | Write-Error "Failed to delete Azure Resource Group: $($_.Exception.Message)" 59 | 60 | } finally { 61 | # Cleanup code if needed 62 | Write-Output "Script execution completed." 63 | } 64 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdScalingPlan.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes a scaling plan from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified scaling plan from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER Name 9 | The name of the scaling plan. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .EXAMPLE 15 | PS C:\> .\Remove-AzWvdScalingPlan.ps1 -Name "MyScalingPlan" -ResourceGroup "MyResourceGroup" 16 | 17 | .LINK 18 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdscalingplan?view=azps-12.3.0 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .COMPONENT 27 | Azure PowerShell 28 | 29 | #> 30 | 31 | [CmdletBinding()] 32 | param ( 33 | [Parameter(Mandatory=$true)] 34 | [ValidateNotNullOrEmpty()] 35 | [string]$Name, 36 | 37 | [Parameter(Mandatory=$true)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$ResourceGroup 40 | ) 41 | 42 | # Splatting parameters for better readability 43 | $parameters = @{ 44 | Name = $Name 45 | ResourceGroup = $ResourceGroup 46 | } 47 | 48 | # Set Error Action to Stop 49 | $ErrorActionPreference = "Stop" 50 | 51 | try { 52 | # Remove the scaling plan and capture the result 53 | $result = Remove-AzWvdScalingPlan @parameters 54 | 55 | # Output the result 56 | Write-Output "Scaling plan removed successfully:" 57 | Write-Output $result 58 | 59 | } catch [System.Exception] { 60 | 61 | Write-Error "Failed to remove the scaling plan: $($_.Exception.Message)" 62 | 63 | } finally { 64 | # Cleanup code if needed 65 | Write-Output "Script execution completed." 66 | } 67 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Resource_proposal.yml: -------------------------------------------------------------------------------- 1 | name: New resource proposal 2 | description: If you have a new resource proposal that you think should be added to this resource module. 3 | title: "NewResourceName: New resource proposal" 4 | labels: [] 5 | assignees: [] 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Please replace `NewResourceName` in the issue title (above) with your proposed resource name. 11 | 12 | Thank you for contributing and making this resource module better! 13 | - type: textarea 14 | id: description 15 | attributes: 16 | label: Resource proposal 17 | description: Provide information how this resource will/should work and how it will help users. 18 | validations: 19 | required: true 20 | - type: textarea 21 | id: proposedProperties 22 | attributes: 23 | label: Proposed properties 24 | description: | 25 | List all the proposed properties that the resource should have (key, required, write, and/or read). For each property provide a detailed description, the data type, if a default value should be used, and if the property is limited to a set of values. 26 | value: | 27 | Property | Type qualifier | Data type | Description | Default value | Allowed values 28 | --- | --- | --- | --- | --- | --- 29 | PropertyName | Key | String | Detailed description | None | None 30 | validations: 31 | required: true 32 | - type: textarea 33 | id: considerations 34 | attributes: 35 | label: Special considerations or limitations 36 | description: | 37 | Provide any considerations or limitations you can think of that a contributor should take in account when coding the proposed resource, and or what limitations a user will encounter or should consider when using the proposed resource. 38 | validations: 39 | required: true 40 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdApplicationGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | emoves an application group from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified application group from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER Name 9 | The name of the application group. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .EXAMPLE 15 | PS C:\> .\Remove-AzWvdApplicationGroup.ps1 -Name "MyAppGroup" -ResourceGroup "MyResourceGroup" 16 | 17 | .LINK 18 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdapplicationgroup?view=azps-12.2.0 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .COMPONENT 27 | Azure PowerShell 28 | 29 | #> 30 | 31 | [CmdletBinding()] 32 | param ( 33 | [Parameter(Mandatory=$true)] 34 | [ValidateNotNullOrEmpty()] 35 | [string]$Name, 36 | 37 | [Parameter(Mandatory=$true)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$ResourceGroup 40 | ) 41 | 42 | # Splatting parameters for better readability 43 | $parameters = @{ 44 | Name = $Name 45 | ResourceGroup = $ResourceGroup 46 | } 47 | 48 | # Set Error Action to Stop 49 | $ErrorActionPreference = "Stop" 50 | 51 | try { 52 | # Remove the application group and capture the result 53 | $result = Remove-AzWvdApplicationGroup @parameters 54 | 55 | # Output the result 56 | Write-Output "Application group removed successfully:" 57 | Write-Output $result 58 | 59 | } catch [System.Exception] { 60 | 61 | Write-Error "Failed to remove the application group: $($_.Exception.Message)" 62 | 63 | } finally { 64 | # Cleanup code if needed 65 | Write-Output "Script execution completed." 66 | } 67 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-modify-workspace-state.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script modifies the state of an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script modifies the state of an AWS Workspace. 7 | The script uses the AWS CLI to modify the state of the specified AWS Workspace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces modify-workspace-state --workspace-id $AwsWorkspaceId --workspace-state $AWsWorkspaceState 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | Defines the ID of the AWS Workspace. 29 | 30 | .PARAMETER AWsWorkspaceState 31 | Defines the state of the AWS Workspace. 32 | 33 | #> 34 | [CmdletBinding()] 35 | param( 36 | [Parameter(Mandatory)] 37 | [string]$AwsWorkspaceId = "myWorkspaceId", 38 | [Parameter(Mandatory)] 39 | [string]$AWsWorkspaceState = "myWorkspaceState" 40 | ) 41 | 42 | #Set Error Action to Silently Continue 43 | $ErrorActionPreference = "Stop" 44 | 45 | aws workspaces modify-workspace-state ` 46 | --workspace-id $AwsWorkspaceId ` 47 | --workspace-state $AWsWorkspaceState 48 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdRegistrationInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes registration information from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes the specified registration information from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER ResourceGroup 9 | The name of the resource group. 10 | 11 | .PARAMETER HostPoolName 12 | The name of the host pool. 13 | 14 | .EXAMPLE 15 | PS C:\> .\Remove-AzWvdRegistrationInfo.ps1 -ResourceGroup "MyResourceGroup" -HostPoolName "MyHostPool" 16 | 17 | .LINK 18 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdregistrationinfo?view=azps-12.3.0 22 | 23 | .LINK 24 | https://github.com/xoap-io/scripted-actions 25 | 26 | .COMPONENT 27 | Azure PowerShell 28 | 29 | #> 30 | 31 | [CmdletBinding()] 32 | param ( 33 | [Parameter(Mandatory=$true)] 34 | [ValidateNotNullOrEmpty()] 35 | [string]$ResourceGroup, 36 | 37 | [Parameter(Mandatory=$true)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$HostPoolName 40 | ) 41 | 42 | # Splatting parameters for better readability 43 | $parameters = @{ 44 | ResourceGroup = $ResourceGroup 45 | HostPoolName = $HostPoolName 46 | } 47 | 48 | # Set Error Action to Stop 49 | $ErrorActionPreference = "Stop" 50 | 51 | try { 52 | # Remove the registration information and capture the result 53 | $result = Remove-AzWvdRegistrationInfo @parameters 54 | 55 | # Output the result 56 | Write-Output "Registration information removed successfully:" 57 | Write-Output $result 58 | 59 | } catch [System.Exception] { 60 | 61 | Write-Error "Failed to remove the registration information: $($_.Exception.Message)" 62 | 63 | } finally { 64 | # Cleanup code if needed 65 | Write-Output "Script execution completed." 66 | } 67 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-migrate-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Migrate an AWS WorkSpace to a different bundle. 4 | 5 | .DESCRIPTION 6 | This script migrates an AWS WorkSpace to a different bundle. 7 | The script uses the AWS CLI to migrate the specified AWS WorkSpace to a different bundle. 8 | The script uses the following AWS CLI command: 9 | aws workspaces migrate-workspace --source-workspace-id $AwsSourceWorkspaceId --bundle-id $AwsWorkspaceBundleId 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsSourceWorkspaceId 28 | Defines the ID of the AWS WorkSpace to migrate. 29 | 30 | .PARAMETER AwsWorkspaceBundleId 31 | Defines the ID of the AWS WorkSpace bundle to migrate to. 32 | 33 | #> 34 | [CmdletBinding()] 35 | param( 36 | [Parameter(Mandatory)] 37 | [string]$AwsSourceWorkspaceId = "myWorkspaceId", 38 | [Parameter(Mandatory)] 39 | [string]$AwsWorkspaceBundleId = "myWorkspaceBundleId" 40 | ) 41 | 42 | #Set Error Action to Silently Continue 43 | $ErrorActionPreference = "Stop" 44 | 45 | aws workspaces migrate-workspace ` 46 | --source-workspace-id $AwsSourceWorkspaceId ` 47 | --bundle-id $AwsWorkspaceBundleId ` 48 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-hostpool-delete.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete an Azure Virtual Desktop Host Pool with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script deletes an Azure Virtual Desktop Host Pool with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization hostpool delete --name $AzHostPoolName --resource-group $AzResourceGroup 9 | 10 | .EXAMPLE 11 | .\az-cli-avd-hostpool-delete.ps1 -AzHostPoolName "MyHostPool" -AzResourceGroup "MyResourceGroup" 12 | 13 | 14 | .LINK 15 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/hostpool 16 | #> 17 | 18 | [CmdletBinding()] 19 | param( 20 | [Parameter(Mandatory=$true)] 21 | [ValidateNotNullOrEmpty()] 22 | [string]$Force, 23 | 24 | [Parameter(Mandatory=$true)] 25 | [ValidateNotNullOrEmpty()] 26 | [string]$IDs, 27 | 28 | [Parameter(Mandatory=$true)] 29 | [ValidateNotNullOrEmpty()] 30 | [string]$Name, 31 | 32 | [Parameter(Mandatory=$true)] 33 | [ValidateNotNullOrEmpty()] 34 | [string]$ResourceGroup, 35 | 36 | [Parameter(Mandatory=$false)] 37 | [ValidateNotNullOrEmpty()] 38 | [switch]$Yes 39 | ) 40 | 41 | # Splatting parameters for better readability 42 | $parameters = ` 43 | '--force', $Force 44 | '--ids', $Ids 45 | '--name', $HostPoolName 46 | '--resource-group', $AesourceGroup 47 | '--subscription', $Subscription 48 | '--yes', $Yes 49 | 50 | # Set Error Action to Stop 51 | $ErrorActionPreference = "Stop" 52 | 53 | try { 54 | # Delete the Azure Virtual Desktop Host Pool 55 | az desktopvirtualization hostpool delete @parameters 56 | 57 | # Output the result 58 | Write-Output "Azure Virtual Desktop Host Pool deleted successfully." 59 | 60 | } catch { 61 | # Log the error to the console 62 | Write-Output "Error message $errorMessage" 63 | Write-Error "Failed to delete the Azure Virtual Desktop Host Pool: $($_.Exception.Message)" 64 | 65 | } finally { 66 | # Cleanup code if needed 67 | Write-Output "Script execution completed." 68 | } 69 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdApplication.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes an application from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified application from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER GroupName 9 | The name of the application group. 10 | 11 | .PARAMETER Name 12 | The name of the application. 13 | 14 | .PARAMETER ResourceGroup 15 | The name of the resource group. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Remove-AzWvdApplication.ps1 -GroupName "MyAppGroup" -Name "MyApp" -ResourceGroup "MyResourceGroup" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdapplication?view=azps-12.3.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$GroupName, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$Name, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ResourceGroup 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | GroupName = $GroupName 52 | Name = $Name 53 | ResourceGroup = $ResourceGroup 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Remove the application and capture the result 61 | $result = Remove-AzWvdApplication @parameters 62 | 63 | # Output the result 64 | Write-Output "Application removed successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to remove the application: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /aws-cli/storage/aws-cli-create-s3-bucket.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create an AWS S3 Bucket. 4 | 5 | .DESCRIPTION 6 | This script creates an AWS S3 Bucket. 7 | The script uses the AWS CLI to create the specified AWS S3 Bucket. 8 | The script uses the following AWS CLI command: 9 | aws s3api create-bucket --bucket $AwsBucketName --region $AwsBucketRegion 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsBucketName 28 | Defines the name of the AWS S3 Bucket. 29 | 30 | .PARAMETER AwsBucketRegion 31 | Defines the region of the AWS S3 Bucket. 32 | 33 | #> 34 | [CmdletBinding()] 35 | param( 36 | [Parameter(Mandatory)] 37 | [string]$AwsBucketName = "myBucketName", 38 | [Parameter(Mandatory)] 39 | [ValidateSet('af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-southeast-1','ap-southeast-2','ca-central-1','eu-central-1','eu-north-1','eu-south-1','eu-west-1','eu-west-2','eu-west-3','me-south-1','sa-east-1','us-east-1','us-east-2','us-west-1','us-west-2')] 40 | [string]$AwsBucketRegion = "" 41 | ) 42 | 43 | #Set Error Action to Silently Continue 44 | $ErrorActionPreference = "Stop" 45 | 46 | aws s3api create-bucket ` 47 | --bucket $AwsBucketName ` 48 | --region $AwsBucketRegion 49 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdMsixPackage.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes an MSIX package from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified MSIX package from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER FullName 9 | The full name of the MSIX package. 10 | 11 | .PARAMETER HostPoolName 12 | The name of the host pool. 13 | 14 | .PARAMETER ResourceGroup 15 | The name of the resource group. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Remove-AzWvdMsixPackage.ps1 -FullName "MyMsixPackage" -HostPoolName "MyHostPool" -ResourceGroup "MyResourceGroup" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdmsixpackage?view=azps-12.3.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$FullName, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$HostPoolName, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ResourceGroup 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | FullName = $FullName 52 | HostPoolName = $HostPoolName 53 | ResourceGroup = $ResourceGroup 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Remove the MSIX package and capture the result 61 | $result = Remove-AzWvdMsixPackage @parameters 62 | 63 | # Output the result 64 | Write-Output "MSIX package removed successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to remove the MSIX package: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdSessionHost.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes an Azure Virtual Desktop Session Host. 4 | 5 | .DESCRIPTION 6 | This script removes a specified session host from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER HostPoolName 9 | The name of the host pool. 10 | 11 | .PARAMETER Name 12 | The name of the session host. 13 | 14 | .PARAMETER ResourceGroup 15 | The name of the resource group. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Remove-AzWvdSessionHost.ps1 -HostPoolName "MyHostPool" -Name "MySessionHost" -ResourceGroup "MyResourceGroup" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdsessionhost?view=azps-12.3.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$HostPoolName, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$Name, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ResourceGroup 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | HostPoolName = $HostPoolName 52 | Name = $Name 53 | ResourceGroup = $ResourceGroup 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Remove the Azure Virtual Desktop Session Host and capture the result 61 | $result = Remove-AzWvdSessionHost @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop Session Host removed successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to remove the Azure Virtual Desktop Session Host: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /aws-cli/workspaces/wip_aws-cli-modify-workspace-creation-properties.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script modifies the creation properties of an AWS Workspace. 4 | 5 | .DESCRIPTION 6 | This script modifies the creation properties of an AWS Workspace. 7 | The script uses the AWS CLI to modify the creation properties of the specified AWS Workspace. 8 | The script uses the following AWS CLI command: 9 | aws workspaces modify-workspace-creation-properties --resource-id $AwsWorkspaceId --workspace-creation-properties EnableWorkDocs=boolean,EnableInternetAccess=boolean,DefaultOu=string,CustomSecurityGroupId=string,UserEnabledAsLocalAdministrator=boolean,EnableMaintenanceMode=boolean 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceId 28 | Defines the ID of the AWS Workspace. 29 | 30 | #> 31 | [CmdletBinding()] 32 | param( 33 | [Parameter(Mandatory)] 34 | [string]$AwsWorkspaceId = "myWorkspaceId" 35 | ) 36 | 37 | #Set Error Action to Silently Continue 38 | $ErrorActionPreference = "Stop" 39 | 40 | aws workspaces modify-workspace-creation-properties ` 41 | --resource-id $AwsWorkspaceId ` 42 | --workspace-creation-properties EnableWorkDocs=boolean,EnableInternetAccess=boolean,DefaultOu=string,CustomSecurityGroupId=string,UserEnabledAsLocalAdministrator=boolean,EnableMaintenanceMode=boolean 43 | -------------------------------------------------------------------------------- /aws-cli/workspaces/aws-cli-restore-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script restores an Amazon WorkSpace that has been terminated. 4 | 5 | .DESCRIPTION 6 | This script restores an Amazon WorkSpace that has been terminated. The WorkSpace is restored to the state it was in when the last snapshot was taken. 7 | 8 | The script requires the AWS CLI to be installed and configured. The script uses the AWS CLI command restore-workspace to restore the WorkSpace. 9 | 10 | The script requires the WorkSpace ID as a parameter. The WorkSpace ID can be found in the AWS Management Console or by using the AWS CLI command describe-workspaces. 11 | 12 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. If an error occurs, the script will not display an error message, but the error will be written to the error stream. 13 | 14 | The script does not return any output. If the WorkSpace is successfully restored, the script will not display any output. If an error occurs, the error will be written to the error stream. 15 | 16 | .NOTES 17 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 18 | The use of the scripts does not require XOAP, but it will make your life easier. 19 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 20 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 21 | the use and the consequences of the use of this freely available script. 22 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 23 | 24 | .COMPONENT 25 | AWS CLI 26 | 27 | .LINK 28 | https://github.com/xoap-io/scripted-actions 29 | 30 | .PARAMETER AwsWorkspaceId 31 | The ID of the WorkSpace to restore. 32 | 33 | #> 34 | [CmdletBinding()] 35 | param( 36 | [Parameter(Mandatory)] 37 | [string]$AwsWorkspaceId = "myWorkspaceId" 38 | ) 39 | 40 | #Set Error Action to Silently Continue 41 | $ErrorActionPreference = "Stop" 42 | 43 | aws workspaces restore-workspace ` 44 | --workspace-id $AwsWorkspaceId 45 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/New-AzWvdRegistrationInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new registration info in an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script creates a new registration info in an Azure Virtual Desktop environment with the specified parameters. 7 | 8 | .PARAMETER ResourceGroup 9 | The name of the resource group. 10 | 11 | .PARAMETER HostPoolName 12 | The name of the host pool. 13 | 14 | .PARAMETER ExpirationTime 15 | The expiration time for the registration info. 16 | 17 | .EXAMPLE 18 | PS C:\> .\New-AzWvdRegistrationInfo.ps1 -ResourceGroup "MyResourceGroup" -HostPoolName "MyHostPool" -ExpirationTime "2023-12-31T23:59:59Z" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/new-azwvdregistrationinfo?view=azps-12.3.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$ResourceGroup, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$HostPoolName, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ExpirationTime 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | ResourceGroup = $ResourceGroup 52 | HostPoolName = $HostPoolName 53 | ExpirationTime = $ExpirationTime 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Create the registration info and capture the result 61 | $result = New-AzWvdRegistrationInfo @parameters 62 | 63 | # Output the result 64 | Write-Output "Registration info created successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to create the registration info: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-hostpool-list.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | List Azure Virtual Desktop Host Pools with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script lists Azure Virtual Desktop Host Pools with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization hostpool list --resource-group $AzResourceGroup 9 | 10 | .PARAMETER MaxItems 11 | Maximum number of items to return. 12 | 13 | .PARAMETER NextToken 14 | Token to retrieve the next page of results. 15 | 16 | .PARAMETER ResourceGroup 17 | Defines the name of the Azure Resource Group. 18 | 19 | .EXAMPLE 20 | .\az-cli-avd-hostpool-list.ps1 -AzResourceGroup "MyResourceGroup" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/hostpool 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/hostpool?view=azure-cli-latest 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure CLI 33 | #> 34 | 35 | [CmdletBinding()] 36 | param( 37 | [Parameter(Mandatory=$false)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$MaxItems, 40 | 41 | [Parameter(Mandatory=$false)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$NextToken, 44 | 45 | [Parameter(Mandatory=$false)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$ResourceGroup 48 | ) 49 | 50 | # Splatting parameters for better readability 51 | $parameters = ` 52 | '--max-items', $MaxItems 53 | '--next-token', $NextToken 54 | '--resource-group', $ResourceGroup 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # List Azure Virtual Desktop Host Pools 61 | az desktopvirtualization hostpool list @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop Host Pools listed successfully." 65 | 66 | } catch { 67 | # Log the error to the console 68 | Write-Output "Error message $errorMessage" 69 | Write-Error "Failed to list the Azure Virtual Desktop Host Pools: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-workspace-list.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | List Azure Virtual Desktop workspaces with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script lists Azure Virtual Desktop workspaces with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization workspace list --resource-group $AzResourceGroup 9 | 10 | .PARAMETER MaxItems 11 | Maximum number of items to return. 12 | 13 | .PARAMETER NextToken 14 | Token to retrieve the next page of results. 15 | 16 | .PARAMETER ResourceGroup 17 | Defines the name of the Azure Resource Group. 18 | 19 | .EXAMPLE 20 | .\az-cli-avd-workspace-list.ps1 -ResourceGroup "MyResourceGroup" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace?view=azure-cli-latest 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure CLI 33 | #> 34 | 35 | [CmdletBinding()] 36 | param( 37 | [Parameter(Mandatory=$false)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$MaxItems, 40 | 41 | [Parameter(Mandatory=$false)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$NextToken, 44 | 45 | [Parameter(Mandatory=$false)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$ResourceGroup 48 | ) 49 | 50 | # Splatting parameters for better readability 51 | $parameters = ` 52 | '--max-items', $MaxItems 53 | '--next-token', $NextToken 54 | '--resource-group', $ResourceGroup 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # List Azure Virtual Desktop workspaces 61 | az desktopvirtualization workspace list @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop workspaces listed successfully." 65 | 66 | } catch { 67 | # Log the error to the console 68 | Write-Output "Error message $errorMessage" 69 | Write-Error "Failed to list the Azure Virtual Desktop workspaces: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /aws-ps/workspaces/aws-ps-create-workspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an AWS WorkSpace. 4 | 5 | .DESCRIPTION 6 | This script creates an AWS WorkSpace. 7 | The script uses the AWS PowerShell module to create the specified AWS WorkSpace. 8 | The script uses the following AWS PowerShell command: 9 | New-WKSWorkspace -Workspace @{"BundleID" = $AwsWorkspaceBundleIdBundleId; "DirectoryId" = $AwsWorkspaceDirectoryId; "UserName" = $AwsWorkspaceUserName} 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS PowerShell 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsWorkspaceBundleIdBundleId 28 | The identifier of the bundle to create the WorkSpace from. 29 | 30 | .PARAMETER AwsWorkspaceDirectoryId 31 | The identifier of the directory for the WorkSpace. 32 | 33 | .PARAMETER AwsWorkspaceUserName 34 | The user name of the user for the WorkSpace. 35 | #> 36 | [CmdletBinding()] 37 | param( 38 | [Parameter(Mandatory)] 39 | [string]$AwsWorkspaceBundleIdBundleId = "myBundleId", 40 | [Parameter(Mandatory)] 41 | [string]$AwsWorkspaceDirectoryId = "myDirectoryId", 42 | [Parameter(Mandatory)] 43 | [string]$AwsWorkspaceUserName = "myUserName" 44 | ) 45 | 46 | #Set Error Action to Silently Continue 47 | $ErrorActionPreference = "Stop" 48 | 49 | New-WKSWorkspace -Workspace @{"BundleID" = $AwsWorkspaceBundleIdBundleId; "DirectoryId" = $AwsWorkspaceDirectoryId; "UserName" = $AwsWorkspaceUserName} 50 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Register-AzWvdApplicationGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Registers an application group in an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script registers a specified application group in an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER ResourceGroup 9 | The name of the resource group. 10 | 11 | .PARAMETER WorkspaceName 12 | The name of the workspace. 13 | 14 | .PARAMETER ApplicationGroupPath 15 | The path of the application group. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Register-AzWvdApplicationGroup.ps1 -ResourceGroup "MyResourceGroup" -WorkspaceName "MyWorkspace" -ApplicationGroupPath "MyAppGroupPath" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/register-azwvdapplicationgroup?view=azps-12.2.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$ResourceGroup, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$WorkspaceName, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ApplicationGroupPath 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | ResourceGroup = $ResourceGroup 52 | WorkspaceName = $WorkspaceName 53 | ApplicationGroupPath = $ApplicationGroupPath 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Register the application group and capture the result 61 | $result = Register-AzWvdApplicationGroup @parameters 62 | 63 | # Output the result 64 | Write-Output "Application group registered successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to register the application group: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | This repository hosts scripts for the Scripted Actions area, which is part of 4 | the [XOAP platform](https://xoap.io). They are provided as-is and are not 5 | officially supported by XOAP. Use them at your own risk. Always test them in a 6 | non-production environment before using them in production. 7 | 8 | ## Code of Conduct 9 | 10 | This project has adopted this [Code of Conduct](CODE_OF_CONDUCT.md). 11 | 12 | ## Change log 13 | 14 | A full list of changes in each version can be found in the [Releases](https://github.com/xoap-io/scripted-actions/releases). 15 | 16 | ## Documentation 17 | 18 | ### Azure CLI & Bicep 19 | 20 | Most of the available scripts are built to use a local Azure CLI configuration 21 | file. Find more information here: [Azure CLI Configuration](https://docs.microsoft.com/en-us/cli/azure/azure-cli-configuration). 22 | 23 | ### Azure PowerShell 24 | 25 | For Azure PowerShell-related scripts we suggest using the noninteractive 26 | authentication with a service principal: 27 | [Sign in to Azure PowerShell with a service principal](https://learn.microsoft.com/en-us/powershell/azure/authenticate-noninteractive?view=azps-11.4.0). 28 | 29 | ### AWS CLI 30 | 31 | For AWS CLI-related scripts we suggest using the AWS CLI configuration file: 32 | [Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html). 33 | 34 | ## Prerequisites 35 | 36 | Depending on which scripts you want to use, you need to have the following 37 | prerequisites installed: 38 | 39 | ### Azure CLI 40 | 41 | - [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) 42 | 43 | ### Azure PowerShell 44 | 45 | - [Azure PowerShell](https://docs.microsoft.com/en-us/powershell/azure/install-az-ps) 46 | 47 | ### AWS CLI 48 | 49 | - [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) 50 | 51 | ### Bicep 52 | 53 | - [Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/install#azure-cli) 54 | 55 | ### ARM Templates 56 | 57 | See Azure CLI & Azure PowerShell. 58 | 59 | ## Templates 60 | 61 | You can use the provided templates to create your scripts. 62 | The templates are located in the `templates` folder. 63 | -------------------------------------------------------------------------------- /aws-cli/network/aws-cli-create-subnet.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an AWS subnet. 4 | 5 | .DESCRIPTION 6 | This script creates an AWS subnet. The script uses the following AWS CLI command: 7 | aws ec2 create-subnet --vpc-id $AwsVpcId --cidr-block $AwsCidrBlock --ipv6-cidr-block $AwsIpv6CidrBlock --tag-specifications $AwsTagSpecifications 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsVpcId 28 | Defines the ID of the AWS VPC. 29 | 30 | .PARAMETER AwsCidrBlock 31 | Defines the CIDR block of the AWS subnet. 32 | 33 | .PARAMETER AwsIpv6CidrBlock 34 | Defines the IPv6 CIDR block of the AWS subnet. 35 | 36 | .PARAMETER AwsTagSpecifications 37 | Defines the tag specifications of the AWS subnet. 38 | 39 | #> 40 | [CmdletBinding()] 41 | param( 42 | [Parameter(Mandatory)] 43 | [string]$AwsVpcId = "myVpcId", 44 | [Parameter(Mandatory)] 45 | [string]$AwsCidrBlock = "myCidrBlock", 46 | [Parameter(Mandatory)] 47 | [string]$AwsIpv6CidrBlock = "myIpv6CidrBlock", 48 | [Parameter(Mandatory)] 49 | [string]$AwsTagSpecifications = "myTagSpecifications" 50 | ) 51 | 52 | #Set Error Action to Silently Continue 53 | $ErrorActionPreference = "Stop" 54 | 55 | aws ec2 create-subnet ` 56 | --vpc-id $AwsVpcId ` 57 | --cidr-block $AwsCidrBlock ` 58 | --ipv6-cidr-block $AwsIpv6CidrBlock ` 59 | --tag-specifications $AwsTagSpecifications 60 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Unregister-AzWvdApplicationGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Unregisters an Azure Virtual Desktop Application Group. 4 | 5 | .DESCRIPTION 6 | This script unregisters an Azure Virtual Desktop Application Group. 7 | 8 | .PARAMETER ResourceGroup 9 | The name of the resource group. 10 | 11 | .PARAMETER WorkspaceName 12 | The name of the workspace. 13 | 14 | .PARAMETER ApplicationGroupPath 15 | The path of the application group. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Unregister-AzWvdApplicationGroup.ps1 -ResourceGroup "MyResourceGroup" -WorkspaceName "MyWorkspace" -ApplicationGroupPath "MyAppGroupPath" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/unregister-azwvdapplicationgroup?view=azps-12.2.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$ResourceGroup, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$WorkspaceName, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ApplicationGroupPath 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | ResourceGroup = $ResourceGroup 52 | WorkspaceName = $WorkspaceName 53 | ApplicationGroupPath = $ApplicationGroupPath 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Unregister the Azure Virtual Desktop Application Group and capture the result 61 | $result = Unregister-AzWvdApplicationGroup @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop Application Group unregistered successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to unregister the Azure Virtual Desktop Application Group: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /aws-cli/security/wip_aws-cli-create-ec2-security-group.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an AWS EC2 security group. 4 | 5 | .DESCRIPTION 6 | This script creates an AWS EC2 security group. The script uses the following AWS CLI commands: 7 | aws ec2 create-security-group --group-name $AwsSecurityGroupName --description $AwsSecurityGroupDescription --vpc-id $AwsVpcId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsSecurityGroupName 28 | Defines the name of the AWS EC2 security group. 29 | 30 | .PARAMETER AwsSecurityGroupDescription 31 | Defines the description of the AWS EC2 security group. 32 | 33 | .PARAMETER AwsVpcId 34 | Defines the ID of the AWS VPC. 35 | 36 | #> 37 | [CmdletBinding()] 38 | param( 39 | [Parameter(Mandatory)] 40 | [string]$AwsSecurityGroupName = "mySecurityGroup", 41 | [Parameter(Mandatory)] 42 | [string]$AwsSecurityGroupDescription = "MySecurityGroupDescription", 43 | [Parameter(Mandatory)] 44 | [string]$AwsVpcId = "myVpcId" 45 | ) 46 | 47 | #Set Error Action to Silently Continue 48 | $ErrorActionPreference = "Stop" 49 | 50 | aws ec2 create-security-group ` 51 | --group-name $AwsSecurityGroupName ` 52 | --description $AwsSecurityGroupDescription ` 53 | --vpc-id $AwsVpcId 54 | 55 | aws ec2 authorize-security-group-ingress ` 56 | --group-id sg-903004f8 ` 57 | --protocol tcp ` 58 | --port 3389 ` 59 | --cidr x.x.x.x/x 60 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-hostpool-show.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Show details of an Azure Virtual Desktop Host Pool with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script shows details of an Azure Virtual Desktop Host Pool with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization hostpool show --name $AzHostPoolName --resource-group $AzResourceGroup 9 | 10 | .PARAMETER IDs 11 | One or more resource IDs (space-delimited). 12 | 13 | .PARAMETER Name 14 | The name of the Azure Virtual Desktop Host Pool. 15 | 16 | .PARAMETER ResourceGroup 17 | The name of the Azure Resource Group. 18 | 19 | .EXAMPLE 20 | .\az-cli-avd-hostpool-show.ps1 -AzHostPoolName "MyHostPool" -AzResourceGroup "MyResourceGroup" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/hostpool 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/hostpool?view=azure-cli-latest 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure CLI 33 | #> 34 | 35 | [CmdletBinding()] 36 | param( 37 | [Parameter(Mandatory=$false)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$IDs, 40 | 41 | [Parameter(Mandatory=$false)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$Name, 44 | 45 | [Parameter(Mandatory=$false)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$ResourceGroup 48 | ) 49 | 50 | # Splatting parameters for better readability 51 | $parameters = ` 52 | '--ids', $Ids 53 | '--name', $HostPoolName 54 | '--resource-group', $ResourceGroup 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Show details of the Azure Virtual Desktop Host Pool 61 | az desktopvirtualization hostpool show @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop Host Pool details retrieved successfully." 65 | 66 | } catch { 67 | # Log the error to the console 68 | Write-Output "Error message $errorMessage" 69 | Write-Error "Failed to retrieve the Azure Virtual Desktop Host Pool details: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-workspace-show.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Show details of an Azure Virtual Desktop workspace with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script shows details of an Azure Virtual Desktop workspace with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization workspace show --name $AzWorkspaceName --resource-group $AzResourceGroup 9 | 10 | .PARAMETER IDs 11 | One or more resource IDs (space-delimited). 12 | 13 | .PARAMETER Name 14 | The name of the Azure Virtual Desktop Host Pool. 15 | 16 | .PARAMETER ResourceGroup 17 | The name of the Azure Resource Group. 18 | 19 | .EXAMPLE 20 | .\az-cli-avd-workspace-show.ps1 -AzWorkspaceName "MyWorkspace" -AzResourceGroup "MyResourceGroup" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace?view=azure-cli-latest 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure CLI 33 | #> 34 | 35 | [CmdletBinding()] 36 | param( 37 | [Parameter(Mandatory=$false)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$IDs, 40 | 41 | [Parameter(Mandatory=$false)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$Name, 44 | 45 | [Parameter(Mandatory=$false)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$ResourceGroup 48 | ) 49 | 50 | # Splatting parameters for better readability 51 | $parameters = ` 52 | '--ids', $Ids 53 | '--name', $HostPoolName 54 | '--resource-group', $ResourceGroup 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Show details of the Azure Virtual Desktop workspace 61 | az desktopvirtualization workspace show @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop workspace details retrieved successfully." 65 | 66 | } catch { 67 | # Log the error to the console 68 | Write-Output "Error message $errorMessage" 69 | Write-Error "Failed to retrieve the Azure Virtual Desktop workspace details: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdScalingPlanPooledSchedule.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes a scaling plan pooled schedule from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified scaling plan pooled schedule from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER ResourceGroup 9 | The name of the resource group. 10 | 11 | .PARAMETER ScalingPlanName 12 | The name of the scaling plan. 13 | 14 | .PARAMETER ScalingPlanScheduleName 15 | The name of the scaling plan schedule. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Remove-AzWvdScalingPlanPooledSchedule.ps1 -ResourceGroup "MyResourceGroup" -ScalingPlanName "MyScalingPlan" -ScalingPlanScheduleName "MySchedule" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdscalingplanpooledschedule?view=azps-12.2.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$ResourceGroup, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$ScalingPlanName, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ScalingPlanScheduleName 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | ResourceGroup = $ResourceGroup 52 | ScalingPlanName = $ScalingPlanName 53 | ScalingPlanScheduleName = $ScalingPlanScheduleName 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Remove the scaling plan pooled schedule and capture the result 61 | $result = Remove-AzWvdScalingPlanPooledSchedule @parameters 62 | 63 | # Output the result 64 | Write-Output "Scaling plan pooled schedule removed successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to remove the scaling plan pooled schedule: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdUserSession.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes a user session from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified user session from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER HostPoolName 9 | The name of the host pool. 10 | 11 | .PARAMETER Id 12 | The ID of the user session. 13 | 14 | .PARAMETER ResourceGroup 15 | The name of the resource group. 16 | 17 | .PARAMETER SessionHostName 18 | The name of the session host. 19 | 20 | .EXAMPLE 21 | PS C:\> .\Remove-AzWvdUserSession.ps1 -HostPoolName "MyHostPool" -Id "12345" -ResourceGroup "MyResourceGroup" -SessionHostName "MySessionHost" 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 25 | 26 | .LINK 27 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdusersession?view=azps-12.3.0 28 | 29 | .LINK 30 | https://github.com/xoap-io/scripted-actions 31 | 32 | .COMPONENT 33 | Azure PowerShell 34 | 35 | #> 36 | 37 | [CmdletBinding()] 38 | param ( 39 | [Parameter(Mandatory=$true)] 40 | [ValidateNotNullOrEmpty()] 41 | [string]$HostPoolName, 42 | 43 | [Parameter(Mandatory=$true)] 44 | [ValidateNotNullOrEmpty()] 45 | [string]$Id, 46 | 47 | [Parameter(Mandatory=$true)] 48 | [ValidateNotNullOrEmpty()] 49 | [string]$ResourceGroup, 50 | 51 | [Parameter(Mandatory=$true)] 52 | [ValidateNotNullOrEmpty()] 53 | [string]$SessionHostName 54 | ) 55 | 56 | # Splatting parameters for better readability 57 | $parameters = @{ 58 | HostPoolName = $HostPoolName 59 | Id = $Id 60 | ResourceGroup = $ResourceGroup 61 | SessionHostName = $SessionHostName 62 | } 63 | 64 | # Set Error Action to Stop 65 | $ErrorActionPreference = "Stop" 66 | 67 | try { 68 | # Remove the user session and capture the result 69 | $result = Remove-AzWvdUserSession @parameters 70 | 71 | # Output the result 72 | Write-Output "User session removed successfully:" 73 | Write-Output $result 74 | 75 | } catch [System.Exception] { 76 | 77 | Write-Error "Failed to remove the user session: $($_.Exception.Message)" 78 | 79 | } finally { 80 | # Cleanup code if needed 81 | Write-Output "Script execution completed." 82 | } 83 | -------------------------------------------------------------------------------- /aws-cli/security/aws-cli-authorize-ec2-security-group.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Authorize an AWS EC2 security group. 4 | 5 | .DESCRIPTION 6 | This script creates an AWS EC2 security group. The script uses the following AWS CLI commands: 7 | aws ec2 create-security-group --group-name $AwsSecurityGroupName --description $AwsSecurityGroupDescription --vpc-id $AwsVpcId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsSecurityGroupId 28 | Defines the ID of the AWS EC2 security group. 29 | 30 | .PARAMETER AwsSecurityGroupProtocol 31 | Defines the protocol of the AWS EC2 security group. 32 | 33 | .PARAMETER AwsSecurityGroupPort 34 | Defines the port of the AWS EC2 security group. 35 | 36 | .PARAMETER AwsSecurityGroupCidr 37 | Defines the CIDR of the AWS EC2 security group. 38 | 39 | #> 40 | [CmdletBinding()] 41 | param( 42 | [Parameter(Mandatory)] 43 | [string]$AwsSecurityGroupId = "sg-1234567890abcdef0", 44 | [Parameter(Mandatory)] 45 | [string]$AwsSecurityGroupProtocol = "tcp", 46 | [Parameter(Mandatory)] 47 | [string]$AwsSecurityGroupPort = "80", 48 | [Parameter(Mandatory)] 49 | [string]$AwsSecurityGroupCidr = "10.0.0.0/16" 50 | 51 | ) 52 | 53 | #Set Error Action to Silently Continue 54 | $ErrorActionPreference = "Stop" 55 | 56 | aws ec2 authorize-security-group-ingress ` 57 | --group-id $AwsSecurityGroupId ` 58 | --protocol $AwsSecurityGroupProtocol ` 59 | --port $AwsSecurityGroupPort ` 60 | --cidr $AwsSecurityGroupCidr 61 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-application-group-show.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Show details of an Azure Virtual Desktop Application Group with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script shows details of an Azure Virtual Desktop Application Group with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization applicationgroup show --name $AzAppGroupName --resource-group $AzResourceGroup 9 | 10 | .PARAMETER IDs 11 | One or more resource IDs (space-delimited). 12 | 13 | .PARAMETER Name 14 | The name of the Azure Virtual Desktop Application Group. 15 | 16 | .PARAMETER ResourceGroup 17 | The name of the Azure Resource Group. 18 | 19 | .EXAMPLE 20 | .\az-cli-avd-applicationgroup-show.ps1 -AzAppGroupName "MyAppGroup" -AzResourceGroup "MyResourceGroup" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/applicationgroup 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/applicationgroup?view=azure-cli-latest 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure CLI 33 | #> 34 | 35 | [CmdletBinding()] 36 | param( 37 | [Parameter(Mandatory=$false)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$IDs, 40 | 41 | [Parameter(Mandatory=$false)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$Name, 44 | 45 | [Parameter(Mandatory=$true)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$ResourceGroup 48 | ) 49 | 50 | # Splatting parameters for better readability 51 | $parameters = ` 52 | '--ids', $Ids 53 | '--name', $AppGroupName 54 | '--resource-group', $ResourceGroup 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Show details of the Azure Virtual Desktop Application Group 61 | az desktopvirtualization applicationgroup show @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop Application Group details retrieved successfully." 65 | 66 | } catch { 67 | # Log the error to the console 68 | Write-Output "Error message $errorMessage" 69 | Write-Error "Failed to retrieve the Azure Virtual Desktop Application Group details: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdScalingPlanPersonalSchedule.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes a personal schedule from a scaling plan in an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified personal schedule from a scaling plan in an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER ResourceGroup 9 | The name of the resource group. 10 | 11 | .PARAMETER ScalingPlanName 12 | The name of the scaling plan. 13 | 14 | .PARAMETER ScalingPlanScheduleName 15 | The name of the scaling plan schedule. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Remove-AzWvdScalingPlanPersonalSchedule.ps1 -ResourceGroup "MyResourceGroup" -ScalingPlanName "MyScalingPlan" -ScalingPlanScheduleName "MySchedule" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdscalingplanpersonalschedule?view=azps-11.6.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$ResourceGroup, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$ScalingPlanName, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$ScalingPlanScheduleName 47 | ) 48 | 49 | # Splatting parameters for better readability 50 | $parameters = @{ 51 | ResourceGroup = $ResourceGroup 52 | ScalingPlanName = $ScalingPlanName 53 | ScalingPlanScheduleName = $ScalingPlanScheduleName 54 | } 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Remove the personal schedule from the scaling plan and capture the result 61 | $result = Remove-AzWvdScalingPlanPersonalSchedule @parameters 62 | 63 | # Output the result 64 | Write-Output "Personal schedule removed from scaling plan successfully:" 65 | Write-Output $result 66 | 67 | } catch [System.Exception] { 68 | 69 | Write-Error "Failed to remove the personal schedule from the scaling plan: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Remove-AzWvdPrivateEndpointConnection.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes a private endpoint connection from an Azure Virtual Desktop environment. 4 | 5 | .DESCRIPTION 6 | This script removes a specified private endpoint connection from an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER Name 9 | The name of the private endpoint connection. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .PARAMETER WorkspaceName 15 | The name of the workspace. 16 | 17 | .EXAMPLE 18 | PS C:\> .\Remove-AzWvdPrivateEndpointConnection.ps1 -Name "MyPrivateEndpoint" -ResourceGroup "MyResourceGroup" -WorkspaceName "MyWorkspace" 19 | 20 | .LINK 21 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/remove-azwvdprivateendpointconnection?view=azps-12.3.0 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | [CmdletBinding()] 35 | param ( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$Name, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$ResourceGroup, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$WorkspaceName, 47 | 48 | [Parameter(Mandatory=$true)] 49 | [ValidateNotNullOrEmpty()] 50 | [string]$HostPoolName 51 | ) 52 | 53 | # Splatting parameters for better readability 54 | $parameters = @{ 55 | Name = $Name 56 | ResourceGroup = $ResourceGroup 57 | WorkspaceName = $WorkspaceName 58 | HostPoolName = $HostPoolName 59 | } 60 | 61 | # Set Error Action to Stop 62 | $ErrorActionPreference = "Stop" 63 | 64 | try { 65 | # Remove the private endpoint connection and capture the result 66 | $result = Remove-AzWvdPrivateEndpointConnection @parameters 67 | 68 | # Output the result 69 | Write-Output "Private endpoint connection removed successfully:" 70 | Write-Output $result 71 | 72 | } catch [System.Exception] { 73 | 74 | Write-Error "Failed to remove the private endpoint connection: $($_.Exception.Message)" 75 | 76 | } finally { 77 | # Cleanup code if needed 78 | Write-Output "Script execution completed." 79 | } 80 | -------------------------------------------------------------------------------- /azure-cli/storage/az-cli-delete-storage-account.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete an Azure Storage Account with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script deletes a new Azure Storage Account with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az storage account delete --name $StorageAccountName --resource-group $ResourceGroup 9 | 10 | .PARAMETER Name 11 | Defines the name of the Azure Storage Account. 12 | 13 | .PARAMETER ResourceGroup 14 | Defines the name of the Azure Resource Group. 15 | 16 | .PARAMETER AccessTier 17 | Defines the access tier of the Azure Storage Account. 18 | 19 | .EXAMPLE 20 | .\az-cli-create-storage-account.ps1 -AzStorageAccountName "MyStorageAccount" -AzResourceGroup "MyResourceGroup" -AzLocation "eastus" -AzStorageSku "Standard_LRS" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/cli/azure/storage/account 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/storage/account?view=azure-cli-latest 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure CLI 33 | #> 34 | 35 | [CmdletBinding()] 36 | param( 37 | [Parameter(Mandatory=$true)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$Name, 40 | 41 | [Parameter(Mandatory=$true)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$ResourceGroup, 44 | 45 | [Parameter(Mandatory=$false)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$Ids, 48 | 49 | [Parameter(Mandatory=$false)] 50 | [ValidateNotNullOrEmpty()] 51 | [bool]$Yes 52 | ) 53 | 54 | # Splatting parameters for better readability 55 | $parameters = ` 56 | '--name', $Name 57 | '--resource-group', $ResourceGroup 58 | 59 | if ($Yes) { 60 | $parameters += '--yes' 61 | } 62 | 63 | if ($Ids) { 64 | $parameters += '--ids', $Ids 65 | } 66 | 67 | # Set Error Action to Stop 68 | $ErrorActionPreference = "Stop" 69 | 70 | try { 71 | # Delete a storage account 72 | az storage account delete @parameters 73 | 74 | # Output the result 75 | Write-Output "Azure Storage Account deleted successfully." 76 | 77 | } catch { 78 | # Log the error to the console 79 | Write-Output "Error message $errorMessage" 80 | Write-Error "Failed to delete the Azure Storage Account: $($_.Exception.Message)" 81 | 82 | } finally { 83 | # Cleanup code if needed 84 | Write-Output "Script execution completed." 85 | } 86 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-hostpool-retrieve-registration-token.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieve the registration token for an Azure Virtual Desktop Host Pool with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script retrieves the registration token for an Azure Virtual Desktop Host Pool with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization hostpool retrieve-registration-token --name $AzHostPoolName --resource-group $AzResourceGroup 9 | 10 | .PARAMETER IDs 11 | One or more resource IDs (space-delimited). 12 | 13 | .PARAMETER Name 14 | The name of the Azure Virtual Desktop Host Pool. 15 | 16 | .PARAMETER ResourceGroup 17 | The name of the Azure Resource Group. 18 | 19 | .EXAMPLE 20 | .\az-cli-avd-hostpool-retrieve-registration-token.ps1 -AzHostPoolName "MyHostPool" -AzResourceGroup "MyResourceGroup" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/hostpool 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/hostpool?view=azure-cli-latest 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure CLI 33 | #> 34 | 35 | [CmdletBinding()] 36 | param( 37 | [Parameter(Mandatory=$false)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$IDs, 40 | 41 | [Parameter(Mandatory=$false)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$Name, 44 | 45 | [Parameter(Mandatory=$false)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$ResourceGroup 48 | ) 49 | 50 | # Splatting parameters for better readability 51 | $parameters = ` 52 | '--ids', $Ids 53 | '--name', $HostPoolName 54 | '--resource-group', $ResourceGroup 55 | 56 | # Set Error Action to Stop 57 | $ErrorActionPreference = "Stop" 58 | 59 | try { 60 | # Retrieve the registration token for the Azure Virtual Desktop Host Pool 61 | az desktopvirtualization hostpool retrieve-registration-token @parameters 62 | 63 | # Output the result 64 | Write-Output "Azure Virtual Desktop Host Pool registration token retrieved successfully." 65 | 66 | } catch { 67 | # Log the error to the console 68 | Write-Output "Error message $errorMessage" 69 | Write-Error "Failed to retrieve the Azure Virtual Desktop Host Pool registration token: $($_.Exception.Message)" 70 | 71 | } finally { 72 | # Cleanup code if needed 73 | Write-Output "Script execution completed." 74 | } 75 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-workspace-delete.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete an Azure Virtual Desktop workspace with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script deletes an Azure Virtual Desktop workspace with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization workspace delete --name $AzWorkspaceName --resource-group $AzResourceGroup 9 | 10 | .PARAMETER IDs 11 | The IDs of the Azure Virtual Desktop workspace. 12 | 13 | .PARAMETER Name 14 | Defines the name of the Azure Virtual Desktop workspace. 15 | 16 | .PARAMETER ResourceGroup 17 | Defines the name of the Azure Resource Group. 18 | 19 | .PARAMETER yes 20 | Do not prompt for confirmation. 21 | 22 | .EXAMPLE 23 | .\az-cli-avd-workspace-delete.ps1 -AzWorkspaceName "MyWorkspace" -AzResourceGroup "MyResourceGroup" 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace 27 | 28 | .LINK 29 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace?view=azure-cli-latest 30 | 31 | .LINK 32 | https://github.com/xoap-io/scripted-actions 33 | 34 | .COMPONENT 35 | Azure CLI 36 | #> 37 | 38 | [CmdletBinding()] 39 | param( 40 | [Parameter(Mandatory=$false)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$IDs, 43 | 44 | [Parameter(Mandatory=$false)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$Name, 47 | 48 | [Parameter(Mandatory=$false)] 49 | [ValidateNotNullOrEmpty()] 50 | [string]$ResourceGroup, 51 | 52 | [Parameter(Mandatory=$false)] 53 | [ValidateNotNullOrEmpty()] 54 | [switch]$yes 55 | ) 56 | 57 | # Splatting parameters for better readability 58 | $parameters = ` 59 | '--ids', $IDs 60 | '--name', $Name 61 | '--resource-group', $ResourceGroup 62 | '--yes', $yes 63 | 64 | # Set Error Action to Stop 65 | $ErrorActionPreference = "Stop" 66 | 67 | try { 68 | # Delete the Azure Virtual Desktop workspace 69 | az desktopvirtualization workspace delete @parameters 70 | 71 | # Output the result 72 | Write-Output "Azure Virtual Desktop workspace deleted successfully." 73 | 74 | } catch { 75 | # Log the error to the console 76 | Write-Output "Error message $errorMessage" 77 | Write-Error "Failed to delete the Azure Virtual Desktop workspace: $($_.Exception.Message)" 78 | 79 | } finally { 80 | # Cleanup code if needed 81 | Write-Output "Script execution completed." 82 | } 83 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-application-group-list.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | List Azure Virtual Desktop Application Groups with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script lists Azure Virtual Desktop Application Groups with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization applicationgroup list --resource-group $AzResourceGroup 9 | 10 | .PARAMETER ResourceGroup 11 | Defines the name of the Azure Resource Group. 12 | 13 | .PARAMETER Filter 14 | OData filter. 15 | 16 | .PARAMETER MaxItems 17 | Maximum number of items to return. 18 | 19 | .PARAMETER NextToken 20 | Token to retrieve the next page of results. 21 | 22 | .EXAMPLE 23 | .\az-cli-avd-applicationgroup-list.ps1 -AzResourceGroup "MyResourceGroup" 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/applicationgroup 27 | 28 | .LINK 29 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/applicationgroup?view=azure-cli-latest 30 | 31 | .LINK 32 | https://github.com/xoap-io/scripted-actions 33 | 34 | .COMPONENT 35 | Azure CLI 36 | #> 37 | 38 | [CmdletBinding()] 39 | param( 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$Filter, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$MaxItems, 47 | 48 | [Parameter(Mandatory=$true)] 49 | [ValidateNotNullOrEmpty()] 50 | [string]$NextToken, 51 | 52 | [Parameter(Mandatory=$true)] 53 | [ValidateNotNullOrEmpty()] 54 | [string]$ResourceGroup 55 | ) 56 | 57 | # Splatting parameters for better readability 58 | $parameters = ` 59 | '--filter', $Filter 60 | '--max-items', $MaxItems 61 | '--next-token', $NextToken 62 | '--resource-group', $ResourceGroup 63 | 64 | # Set Error Action to Stop 65 | $ErrorActionPreference = "Stop" 66 | 67 | try { 68 | # List the Azure Virtual Desktop Application Groups 69 | az desktopvirtualization applicationgroup list @parameters 70 | 71 | # Output the result 72 | Write-Output "Azure Virtual Desktop Application Groups listed successfully." 73 | 74 | } catch { 75 | # Log the error to the console 76 | Write-Output "Error message $errorMessage" 77 | Write-Error "Failed to list the Azure Virtual Desktop Application Groups: $($_.Exception.Message)" 78 | 79 | } finally { 80 | # Cleanup code if needed 81 | Write-Output "Script execution completed." 82 | } 83 | -------------------------------------------------------------------------------- /azure-cli/vms/az-cli-enable-EntraID-login-linux-vm.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Enable EntraID login for a Linux VM in Azure. 4 | 5 | .DESCRIPTION 6 | This script enables EntraID login for a Linux VM in Azure. The script uses the Azure CLI to set the AADSSHLoginForLinux extension for the specified Azure VM. 7 | The script uses the following Azure CLI command: 8 | az vm extension set ` 9 | --publisher Microsoft.Azure.ActiveDirectory ` 10 | --name AADSSHLoginForLinux ` 11 | --resource-group $AzResourceGroup ` 12 | --vm-name $AzVmName 13 | 14 | .PARAMETER AzResourceGroup 15 | Defines the name of the Azure Resource Group. 16 | 17 | .PARAMETER AzExtensionName 18 | Defines the name of the Azure Extension. 19 | 20 | .PARAMETER AzVmName 21 | Defines the name of the Azure Virtual Machine. 22 | 23 | .EXAMPLE 24 | .\az-cli-enable-EntraID-login-linux-vm.ps1 -AzResourceGroup "MyResourceGroup" -AzExtensionName "Microsoft.Azure.ActiveDirectory" -AzVmName "MyVmName" 25 | 26 | .LINK 27 | https://learn.microsoft.com/en-us/cli/azure/vm 28 | #> 29 | 30 | [CmdletBinding()] 31 | param( 32 | [Parameter(Mandatory=$true)] 33 | [ValidateNotNullOrEmpty()] 34 | [string]$AzResourceGroup = "myResourceGroup", 35 | 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$AzExtensionName = "Microsoft.Azure.ActiveDirectory", 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$AzVmName = "myVmName" 43 | ) 44 | 45 | # Splatting parameters for better readability 46 | $parameters = @{ 47 | publisher = $AzExtensionName 48 | name = $AzExtensionName 49 | resource_group = $AzResourceGroup 50 | vm_name = $AzVmName 51 | debug = $AzDebug 52 | only_show_errors = $AzOnlyShowErrors 53 | output = $AzOutput 54 | query = $AzQuery 55 | verbose = $AzVerbose 56 | } 57 | 58 | # Set Error Action to Stop 59 | $ErrorActionPreference = "Stop" 60 | 61 | try { 62 | # Enable EntraID login for the Linux VM 63 | az vm extension set @parameters 64 | 65 | # Output the result 66 | Write-Output "EntraID login enabled for the Linux VM successfully." 67 | } catch { 68 | # Log the error to the console 69 | 70 | Write-Output "Error message $errorMessage" 71 | 72 | 73 | Write-Error "Failed to enable EntraID login for the Linux VM: $($_.Exception.Message)" 74 | } finally { 75 | # Cleanup code if needed 76 | Write-Output "Script execution completed." 77 | } -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-application-group-delete.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete an Azure Virtual Desktop Application Group with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script deletes an Azure Virtual Desktop Application Group with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization applicationgroup delete --name $AzAppGroupName --resource-group $AzResourceGroup --subscription $AzSubscription --yes 9 | 10 | .PARAMETER IDs 11 | The IDs of the Azure Virtual Desktop Application Group. 12 | 13 | .PARAMETER Name 14 | Defines the name of the Azure Virtual Desktop Application Group. 15 | 16 | .PARAMETER ResourceGroup 17 | Defines the name of the Azure Resource Group. 18 | 19 | .PARAMETER yes 20 | Do not prompt for confirmation. 21 | 22 | .EXAMPLE 23 | .\az-cli-avd-applicationgroup-delete.ps1 -AzAppGroupName "MyAppGroup" -AzResourceGroup "MyResourceGroup" -AzSubscription "MySubscription" -AzYes 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/applicationgroup 27 | 28 | .LINK 29 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/applicationgroup?view=azure-cli-latest 30 | 31 | .LINK 32 | https://github.com/xoap-io/scripted-actions 33 | 34 | .COMPONENT 35 | Azure CLI 36 | #> 37 | 38 | [CmdletBinding()] 39 | param( 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$IDs, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$Name, 47 | 48 | [Parameter(Mandatory=$true)] 49 | [ValidateNotNullOrEmpty()] 50 | [string]$ResourceGroup, 51 | 52 | [Parameter(Mandatory=$false)] 53 | [ValidateNotNullOrEmpty()] 54 | [switch]$yes 55 | ) 56 | 57 | # Splatting parameters for better readability 58 | $parameters = ` 59 | '--ids', $IDs 60 | '--name', $NName 61 | '--resource-group', $ResourceGroup 62 | '--yes', $yes 63 | 64 | # Set Error Action to Stop 65 | $ErrorActionPreference = "Stop" 66 | 67 | try { 68 | # Delete the Azure Virtual Desktop Application Group 69 | az desktopvirtualization applicationgroup delete @parameters 70 | 71 | # Output the result 72 | Write-Output "Azure Virtual Desktop Application Group deleted successfully." 73 | 74 | } catch { 75 | # Log the error to the console 76 | Write-Output "Error message $errorMessage" 77 | Write-Error "Failed to delete the Azure Virtual Desktop Application Group: $($_.Exception.Message)" 78 | 79 | } finally { 80 | # Cleanup code if needed 81 | Write-Output "Script execution completed." 82 | } 83 | -------------------------------------------------------------------------------- /azure-cli/xoap/az-cli-register-node.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Register a new Azure VM in XOAP. 4 | 5 | .DESCRIPTION 6 | This script registers a new Azure VM in XOAP. The script uses the Azure CLI to run a PowerShell script on the Azure VM. 7 | The PowerShell script downloads the DSC configuration from the XOAP platform and applies it to the Azure VM. 8 | 9 | .PARAMETER ResourceGroup 10 | Defines the name of the Azure Resource Group. 11 | 12 | .PARAMETER VmName 13 | Defines the name of the Azure VM. 14 | 15 | .PARAMETER WorkspaceId 16 | Defines the ID of the XOAP Workspace to register this node. 17 | 18 | .PARAMETER GroupName 19 | Defines the XOAP config.XO group name to assign the node to. 20 | 21 | .EXAMPLE 22 | .\az-cli-register-node.ps1 -AzResourceGroup "myResourceGroup" -AzVmName "myVmName" -WorkspaceId "myWorkspaceId" -GroupName "myGroupName" 23 | 24 | .NOTES 25 | Author: Your Name 26 | Date: 2024-09-03 27 | Version: 1.1 28 | Requires: Azure CLI 29 | 30 | .LINK 31 | https://github.com/xoap-io/scripted-actions 32 | #> 33 | 34 | [CmdletBinding()] 35 | param( 36 | [Parameter(Mandatory=$true)] 37 | [ValidateNotNullOrEmpty()] 38 | [string]$ResourceGroup, 39 | 40 | [Parameter(Mandatory=$true)] 41 | [ValidateNotNullOrEmpty()] 42 | [string]$VmName, 43 | 44 | [Parameter(Mandatory=$true)] 45 | [ValidateNotNullOrEmpty()] 46 | [string]$WorkspaceId, 47 | 48 | [Parameter(Mandatory=$true)] 49 | [ValidateNotNullOrEmpty()] 50 | [string]$GroupName, 51 | 52 | [Parameter(Mandatory=$true)] 53 | [ValidateNotNullOrEmpty()] 54 | [string]$CommandId = "RunPowerShellScript", 55 | 56 | [Parameter(Mandatory=$true)] 57 | [ValidateNotNullOrEmpty()] 58 | [string]$Scripts = "Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://api.dev.xoap.io/dsc/Policy/$($parameters.workspace_id)/Download/$($parameters.group_name)'))" 59 | ) 60 | 61 | # Splatting parameters for better readability 62 | $parameters = ` 63 | '--resource-group', $AzResourceGroup 64 | '--vmname', $AzVmName 65 | '--command-id', $CommandId 66 | '--scripts', $Scripts 67 | 68 | # Set Error Action to Stop 69 | $ErrorActionPreference = "Stop" 70 | 71 | try { 72 | # Register VM in XOAP 73 | az vm run-command invoke @parameters 74 | 75 | # Output the result 76 | Write-Output "Azure VM registered in XOAP successfully." 77 | 78 | } catch { 79 | # Log the error to the console 80 | Write-Output "Error message $errorMessage" 81 | Write-Error "Failed to register Azure VM in XOAP: $($_.Exception.Message)" 82 | 83 | } finally { 84 | # Cleanup code if needed 85 | Write-Output "Script execution completed." 86 | } 87 | -------------------------------------------------------------------------------- /azure-cli/vms/az-cli-create-image-gallery.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create a new Azure Image Gallery with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script creates a new Azure Image Gallery with the Azure CLI. The script creates a new Azure Resource Group and a new Azure Image Gallery. 7 | The script uses the following Azure CLI commands: 8 | az group create --name $AzResourceGroup --location $AzLocation 9 | az sig create --resource-group $AzResourceGroup --gallery-name $AzGalleryName 10 | 11 | .PARAMETER AzResourceGroup 12 | Defines the name of the Azure Resource Group. 13 | 14 | .PARAMETER AzLocation 15 | Defines the location of the Azure Resource Group. 16 | 17 | .PARAMETER AzGalleryName 18 | Defines the name of the Azure Image Gallery. 19 | 20 | .EXAMPLE 21 | .\az-cli-create-image-gallery.ps1 -AzResourceGroup "MyResourceGroup" -AzLocation "eastus" -AzGalleryName "MyImageGallery" 22 | 23 | .LINK 24 | https://learn.microsoft.com/en-us/cli/azure/sig 25 | #> 26 | 27 | [CmdletBinding()] 28 | param( 29 | [Parameter(Mandatory=$true)] 30 | [ValidateNotNullOrEmpty()] 31 | [string]$AzResourceGroup = "myResourceGroup", 32 | 33 | [Parameter(Mandatory=$true)] 34 | [ValidateSet('eastus', 'eastus2', 'northeurope', 'germanywestcentral', 'westcentralus', 'southcentralus', 'centralus', 'northcentralus', 'eastus2euap', 'westus3', 'southeastasia', 'eastasia', 'japaneast', 'japanwest', 'australiaeast', 'australiasoutheast', 'australiacentral', 'australiacentral2', 'centralindia', 'southindia', 'westindia', 'canadacentral', 'canadaeast', 'uksouth', 'ukwest', 'francecentral', 'francesouth', 'norwayeast', 'norwaywest', 'switzerlandnorth', 'switzerlandwest', 'germanynorth', 'germanywestcentral', 'uaenorth', 'uaecentral', 'southafricanorth', 'southafricawest', 'brazilsouth', 'brazilus', 'koreacentral', 'koreasouth')] 35 | [string]$AzLocation, 36 | 37 | [Parameter(Mandatory=$true)] 38 | [ValidateNotNullOrEmpty()] 39 | [string]$AzGalleryName = "myImageGallery" 40 | ) 41 | 42 | # Splatting parameters for better readability 43 | $parameters = ` 44 | 'name', $ResourceGroup 45 | 'location', $Location 46 | 'gallery-name', $GalleryName 47 | 48 | # Set Error Action to Stop 49 | $ErrorActionPreference = "Stop" 50 | 51 | try { 52 | # Create a new Azure Image Gallery 53 | az sig create @parameters 54 | 55 | # Output the result 56 | Write-Output "Azure Image Gallery created successfully." 57 | 58 | } catch { 59 | # Log the error to the console 60 | Write-Output "Error message $errorMessage" 61 | Write-Error "Failed to create the Azure Image Gallery: $($_.Exception.Message)" 62 | 63 | } finally { 64 | # Cleanup code if needed 65 | Write-Output "Script execution completed." 66 | } 67 | -------------------------------------------------------------------------------- /aws-cli/xoap/aws-cli-register-node.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script registers an AWS Node with the XOAP platform. 4 | 5 | .DESCRIPTION 6 | This script registers an AWS Node with the XOAP platform. 7 | The script uses the AWS CLI to execute an SSM command on the specified AWS Node. 8 | The script uses the following AWS CLI command: 9 | aws ssm send-command --instance-ids $AwsInstanceId --document-name $AwsSsmDocumentName --comment $AwsSsmDocumentComment --parameters commands='["Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://api.dev.xoap.io/dsc/Policy/$XOAPWorkspaceId/Download/$XOAPGroupName'))"]' 10 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsInstanceId 28 | Defines the AWS Instance ID. 29 | 30 | .PARAMETER AwsSsmDocumentName 31 | Defines the name of the AWS SSM Document. 32 | 33 | .PARAMETER AwsSsmDocumentComment 34 | Defines the comment for the AWS SSM Document. 35 | 36 | .PARAMETER XOAPWorkspaceId 37 | Defines the XOAP Workspace ID. 38 | 39 | .PARAMETER XOAPGroupName 40 | Defines the XOAP Group Name. 41 | 42 | #> 43 | [CmdletBinding()] 44 | param( 45 | [Parameter(Mandatory)] 46 | [string]$AwsInstanceId = "myInstanceId", 47 | [Parameter(Mandatory)] 48 | [string]$AwsSsmDocumentName = "myDocumentName", 49 | [Parameter(Mandatory)] 50 | [string]$AwsSsmDocumentComment = "myDocumentComment", 51 | [Parameter(Mandatory)] 52 | [string]$XOAPWorkspaceId = "myWorkspaceId", 53 | [Parameter(Mandatory)] 54 | [string]$XOAPGroupName = "XOAP unassigned" 55 | ) 56 | 57 | #Set Error Action to Silently Continue 58 | $ErrorActionPreference = "Stop" 59 | 60 | Send-SSMCommand ` 61 | --instance-ids @($AwsInstanceId) ` 62 | --document-name $AwsSsmDocumentName ` 63 | --comment $AwsSsmDocumentComment ` 64 | --parameters @{'commands'=@('"Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(\"https://api.dev.xoap.io/dsc/Policy/$XOAPWorkspaceId/Download/$XOAPGroupName\"))"')} 65 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Send-AzWvdUserSessionMessage.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Sends a message to an Azure Virtual Desktop user session. 4 | 5 | .DESCRIPTION 6 | This script sends a message to a specified user session in an Azure Virtual Desktop environment. 7 | 8 | .PARAMETER HostPoolName 9 | The name of the host pool. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .PARAMETER SessionHostName 15 | The name of the session host. 16 | 17 | .PARAMETER UserSessionId 18 | The ID of the user session. 19 | 20 | .PARAMETER MessageBody 21 | The body of the message. 22 | 23 | .PARAMETER MessageTitle 24 | The title of the message. 25 | 26 | .EXAMPLE 27 | PS C:\> .\Send-AzWvdUserSessionMessage.ps1 -HostPoolName "MyHostPool" -ResourceGroup "MyResourceGroup" -SessionHostName "MySessionHost" -UserSessionId "12345" -MessageBody "Hello, User!" -MessageTitle "Greeting" 28 | 29 | .LINK 30 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/send-azwvdusersessionmessage?view=azps-12.3.0 34 | 35 | .LINK 36 | https://github.com/xoap-io/scripted-actions 37 | 38 | .COMPONENT 39 | Azure PowerShell 40 | 41 | #> 42 | 43 | [CmdletBinding()] 44 | param ( 45 | [Parameter(Mandatory=$true)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$HostPoolName, 48 | 49 | [Parameter(Mandatory=$true)] 50 | [ValidateNotNullOrEmpty()] 51 | [string]$ResourceGroup, 52 | 53 | [Parameter(Mandatory=$true)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$SessionHostName, 56 | 57 | [Parameter(Mandatory=$true)] 58 | [ValidateNotNullOrEmpty()] 59 | [string]$UserSessionId, 60 | 61 | [Parameter(Mandatory=$true)] 62 | [ValidateNotNullOrEmpty()] 63 | [string]$MessageBody, 64 | 65 | [Parameter(Mandatory=$true)] 66 | [ValidateNotNullOrEmpty()] 67 | [string]$MessageTitle 68 | ) 69 | 70 | # Splatting parameters for better readability 71 | $parameters = @{ 72 | HostPoolName = $HostPoolName 73 | ResourceGroup = $ResourceGroup 74 | SessionHostName = $SessionHostName 75 | UserSessionId = $UserSessionId 76 | MessageBody = $MessageBody 77 | MessageTitle = $MessageTitle 78 | } 79 | 80 | # Set Error Action to Stop 81 | $ErrorActionPreference = "Stop" 82 | 83 | try { 84 | # Send the message to the Azure Virtual Desktop user session and capture the result 85 | $result = Send-AzWvdUserSessionMessage @parameters 86 | 87 | # Output the result 88 | Write-Output "Message sent to Azure Virtual Desktop user session successfully:" 89 | Write-Output $result 90 | 91 | } catch [System.Exception] { 92 | 93 | Write-Error "Failed to send the message to the Azure Virtual Desktop user session: $($_.Exception.Message)" 94 | 95 | } finally { 96 | # Cleanup code if needed 97 | Write-Output "Script execution completed." 98 | } 99 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Update-AzWvdDesktop.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates an Azure Virtual Desktop. 4 | 5 | .DESCRIPTION 6 | This script updates the properties of an Azure Virtual Desktop. 7 | 8 | .PARAMETER ApplicationGroupName 9 | The name of the application group. 10 | 11 | .PARAMETER Name 12 | The name of the desktop. 13 | 14 | .PARAMETER ResourceGroup 15 | The name of the resource group. 16 | 17 | .PARAMETER Description 18 | The description of the desktop. 19 | 20 | .PARAMETER FriendlyName 21 | The friendly name of the desktop. 22 | 23 | .PARAMETER Tags 24 | A hashtable of tags to assign to the desktop. 25 | 26 | .EXAMPLE 27 | PS C:\> .\Update-AzWvdDesktop.ps1 -ApplicationGroupName "MyAppGroup" -Name "MyDesktop" -ResourceGroup "MyResourceGroup" -Description "Updated Description" 28 | 29 | .LINK 30 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/update-azwvddesktop?view=azps-12.2.0 34 | 35 | .LINK 36 | https://github.com/xoap-io/scripted-actions 37 | 38 | .COMPONENT 39 | Azure PowerShell 40 | 41 | #> 42 | 43 | [CmdletBinding()] 44 | param ( 45 | [Parameter(Mandatory=$true)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$ApplicationGroupName, 48 | 49 | [Parameter(Mandatory=$true)] 50 | [ValidateNotNullOrEmpty()] 51 | [string]$Name, 52 | 53 | [Parameter(Mandatory=$true)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$ResourceGroup, 56 | 57 | [Parameter(Mandatory=$false)] 58 | [ValidateNotNullOrEmpty()] 59 | [string]$Description, 60 | 61 | [Parameter(Mandatory=$false)] 62 | [ValidateNotNullOrEmpty()] 63 | [string]$FriendlyName, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [ValidateNotNullOrEmpty()] 67 | [hashtable]$Tags 68 | ) 69 | 70 | # Splatting parameters for better readability 71 | $parameters = @{ 72 | ApplicationGroupName = $ApplicationGroupName 73 | Name = $Name 74 | ResourceGroup = $ResourceGroup 75 | } 76 | 77 | if ($Description) { 78 | $parameters.Description = $Description 79 | } 80 | 81 | if ($FriendlyName) { 82 | $parameters.FriendlyName = $FriendlyName 83 | } 84 | 85 | if ($Tags) { 86 | $parameters['Tag'], $Tags 87 | } 88 | 89 | # Set Error Action to Stop 90 | $ErrorActionPreference = "Stop" 91 | 92 | try { 93 | # Update the Azure Virtual Desktop and capture the result 94 | $result = Update-AzWvdDesktop @parameters 95 | 96 | # Output the result 97 | Write-Output "Azure Virtual Desktop updated successfully:" 98 | Write-Output $result 99 | 100 | } catch [System.Exception] { 101 | 102 | Write-Error "Failed to update the Azure Virtual Desktop: $($_.Exception.Message)" 103 | 104 | } finally { 105 | # Cleanup code if needed 106 | Write-Output "Script execution completed." 107 | } 108 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Update-AzWvdSessionHost.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates an Azure Virtual Desktop Session Host. 4 | 5 | .DESCRIPTION 6 | This script updates the properties of an Azure Virtual Desktop Session Host. 7 | 8 | .PARAMETER HostPoolName 9 | The name of the host pool. 10 | 11 | .PARAMETER Name 12 | The name of the session host. 13 | 14 | .PARAMETER ResourceGroup 15 | The name of the resource group. 16 | 17 | .PARAMETER AllowNewSession 18 | Specifies whether new sessions are allowed. 19 | 20 | .PARAMETER AssignedUser 21 | The user assigned to the session host. 22 | 23 | .PARAMETER FriendlyName 24 | The friendly name of the session host. 25 | 26 | .EXAMPLE 27 | PS C:\> .\Update-AzWvdSessionHost.ps1 -HostPoolName "MyHostPool" -Name "MySessionHost" -ResourceGroup "MyResourceGroup" -AllowNewSession $true 28 | 29 | .LINK 30 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/update-azwvdsessionhost?view=azps-12.3.0 34 | 35 | .LINK 36 | https://github.com/xoap-io/scripted-actions 37 | 38 | .COMPONENT 39 | Azure PowerShell 40 | 41 | #> 42 | 43 | [CmdletBinding()] 44 | param ( 45 | [Parameter(Mandatory=$true)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$HostPoolName, 48 | 49 | [Parameter(Mandatory=$true)] 50 | [ValidateNotNullOrEmpty()] 51 | [string]$Name, 52 | 53 | [Parameter(Mandatory=$true)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$ResourceGroup, 56 | 57 | [Parameter(Mandatory=$false)] 58 | [ValidateNotNullOrEmpty()] 59 | [bool]$AllowNewSession, 60 | 61 | [Parameter(Mandatory=$false)] 62 | [ValidateNotNullOrEmpty()] 63 | [string]$AssignedUser, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [ValidateNotNullOrEmpty()] 67 | [string]$FriendlyName 68 | ) 69 | 70 | # Splatting parameters for better readability 71 | $parameters = @{ 72 | HostPoolName = $HostPoolName 73 | Name = $Name 74 | ResourceGroup = $ResourceGroup 75 | } 76 | 77 | if ($AllowNewSession) { 78 | $parameters['AllowNewSession'], $AllowNewSession 79 | } 80 | 81 | if ($AssignedUser) { 82 | $parameters['AssignedUser'], $AssignedUser 83 | } 84 | 85 | if ($FriendlyName) { 86 | $parameters['FriendlyName'], $FriendlyName 87 | } 88 | 89 | # Set Error Action to Stop 90 | $ErrorActionPreference = "Stop" 91 | 92 | try { 93 | # Update the Azure Virtual Desktop Session Host and capture the result 94 | $result = Update-AzWvdSessionHost @parameters 95 | 96 | # Output the result 97 | Write-Output "Azure Virtual Desktop Session Host updated successfully:" 98 | Write-Output $result 99 | 100 | } catch [System.Exception] { 101 | 102 | Write-Error "Failed to update the Azure Virtual Desktop Session Host: $($_.Exception.Message)" 103 | 104 | } finally { 105 | # Cleanup code if needed 106 | Write-Output "Script execution completed." 107 | } 108 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Update-AzWvdApplicationGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates an Azure Virtual Desktop Application Group. 4 | 5 | .DESCRIPTION 6 | This script updates the properties of an Azure Virtual Desktop Application Group. 7 | 8 | .PARAMETER Name 9 | The name of the application group. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .PARAMETER Description 15 | The description of the application group. 16 | 17 | .PARAMETER FriendlyName 18 | The friendly name of the application group. 19 | 20 | .PARAMETER ShowInFeed 21 | Specifies whether to show the application group in the feed. 22 | 23 | .PARAMETER Tags 24 | A hashtable of tags to assign to the application group. 25 | 26 | .EXAMPLE 27 | PS C:\> .\ v.ps1 -Name "MyAppGroup" -ResourceGroup "MyResourceGroup" -Description "Updated Description" 28 | 29 | .LINK 30 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/update-azwvdapplicationgroup?view=azps-12.3.0 34 | 35 | .LINK 36 | https://github.com/xoap-io/scripted-actions 37 | 38 | .COMPONENT 39 | Azure PowerShell 40 | 41 | #> 42 | 43 | [CmdletBinding()] 44 | param ( 45 | [Parameter(Mandatory=$true)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$Name, 48 | 49 | [Parameter(Mandatory=$true)] 50 | [ValidateNotNullOrEmpty()] 51 | [string]$ResourceGroup, 52 | 53 | [Parameter(Mandatory=$false)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$Description, 56 | 57 | [Parameter(Mandatory=$false)] 58 | [ValidateNotNullOrEmpty()] 59 | [string]$FriendlyName, 60 | 61 | [Parameter(Mandatory=$false)] 62 | [ValidateNotNullOrEmpty()] 63 | [switch]$ShowInFeed, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [ValidateNotNullOrEmpty()] 67 | [hashtable]$Tags 68 | ) 69 | 70 | # Splatting parameters for better readability 71 | $parameters = @{ 72 | Name = $Name 73 | ResourceGroup = $ResourceGroup 74 | } 75 | 76 | if ($Description) { 77 | $parameters['Description'], $Description 78 | } 79 | 80 | if ($FriendlyName) { 81 | $parameters['FriendlyName'], $FriendlyName 82 | } 83 | 84 | if ($ShowInFeed) { 85 | $parameters['ShowInFeed'], $ShowInFeed 86 | } 87 | 88 | if ($Tags) { 89 | $parameters['Tag'], $Tags 90 | } 91 | 92 | # Set Error Action to Stop 93 | $ErrorActionPreference = "Stop" 94 | 95 | try { 96 | # Update the Azure Virtual Desktop Application Group and capture the result 97 | $result = Update-AzWvdApplicationGroup @parameters 98 | 99 | # Output the result 100 | Write-Output "Azure Virtual Desktop Application Group updated successfully:" 101 | Write-Output $result 102 | 103 | } catch [System.Exception] { 104 | 105 | Write-Error "Failed to update the Azure Virtual Desktop Application Group: $($_.Exception.Message)" 106 | 107 | } finally { 108 | # Cleanup code if needed 109 | Write-Output "Script execution completed." 110 | } 111 | -------------------------------------------------------------------------------- /azure-cli/vms/az-cli-install-webserver-vm.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install a web server on an Azure Virtual Machine and open the specified ports. 4 | 5 | .DESCRIPTION 6 | This script installs a web server on an Azure Virtual Machine and opens the specified ports. 7 | The script uses the Azure CLI to run a PowerShell script on the Azure Virtual Machine and open the specified ports. 8 | The script uses the following Azure CLI commands: 9 | az vm run-command invoke ` 10 | --resource-group $AzResourceGroup ` 11 | --vm-name $VmName ` 12 | --command-id RunPowerShellScript ` 13 | --scripts $Script 14 | 15 | az vm open-port ` 16 | --port $AZOpenPorts ` 17 | --resource-group $AzResourceGroup ` 18 | --vm-name $VmName 19 | 20 | .PARAMETER AzResourceGroup 21 | Defines the name of the Azure Resource Group. 22 | 23 | .PARAMETER AzVmName 24 | Defines the name of the Azure Virtual Machine. 25 | 26 | .PARAMETER Script 27 | Defines the PowerShell command to run on the Azure Virtual Machine. 28 | 29 | .PARAMETER AzOpenPorts 30 | Defines the ports to open on the Azure Virtual Machine. 31 | 32 | .EXAMPLE 33 | .\az-cli-install-webserver-vm.ps1 -AzResourceGroup "MyResourceGroup" -AzVmName "MyVmName" -Script "Install-WindowsFeature -name Web-Server -IncludeManagementTools" -AzOpenPorts "80" 34 | 35 | .LINK 36 | https://learn.microsoft.com/en-us/cli/azure/vm 37 | #> 38 | 39 | [CmdletBinding()] 40 | param( 41 | [Parameter(Mandatory=$true)] 42 | [ValidateNotNullOrEmpty()] 43 | [string]$AzResourceGroup = "myResourceGroup", 44 | 45 | [Parameter(Mandatory=$true)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$AzVmName = "myVmName", 48 | 49 | [Parameter(Mandatory=$true)] 50 | [ValidateNotNullOrEmpty()] 51 | [string]$Script = "Install-WindowsFeature -name Web-Server -IncludeManagementTools", 52 | 53 | [Parameter(Mandatory=$true)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$AzOpenPorts = '80' 56 | ) 57 | 58 | # Splatting parameters for better readability 59 | $parameters = @{ 60 | resource_group = $AzResourceGroup 61 | vm_name = $AzVmName 62 | command_id = "RunPowerShellScript" 63 | scripts = $Script 64 | port = $AzOpenPorts 65 | debug = $AzDebug 66 | only_show_errors = $AzOnlyShowErrors 67 | output = $AzOutput 68 | query = $AzQuery 69 | verbose = $AzVerbose 70 | } 71 | 72 | # Set Error Action to Stop 73 | $ErrorActionPreference = "Stop" 74 | 75 | try { 76 | # Install web server on the Azure VM 77 | az vm run-command invoke @parameters 78 | 79 | # Open the specified ports on the Azure VM 80 | az vm open-port @parameters 81 | 82 | # Output the result 83 | Write-Output "Web server installed and ports opened successfully on the Azure VM." 84 | } catch { 85 | # Log the error to the console 86 | 87 | Write-Output "Error message $errorMessage" 88 | 89 | 90 | Write-Error "Failed to install web server or open ports on the Azure VM: $($_.Exception.Message)" 91 | } finally { 92 | # Cleanup code if needed 93 | Write-Output "Script execution completed." 94 | } -------------------------------------------------------------------------------- /azure-ps/avd/stack/Update-AzWvdMsixPackage.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates an Azure Virtual Desktop MSIX Package. 4 | 5 | .DESCRIPTION 6 | This script updates the properties of an Azure Virtual Desktop MSIX Package. 7 | 8 | .PARAMETER FullName 9 | The full name of the MSIX package. 10 | 11 | .PARAMETER HostPoolName 12 | The name of the host pool. 13 | 14 | .PARAMETER ResourceGroup 15 | The name of the resource group. 16 | 17 | .PARAMETER DisplayName 18 | The display name of the MSIX package. 19 | 20 | .PARAMETER IsActive 21 | Specifies whether the MSIX package is active. 22 | 23 | .PARAMETER IsRegularRegistration 24 | Specifies whether the MSIX package is a regular registration. 25 | 26 | .EXAMPLE 27 | PS C:\> .\Update-AzWvdMsixPackage.ps1 -FullName "MyMsixPackage" -HostPoolName "MyHostPool" -ResourceGroup "MyResourceGroup" -DisplayName "Updated Display Name" 28 | 29 | .LINK 30 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/update-azwvdmsixpackage?view=azps-12.3.0&viewFallbackFrom=azps-12.1.0 34 | 35 | .LINK 36 | https://github.com/xoap-io/scripted-actions 37 | 38 | .COMPONENT 39 | Azure PowerShell 40 | 41 | #> 42 | 43 | [CmdletBinding()] 44 | param ( 45 | [Parameter(Mandatory=$true)] 46 | [ValidateNotNullOrEmpty()] 47 | [string]$FullName, 48 | 49 | [Parameter(Mandatory=$true)] 50 | [ValidateNotNullOrEmpty()] 51 | [string]$HostPoolName, 52 | 53 | [Parameter(Mandatory=$true)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$ResourceGroup, 56 | 57 | [Parameter(Mandatory=$false)] 58 | [ValidateNotNullOrEmpty()] 59 | [string]$DisplayName, 60 | 61 | [Parameter(Mandatory=$false)] 62 | [ValidateNotNullOrEmpty()] 63 | [switch]$IsActive, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [ValidateNotNullOrEmpty()] 67 | [switch]$IsRegularRegistration 68 | ) 69 | 70 | # Set Error Action to Stop 71 | $ErrorActionPreference = "Stop" 72 | 73 | # Splatting parameters for better readability 74 | $parameters = @{ 75 | FullName = $FullName 76 | HostPoolName = $HostPoolName 77 | ResourceGroup = $ResourceGroup 78 | } 79 | 80 | if ($DisplayName) { 81 | $parameters['DisplayName'], $DisplayName 82 | } 83 | 84 | if ($IsActive) { 85 | $parameters['IsActive'], $IsActive 86 | } 87 | 88 | if ($IsRegularRegistration) { 89 | $parameters['IsRegularRegistration'], $IsRegularRegistration 90 | } 91 | 92 | try { 93 | # Update the Azure Virtual Desktop MSIX Package and capture the result 94 | $result = Update-AzWvdMsixPackage @parameters 95 | 96 | # Output the result 97 | Write-Output "Azure Virtual Desktop MSIX Package updated successfully:" 98 | Write-Output $result 99 | 100 | } catch [System.Exception] { 101 | 102 | Write-Error "Failed to update the Azure Virtual Desktop MSIX Package: $($_.Exception.Message)" 103 | 104 | } finally { 105 | # Cleanup code if needed 106 | Write-Output "Script execution completed." 107 | } 108 | -------------------------------------------------------------------------------- /azure-cli/storage/az-cli-delete-share.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Deletes an Azure Storage share. 4 | 5 | .DESCRIPTION 6 | This script deleted an Azure Storage share with the specified parameters using the Azure CLI. 7 | 8 | .PARAMETER Ids 9 | One or more resource IDs (space-delimited). 10 | 11 | .PARAMETER Include 12 | A comma-separated list of additional properties to include in the response. 13 | 14 | .PARAMETER Name 15 | The name of the storage share. 16 | 17 | .PARAMETER ResourceGroup 18 | The name of the resource group. 19 | 20 | .PARAMETER Snapshot 21 | The name of the snapshot. 22 | 23 | .PARAMETER StorageAccount 24 | The name of the storage account. 25 | 26 | .PARAMETER Yes 27 | Do not prompt for confirmation. 28 | 29 | .EXAMPLE 30 | .\az-cli-delete-share.ps1 -Name "MyShare" -StorageAccount "MyStorageAccount" -ResourceGroup "MyResourceGroup" 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/cli/azure/storage/share-rm 34 | 35 | .LINK 36 | https://learn.microsoft.com/en-us/cli/azure/storage/share-rm?view=azure-cli-latest 37 | 38 | .LINK 39 | https://github.com/xoap-io/scripted-actions 40 | 41 | .COMPONENT 42 | Azure CLI 43 | #> 44 | 45 | [CmdletBinding()] 46 | param ( 47 | [Parameter(Mandatory=$true)] 48 | [ValidateNotNullOrEmpty()] 49 | [string]$Ids, 50 | 51 | [Parameter(Mandatory=$false)] 52 | [ValidateNotNullOrEmpty()] 53 | [string]$Include, 54 | 55 | [Parameter(Mandatory=$true)] 56 | [ValidateNotNullOrEmpty()] 57 | [string]$Name, 58 | 59 | [Parameter(Mandatory=$true)] 60 | [ValidateNotNullOrEmpty()] 61 | [string]$ResourceGroup, 62 | 63 | [Parameter(Mandatory=$false)] 64 | [ValidateNotNullOrEmpty()] 65 | [string]$Snapshot, 66 | 67 | [Parameter(Mandatory=$true)] 68 | [ValidateNotNullOrEmpty()] 69 | [string]$StorageAccount, 70 | 71 | [Parameter(Mandatory=$false)] 72 | [ValidateNotNullOrEmpty()] 73 | [string]$Subscription, 74 | 75 | [Parameter(Mandatory=$false)] 76 | [ValidateNotNullOrEmpty()] 77 | [switch]$Yes 78 | ) 79 | 80 | # Set Error Action to Stop 81 | $ErrorActionPreference = "Stop" 82 | 83 | # Splatting parameters for better readability 84 | $parameters = ` 85 | '--name', $Name 86 | '--storage-account', $StorageAccount 87 | '--resource-group', $ResourceGroup 88 | 89 | if ($Ids) { 90 | $parameters += '--ids', $Ids 91 | } 92 | 93 | if ($Include) { 94 | $parameters += '--include', $Include 95 | } 96 | 97 | if ($Snapshot) { 98 | $parameters += '--snapshot', $Snapshot 99 | } 100 | 101 | if ($Yes) { 102 | $parameters += '--yes' 103 | } 104 | 105 | try { 106 | # Delete a share 107 | az storage share-rm delete @parameters 108 | 109 | # Output the result 110 | Write-Output "Azure Storage Account share deleted successfully." 111 | 112 | } catch { 113 | # Log the error to the console 114 | Write-Output "Error message $errorMessage" 115 | Write-Error "Failed to delete the Azure Storage Account share: $($_.Exception.Message)" 116 | 117 | } finally { 118 | # Cleanup code if needed 119 | Write-Output "Script execution completed." 120 | } 121 | -------------------------------------------------------------------------------- /azure-cli/vms/az-cli-share-image-gallery.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Share an Azure Image Gallery with a user. 4 | 5 | .DESCRIPTION 6 | This script shares an Azure Image Gallery with a user. The script uses the Azure CLI to assign the Reader role to the Image Gallery for the specified user. 7 | 8 | The script uses the following Azure CLI commands: 9 | az sig show ` 10 | --resource-group $AzResourceGroup ` 11 | --gallery-name $AzGalleryName ` 12 | --query id 13 | 14 | az role assignment create ` 15 | --role "Reader" ` 16 | --assignee $EmailAddress ` 17 | --scope $GalleryId 18 | 19 | .PARAMETER AzResourceGroup 20 | Defines the name of the Azure Resource Group. 21 | 22 | .PARAMETER AzGalleryName 23 | Defines the name of the Azure Image Gallery. 24 | 25 | .PARAMETER EmailAddress 26 | Defines the email address of the user to assign the Reader role to the Image Gallery. 27 | 28 | .PARAMETER AzDebug 29 | Increase logging verbosity to show all debug logs. 30 | 31 | .PARAMETER AzOnlyShowErrors 32 | Only show errors, suppressing warnings. 33 | 34 | .PARAMETER AzOutput 35 | Output format. 36 | 37 | .PARAMETER AzQuery 38 | JMESPath query string. 39 | 40 | .PARAMETER AzVerbose 41 | Increase logging verbosity. 42 | 43 | .PARAMETER WhatIf 44 | Shows what would happen if the cmdlet runs. The cmdlet is not run. 45 | 46 | .PARAMETER Confirm 47 | Prompts you for confirmation before running the cmdlet. 48 | 49 | .EXAMPLE 50 | .\az-cli-share-image-gallery.ps1 -AzResourceGroup "MyResourceGroup" -AzGalleryName "MyGallery" -EmailAddress "user@example.com" 51 | 52 | .LINK 53 | https://learn.microsoft.com/en-us/cli/azure/vm 54 | #> 55 | 56 | [CmdletBinding()] 57 | param( 58 | [Parameter(Mandatory=$true)] 59 | [ValidateNotNullOrEmpty()] 60 | [string]$AzResourceGroup = "myResourceGroup", 61 | 62 | [Parameter(Mandatory=$true)] 63 | [ValidateNotNullOrEmpty()] 64 | [string]$AzGalleryName = "myGallery", 65 | 66 | [Parameter(Mandatory=$true)] 67 | [ValidateNotNullOrEmpty()] 68 | [string]$EmailAddress = "hello@xoap.io" 69 | ) 70 | 71 | # Splatting parameters for better readability 72 | $parameters = @{ 73 | resource_group = $AzResourceGroup 74 | gallery_name = $AzGalleryName 75 | query = "id" 76 | role = "Reader" 77 | assignee = $EmailAddress 78 | scope = "" 79 | } 80 | 81 | # Set Error Action to Stop 82 | $ErrorActionPreference = "Stop" 83 | 84 | try { 85 | # Get the Gallery ID 86 | $GalleryId = az sig show @parameters 87 | 88 | # Update the scope with the Gallery ID 89 | $parameters.scope = $GalleryId 90 | 91 | # Assign the Reader role to the user 92 | az role assignment create @parameters 93 | 94 | # Output the result 95 | Write-Output "Azure Image Gallery shared successfully." 96 | } catch { 97 | # Log the error to the console 98 | 99 | Write-Output "Error message $errorMessage" 100 | 101 | 102 | Write-Error "Failed to share the Azure Image Gallery: $($_.Exception.Message)" 103 | } finally { 104 | # Cleanup code if needed 105 | Write-Output "Script execution completed." 106 | } -------------------------------------------------------------------------------- /azure-ps/avd/stack/Set-AzKeyVaultSecret.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Sets a secret in an Azure Key Vault. 4 | 5 | .DESCRIPTION 6 | This script sets a secret in an Azure Key Vault with the specified parameters. 7 | 8 | .PARAMETER VaultName 9 | The name of the Azure Key Vault. 10 | 11 | .PARAMETER Name 12 | The name of the secret. 13 | 14 | .PARAMETER SecretValue 15 | The value of the secret as a secure string. 16 | 17 | .PARAMETER Disable 18 | Indicates whether the secret should be disabled. 19 | 20 | .PARAMETER Expires 21 | The expiration date of the secret. 22 | 23 | .PARAMETER NotBefore 24 | The date before which the secret cannot be used. 25 | 26 | .PARAMETER ContentType 27 | The content type of the secret. 28 | 29 | .PARAMETER Tag 30 | A hashtable of tags to apply to the secret. 31 | 32 | .EXAMPLE 33 | .\Set-AzKeyVaultSecret.ps1 -VaultName "MyKeyVault" -Name "MySecret" -SecretValue (ConvertTo-SecureString "MySecretValue" -AsPlainText -Force) 34 | 35 | .NOTES 36 | Author: Your Name 37 | Date: 2024-09-30 38 | Version: 1.0 39 | Requires: Az.KeyVault module 40 | 41 | .LINK 42 | https://learn.microsoft.com/en-us/powershell/module/az.keyvault 43 | 44 | .LINK 45 | https://learn.microsoft.com/en-us/powershell/module/az.keyvault/set-azkeyvaultsecret?view=azps-12.3.0 46 | 47 | .LINK 48 | https://github.com/xoap-io/scripted-actions 49 | 50 | .COMPONENT 51 | Azure PowerShell 52 | #> 53 | 54 | [CmdletBinding()] 55 | param ( 56 | [Parameter(Mandatory=$true)] 57 | [ValidateNotNullOrEmpty()] 58 | [string]$VaultName, 59 | 60 | [Parameter(Mandatory=$true)] 61 | [ValidateNotNullOrEmpty()] 62 | [string]$Name, 63 | 64 | [Parameter(Mandatory=$true)] 65 | [ValidateNotNullOrEmpty()] 66 | [SecureString]$SecretValue, 67 | 68 | [Parameter(Mandatory=$false)] 69 | [switch]$Disable, 70 | 71 | [Parameter(Mandatory=$false)] 72 | [ValidateNotNullOrEmpty()] 73 | [DateTime]$Expires, 74 | 75 | [Parameter(Mandatory=$false)] 76 | [ValidateNotNullOrEmpty()] 77 | [DateTime]$NotBefore, 78 | 79 | [Parameter(Mandatory=$false)] 80 | [ValidateNotNullOrEmpty()] 81 | [string]$ContentType, 82 | 83 | [Parameter(Mandatory=$false)] 84 | [hashtable]$Tags 85 | ) 86 | 87 | # Set Error Action to Stop 88 | $ErrorActionPreference = "Stop" 89 | 90 | try { 91 | # Splatting parameters 92 | $params = @{ 93 | VaultName = $VaultName 94 | Name = $Name 95 | SecretValue = $SecretValue 96 | } 97 | 98 | if ($Disable) { 99 | $params['Disable'], $true 100 | } 101 | 102 | if ($Expires) { 103 | $params['Expires'], $Expires 104 | } 105 | 106 | if ($NotBefore) { 107 | $params['NotBefore'], $NotBefore 108 | } 109 | 110 | if ($ContentType) { 111 | $params['ContentType'], $ContentType 112 | } 113 | 114 | if ($Tags) { 115 | $params['Tag'], $Tags 116 | } 117 | 118 | # Set the secret in the Key Vault 119 | Set-AzKeyVaultSecret @params 120 | Write-Host "Secret '$Name' set successfully in Key Vault '$VaultName'." 121 | } 122 | catch { 123 | Write-Error "An error occurred while setting the secret: $_" 124 | } 125 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/New-AzResourceGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create a new Azure Resource Group with the Azure PowerShell. 4 | 5 | .DESCRIPTION 6 | This script creates a new Azure Resource Group with the Azure PowerShell. 7 | The script uses the following Azure PowerShell command: 8 | New-AzResourceGroup -Name $AzResourceGroup -Location $AzLocation 9 | 10 | .PARAMETER ResourceGroup 11 | Defines the name of the Azure Resource Group. 12 | 13 | .PARAMETER Location 14 | Defines the location of the Azure Resource Group. 15 | 16 | .PARAMETER Tags 17 | Defines the tags for the Azure Resource Group. 18 | 19 | .EXAMPLE 20 | .\New-AzResourceGroup.ps1 -AzResourceGroup "myResourceGroup" -AzLocation "westus" 21 | 22 | .LINK 23 | https://learn.microsoft.com/en-us/powershell/module/az.Resources 24 | 25 | .LINK 26 | https://learn.microsoft.com/en-us/powershell/module/az.resources/new-azresourcegroup?view=azps-12.3.0 27 | 28 | .LINK 29 | https://github.com/xoap-io/scripted-actions 30 | 31 | .COMPONENT 32 | Azure PowerShell 33 | 34 | #> 35 | 36 | [CmdletBinding()] 37 | param( 38 | [Parameter(Mandatory=$true)] 39 | [ValidateNotNullOrEmpty()] 40 | [string]$ResourceGroup, 41 | 42 | [Parameter(Mandatory=$true)] 43 | [ValidateNotNullOrEmpty()] 44 | [ValidateSet( 45 | 'eastus', 'eastus2', 'southcentralus', 'westus2', 46 | 'westus3', 'australiaeast', 'southeastasia', 'northeurope', 47 | 'swedencentral', 'uksouth', 'westeurope', 'centralus', 48 | 'southafricanorth', 'centralindia', 'eastasia', 'japaneast', 49 | 'koreacentral', 'canadacentral', 'francecentral', 'germanywestcentral', 50 | 'italynorth', 'norwayeast', 'polandcentral', 'switzerlandnorth', 51 | 'uaenorth', 'brazilsouth', 'israelcentral', 'qatarcentral', 52 | 'asia', 'asiapacific', 'australia', 'brazil', 53 | 'canada', 'europe', 'france', 54 | 'global', 'india', 'japan', 'korea', 55 | 'norway', 'singapore', 'southafrica', 'sweden', 56 | 'switzerland', 'unitedstates', 'northcentralus', 'westus', 57 | 'japanwest', 'centraluseuap', 'eastus2euap', 'westcentralus', 58 | 'southafricawest', 'australiacentral', 'australiacentral2', 'australiasoutheast', 59 | 'koreasouth', 'southindia', 'westindia', 'canadaeast', 60 | 'francesouth', 'germanynorth', 'norwaywest', 'switzerlandwest', 61 | 'ukwest', 'uaecentral', 'brazilsoutheast' 62 | )] 63 | [string]$Location, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [ValidateNotNullOrEmpty()] 67 | [hashtable]$Tags 68 | ) 69 | 70 | # Splatting parameters for better readability 71 | $parameters = @{ 72 | Name = $ResourceGroup 73 | Location = $Location 74 | } 75 | 76 | if ($Tags) { 77 | $parameters['Tag'], $Tags 78 | } 79 | 80 | # Set Error Action to Stop 81 | $ErrorActionPreference = "Stop" 82 | 83 | try { 84 | # Create the Resource Group 85 | New-AzResourceGroup @parameters 86 | 87 | # Output the result 88 | Write-Output "Azure Resource Group '$($ResourceGroup)' created successfully in location '$($Location)'." 89 | 90 | } catch { 91 | # Log the error to the console 92 | Write-Output "Error message $errorMessage" 93 | Write-Error "Failed to create Azure Resource Group: $($_.Exception.Message)" 94 | 95 | } finally { 96 | # Cleanup code if needed 97 | Write-Output "Script execution completed." 98 | } 99 | -------------------------------------------------------------------------------- /azure-cli/resource-manager/az-cli-delete-resource-group.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete an Azure Resource Group. 4 | 5 | .DESCRIPTION 6 | This script deletes an Azure Resource Group. 7 | 8 | The script uses the Azure CLI to delete the specified Azure Resource Group. 9 | 10 | The script uses the following Azure CLI command: 11 | az group delete ` 12 | --resource-group $AzResourceGroup 13 | 14 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 15 | 16 | It does not return any output. 17 | 18 | .NOTES 19 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 20 | The use of the scripts does not require XOAP, but it will make your life easier. 21 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 22 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 23 | the use and the consequences of the use of this freely available script. 24 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 25 | 26 | .PARAMETER Name 27 | Defines the name of the Azure Resource Group. 28 | 29 | .PARAMETER ForceDeletionTypes 30 | Defines the force deletion types of the Azure Resource Group. 31 | 32 | .PARAMETER NoWait 33 | Defines the no-wait status of the Azure Resource Group. 34 | 35 | .PARAMETER Yes 36 | Do not prompt for confirmation. 37 | 38 | .LINK 39 | https://learn.microsoft.com/en-us/cli/azure/group 40 | 41 | .LINK 42 | https://learn.microsoft.com/en-us/cli/azure/group?view=azure-cli-latest 43 | 44 | .LINK 45 | https://github.com/xoap-io/scripted-actions 46 | 47 | .COMPONENT 48 | Azure CLI 49 | #> 50 | 51 | [CmdletBinding()] 52 | param( 53 | [Parameter(Mandatory=$true)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$Name, 56 | 57 | [Parameter(Mandatory=$false)] 58 | [ValidateNotNullOrEmpty()] 59 | [ValidateSet( 60 | 'Microsoft.Compute/virtualMachineScaleSets', 61 | 'Microsoft.Compute/virtualMachines', 62 | 'Microsoft.Databricks/workspaces' 63 | )] 64 | [string]$ForceDeletionTypes, 65 | 66 | [Parameter(Mandatory=$false)] 67 | [ValidateNotNullOrEmpty()] 68 | [bool]$NoWait, 69 | 70 | [Parameter(Mandatory=$false)] 71 | [ValidateNotNullOrEmpty()] 72 | [bool]$Yes 73 | ) 74 | 75 | $parameters = ` 76 | '--resource-group', $Name 77 | 78 | if ($ForceDeletionTypes) { 79 | $parameters += '--force-deletion-types', $ForceDeletionTypes 80 | } 81 | 82 | if ($NoWait) { 83 | $parameters += '--no-wait' 84 | } 85 | 86 | if ($Yes) { 87 | $parameters += '--yes' 88 | } 89 | 90 | # Set Error Action to Stop 91 | $ErrorActionPreference = "Stop" 92 | 93 | try { 94 | # Delete an Azure Resource Group 95 | az group delete @parameters 96 | 97 | # Output the result 98 | Write-Output "Azure Resource Group deleted successfully." 99 | 100 | } catch { 101 | # Log the error to the console 102 | Write-Output "Error message $errorMessage" 103 | Write-Error "Failed to delete the Azure Resource Group: $($_.Exception.Message)" 104 | 105 | } finally { 106 | # Cleanup code if needed 107 | Write-Output "Script execution completed." 108 | } 109 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 2 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 3 | 4 | # User-specific stuff 5 | .idea/**/workspace.xml 6 | .idea/**/tasks.xml 7 | .idea/**/usage.statistics.xml 8 | .idea/**/dictionaries 9 | .idea/**/shelf 10 | 11 | # AWS User-specific 12 | .idea/**/aws.xml 13 | 14 | # Generated files 15 | .idea/**/contentModel.xml 16 | 17 | # Sensitive or high-churn files 18 | .idea/**/dataSources/ 19 | .idea/**/dataSources.ids 20 | .idea/**/dataSources.local.xml 21 | .idea/**/sqlDataSources.xml 22 | .idea/**/dynamic.xml 23 | .idea/**/uiDesigner.xml 24 | .idea/**/dbnavigator.xml 25 | 26 | # Gradle 27 | .idea/**/gradle.xml 28 | .idea/**/libraries 29 | 30 | # Gradle and Maven with auto-import 31 | # When using Gradle or Maven with auto-import, you should exclude module files, 32 | # since they will be recreated, and may cause churn. Uncomment if using 33 | # auto-import. 34 | # .idea/artifacts 35 | # .idea/compiler.xml 36 | # .idea/jarRepositories.xml 37 | # .idea/modules.xml 38 | # .idea/*.iml 39 | # .idea/modules 40 | # *.iml 41 | # *.ipr 42 | 43 | # CMake 44 | cmake-build-*/ 45 | 46 | # Mongo Explorer plugin 47 | .idea/**/mongoSettings.xml 48 | 49 | # File-based project format 50 | *.iws 51 | 52 | # IntelliJ 53 | out/ 54 | 55 | # mpeltonen/sbt-idea plugin 56 | .idea_modules/ 57 | 58 | # JIRA plugin 59 | atlassian-ide-plugin.xml 60 | 61 | # Cursive Clojure plugin 62 | .idea/replstate.xml 63 | 64 | # SonarLint plugin 65 | .idea/sonarlint/ 66 | 67 | # Crashlytics plugin (for Android Studio and IntelliJ) 68 | com_crashlytics_export_strings.xml 69 | crashlytics.properties 70 | crashlytics-build.properties 71 | fabric.properties 72 | 73 | # Editor-based Rest Client 74 | .idea/httpRequests 75 | 76 | # Android studio 3.1+ serialized cache file 77 | .idea/caches/build_file_checksums.ser 78 | 79 | # VSCode ----------------------------------------------------------- 80 | 81 | .vscode/* 82 | !.vscode/settings.json 83 | !.vscode/tasks.json 84 | !.vscode/launch.json 85 | !.vscode/extensions.json 86 | !.vscode/*.code-snippets 87 | 88 | # Local History for Visual Studio Code 89 | .history/ 90 | 91 | # Built Visual Studio Code Extensions 92 | *.vsix 93 | 94 | # Windows ----------------------------------------------------------- 95 | 96 | # Windows thumbnail cache files 97 | Thumbs.db 98 | Thumbs.db:encryptable 99 | ehthumbs.db 100 | ehthumbs_vista.db 101 | 102 | # Dump file 103 | *.stackdump 104 | 105 | # Folder config file 106 | [Dd]esktop.ini 107 | 108 | # Recycle Bin used on file shares 109 | $RECYCLE.BIN/ 110 | 111 | # Windows Installer files 112 | *.cab 113 | *.msi 114 | *.msix 115 | *.msm 116 | *.msp 117 | 118 | # Windows shortcuts 119 | *.lnk 120 | 121 | # macOS ----------------------------------------------------------- 122 | 123 | # General 124 | .DS_Store 125 | .AppleDouble 126 | .LSOverride 127 | 128 | # Icon must end with two `r 129 | Icon 130 | 131 | # Thumbnails 132 | ._* 133 | 134 | # Files that might appear in the root of a volume 135 | .DocumentRevisions-V100 136 | .fseventsd 137 | .Spotlight-V100 138 | .TemporaryItems 139 | .Trashes 140 | .VolumeIcon.icns 141 | .com.apple.timemachine.donotpresent 142 | 143 | # Directories potentially created on remote AFP share 144 | .AppleDB 145 | .AppleDesktop 146 | Network Trash Folder 147 | Temporary Items 148 | .apdisk -------------------------------------------------------------------------------- /azure-cli/vms/az-cli-create-vm-scale-set.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create an Azure Virtual Machine Scale Set. 4 | 5 | .DESCRIPTION 6 | This script creates an Azure Virtual Machine Scale Set. 7 | The script uses the Azure CLI to create the specified Azure Virtual Machine Scale Set. 8 | The script uses the following Azure CLI command: 9 | az vmss create --resource-group $AzResourceGroup --name $AzScaleSetName --orchestration-mode $AzOrchestrationMode --image $AzSkuImage --instance-count $AzScaleSetInstanceCount --admin-username $AzAdminUserName --generate-ssh-keys 10 | 11 | .PARAMETER AzResourceGroup 12 | Defines the name of the Azure Resource Group. 13 | 14 | .PARAMETER AzScaleSetName 15 | Defines the name of the Azure Scale Set. 16 | 17 | .PARAMETER AzOrchestrationMode 18 | Defines the orchestration mode of the Azure Scale Set. 19 | 20 | .PARAMETER AzSkuImage 21 | Defines the SKU image of the Azure Scale Set. 22 | 23 | .PARAMETER AzScaleSetInstanceCount 24 | Defines the instance count of the Azure Scale Set. 25 | 26 | .PARAMETER AzAdminUserName 27 | Defines the admin username of the Azure Scale Set. 28 | 29 | .EXAMPLE 30 | .\az-cli-create-vm-scale-set.ps1 -AzResourceGroup "MyResourceGroup" -AzScaleSetName "MyScaleSet" -AzOrchestrationMode "Flexible" -AzSkuImage "UbuntuLTS" -AzScaleSetInstanceCount 2 -AzAdminUserName "azureuser" 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/cli/azure/vmss 34 | #> 35 | 36 | [CmdletBinding()] 37 | param( 38 | [Parameter(Mandatory=$true)] 39 | [ValidateNotNullOrEmpty()] 40 | [string]$AzResourceGroup = 'myResourceGroup', 41 | 42 | [Parameter(Mandatory=$true)] 43 | [ValidateNotNullOrEmpty()] 44 | [string]$AzScaleSetName = 'myScaleSet', 45 | 46 | [Parameter(Mandatory=$true)] 47 | [ValidateSet("Flexible", "Uniform")] 48 | [string]$AzOrchestrationMode = 'Flexible', 49 | 50 | [Parameter(Mandatory=$true)] 51 | [ValidateNotNullOrEmpty()] 52 | [string]$AzSkuImage = 'UbuntuLTS', 53 | 54 | [Parameter(Mandatory=$true)] 55 | [ValidateNotNullOrEmpty()] 56 | [int]$AzScaleSetInstanceCount = 2, 57 | 58 | [Parameter(Mandatory=$true)] 59 | [ValidateNotNullOrEmpty()] 60 | [string]$AzAdminUserName = 'azureuser' 61 | ) 62 | 63 | # Splatting parameters for better readability 64 | $parameters = @{ 65 | resource_group = $AzResourceGroup 66 | name = $AzScaleSetName 67 | orchestration_mode = $AzOrchestrationMode 68 | image = $AzSkuImage 69 | instance_count = $AzScaleSetInstanceCount 70 | admin_username = $AzAdminUserName 71 | subscription = $AzSubscription 72 | debug = $AzDebug 73 | only_show_errors = $AzOnlyShowErrors 74 | output = $AzOutput 75 | query = $AzQuery 76 | verbose = $AzVerbose 77 | } 78 | 79 | # Set Error Action to Stop 80 | $ErrorActionPreference = "Stop" 81 | 82 | try { 83 | # Create an Azure Virtual Machine Scale Set 84 | az vmss create @parameters 85 | 86 | # Output the result 87 | Write-Output "Azure Virtual Machine Scale Set created successfully." 88 | } catch { 89 | # Log the error to the console 90 | 91 | Write-Output "Error message $errorMessage" 92 | 93 | 94 | Write-Error "Failed to create the Azure Virtual Machine Scale Set: $($_.Exception.Message)" 95 | } finally { 96 | # Cleanup code if needed 97 | Write-Output "Script execution completed." 98 | } -------------------------------------------------------------------------------- /aws-ps/ec2/aws-ps-create-ec2-instance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an EC2 instance in AWS. 4 | 5 | .DESCRIPTION 6 | This script creates an EC2 instance in AWS. The script uses the following AWS CLI command: 7 | aws ec2 run-instances --image-id $AwsAmiId --count $AwsInstanceCount --instance-type $AwsInstanceType --key-name $AwsKeyPairName --security-group-ids $AwsSecurityGroupId --subnet-id $AwsSubnetId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsAmiId 28 | Defines the ID of the Amazon Machine Image (AMI). 29 | 30 | .PARAMETER AwsInstanceCount 31 | Defines the number of instances to launch. 32 | 33 | .PARAMETER AwsInstanceType 34 | Defines the type of instance to launch. 35 | 36 | .PARAMETER AwsKeyPairName 37 | Defines the name of the key pair. 38 | 39 | .PARAMETER AwsSecurityGroupId 40 | Defines the ID of the security group. 41 | 42 | .PARAMETER AwsSubnetId 43 | Defines the ID of the subnet. 44 | 45 | #> 46 | [CmdletBinding()] 47 | param( 48 | [Parameter(Mandatory)] 49 | [string]$AwsAmiId = "myAmiId", 50 | [Parameter(Mandatory)] 51 | [int]$AwsInstanceCount = 1, 52 | [Parameter(Mandatory)] 53 | [ValidateSet('t2.micro', 't2.small', 't2.medium', 't2.large', 'm4.large', 'm4.xlarge', 'm4.2xlarge', 'm4.4xlarge', 'm4.10xlarge', 'm4.16xlarge', 'm5.large', 'm5.xlarge', 'm5.2xlarge', 'm5.4xlarge', 'm5.12xlarge', 'm5.24xlarge', 'm5d.large', 'm5d.xlarge', 'm5d.2xlarge', 'm5d.4xlarge', 'm5d.12xlarge', 'm5d.24xlarge', 'c4.large', 'c4.xlarge', 'c4.2xlarge', 'c4.4xlarge', 'c4.8xlarge', 'c5.large', 'c5.xlarge', 'c5.2xlarge', 'c5.4xlarge', 'c5.9xlarge', 'c5.18xlarge', 'c5d.large', 'c5d.xlarge', 'c5d.2xlarge', 'c5d.4xlarge', 'c5d.9xlarge', 'c5d.18xlarge', 'r4.large', 'r4.xlarge', 'r4.2xlarge', 'r4.4xlarge', 'r4.8xlarge', 'r4.16xlarge', 'r5.large', 'r5.xlarge', 'r5.2xlarge', 'r5.4xlarge', 'r5.12xlarge', 'r5.24xlarge', 'r5d.large', 'r5d.xlarge', 'r5d.2xlarge', 'r5d.4xlarge', 'r5d.12xlarge', 'r5d.24xlarge', 'i3.large', 'i3.xlarge', 'i3.2xlarge', 'i3.4xlarge', 'i3.8xlarge', 'i3.16xlarge', 'i3en.large', 'i3en.xlarge', 'i3en.2xlarge', 'i3en.3xlarge')] 54 | [string]$AwsInstanceType, 55 | [Parameter(Mandatory)] 56 | [string]$AwsKeyPairName = "myKeyPairName", 57 | [Parameter(Mandatory)] 58 | [string]$AwsSecurityGroupId = "mySecurityGroupId", 59 | [Parameter(Mandatory)] 60 | [string]$AwsSubnetId = "mySubnetId" 61 | ) 62 | 63 | New-EC2Instance -ImageId $AwsAmiId ` 64 | -MinCount $AwsInstanceCount ` 65 | -MaxCount $AwsInstanceCount ` 66 | -InstanceType $AwsInstanceType ` 67 | -KeyName $AwsKeyPairName ` 68 | -SecurityGroup $AwsSecurityGroupId ` 69 | -SubnetId $AwsSubnetId 70 | -------------------------------------------------------------------------------- /azure-ps/az-ps-install-nginx-linux-vm.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Install Nginx on an Azure Linux VM with Azure PowerShell. 4 | 5 | .DESCRIPTION 6 | This script installs Nginx on an Azure Linux VM with Azure PowerShell. The script uses the Azure PowerShell to run a shell script on the specified Azure VM. 7 | The script uses the following Azure PowerShell command: 8 | Invoke-AzVMRunCommand -ResourceGroup $AzResourceGroup -Name $AzVmName -CommandId 'RunShellScript' -ScriptString 'sudo apt-get update && sudo apt-get install -y nginx' 9 | The script sets the ErrorActionPreference to Stop to handle errors properly. 10 | 11 | .PARAMETER AzResourceGroup 12 | Defines the name of the Azure Resource Group. 13 | 14 | .PARAMETER AzVmName 15 | Defines the name of the Azure VM. 16 | 17 | .PARAMETER AzDebug 18 | Increase logging verbosity to show all debug logs. 19 | 20 | .PARAMETER AzOnlyShowErrors 21 | Only show errors, suppressing warnings. 22 | 23 | .PARAMETER AzOutput 24 | Output format. 25 | 26 | .PARAMETER AzQuery 27 | JMESPath query string. 28 | 29 | .PARAMETER AzVerbose 30 | Increase logging verbosity. 31 | 32 | .PARAMETER WhatIf 33 | Shows what would happen if the cmdlet runs. The cmdlet is not run. 34 | 35 | .PARAMETER Confirm 36 | Prompts you for confirmation before running the cmdlet. 37 | 38 | .EXAMPLE 39 | .\az-ps-install-nginx-linux-vm.ps1 -AzResourceGroup "myResourceGroup" -AzVmName "myVm" 40 | 41 | .NOTES 42 | Ensure that Azure PowerShell is installed and authenticated before running the script. 43 | Author: Your Name 44 | Date: 2024-09-03 45 | Version: 1.1 46 | Requires: Azure PowerShell 47 | 48 | .LINK 49 | https://github.com/xoap-io/scripted-actions 50 | #> 51 | 52 | [CmdletBinding()] 53 | param( 54 | [Parameter(Mandatory=$true)] 55 | [ValidateNotNullOrEmpty()] 56 | [string]$AzResourceGroup = "myResourceGroup", 57 | 58 | [Parameter(Mandatory=$true)] 59 | [ValidateNotNullOrEmpty()] 60 | [string]$AzVmName = "myVm", 61 | 62 | [Parameter(Mandatory=$false)] 63 | [switch]$AzDebug, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [switch]$AzOnlyShowErrors, 67 | 68 | [Parameter(Mandatory=$false)] 69 | [string]$AzOutput, 70 | 71 | [Parameter(Mandatory=$false)] 72 | [string]$AzQuery, 73 | 74 | [Parameter(Mandatory=$false)] 75 | [switch]$AzVerbose, 76 | 77 | 78 | ) 79 | 80 | # Splatting parameters for better readability 81 | $parameters = @{ 82 | ResourceGroup = $AzResourceGroup 83 | Name = $AzVmName 84 | Debug = $AzDebug 85 | OnlyShowErrors = $AzOnlyShowErrors 86 | Output = $AzOutput 87 | Query = $AzQuery 88 | Verbose = $AzVerbose 89 | } 90 | 91 | # Set Error Action to Stop 92 | $ErrorActionPreference = "Stop" 93 | 94 | try { 95 | # Install Nginx on the VM 96 | Invoke-AzVMRunCommand @parameters -CommandId 'RunShellScript' -ScriptString 'sudo apt-get update && sudo apt-get install -y nginx' 97 | 98 | # Output the result 99 | Write-Output "Nginx installed successfully on Azure VM '$($AzVmName)'." 100 | } catch { 101 | # Log the error to the console 102 | 103 | Write-Output "Error message $errorMessage" 104 | 105 | 106 | Write-Error "Failed to install Nginx on Azure VM: $($_.Exception.Message)" 107 | } finally { 108 | # Cleanup code if needed 109 | Write-Output "Script execution completed." 110 | } -------------------------------------------------------------------------------- /azure-ps/Remove-UnusedImages.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Azure Automatic Cleanup Script for Unused Images. 4 | 5 | .DESCRIPTION 6 | This script creates a new Azure Resource Group with the Azure PowerShell. 7 | The script uses the following Azure PowerShell command: 8 | New-AzResourceGroup -Name $AzResourceGroup -Location $AzLocation 9 | 10 | .PARAMETER DryRun 11 | It allows you to simulate the execution of a script or command without actually making any changes to the system. 12 | 13 | .PARAMETER ResourceGroup 14 | Defines the Azure Resource Group that a particular command or operation should target. 15 | 16 | .PARAMETER ImageId 17 | Defines the unique identifier of an image resource in Azure. 18 | 19 | .EXAMPLE 20 | param( 21 | [string]$ResourceGroup, # Name of the target resource group 22 | [string]$ImageId, # Unique ID of the image to check or remove 23 | [switch]$DryRun # Simulate the process without making changes 24 | ) 25 | 26 | .LINK 27 | https://github.com/xoap-io/scripted-actions 28 | 29 | .COMPONENT 30 | Azure PowerShell 31 | 32 | #> 33 | 34 | # Variables 35 | # Specify the subscription ID and resource group(s) 36 | param ( 37 | [switch]$DryRun, 38 | [string]$ResourceGroup 39 | ) 40 | # Set to $false to actually delete the images 41 | 42 | # Function to check if an image is in use 43 | function Is-ImageInUse { 44 | param ( 45 | [string]$ImageId 46 | ) 47 | 48 | # Get all VMs and check if any reference the image 49 | $vms = Get-AzVM -Status 50 | foreach ($vm in $vms) { 51 | if ($vm.StorageProfile.ImageReference.Id -eq $ImageId) { 52 | return $true 53 | } 54 | } 55 | return $false 56 | } 57 | if($ResourceGroup) { 58 | $images = Get-AzImage -ResourceGroupName $ResourceGroup 59 | 60 | foreach ($image in $images) { 61 | Write-Host "Processing image: $($image.Name)" 62 | 63 | if (-not (Is-ImageInUse -ImageId $image.Id)) { 64 | Write-Host "Image $($image.Name) is not in use." 65 | 66 | if (-not $DryRun) { 67 | # Delete the unused image 68 | Write-Host "Deleting image: $($image.Name)" 69 | Remove-AzImage -ResourceGroupName $image.ResourceGroupName -Name $image.Name -Force 70 | } else { 71 | Write-Host "Dry Run: Image $($image.Name) would be deleted." 72 | } 73 | } else { 74 | Write-Host "Image $($image.Name) is in use by one or more VMs." 75 | } 76 | } 77 | } 78 | else { 79 | 80 | $images = Get-AzImage 81 | 82 | foreach ($image in $images) { 83 | Write-Host "Processing image: $($image.Name)" 84 | 85 | if (-not (Is-ImageInUse -ImageId $image.Id)) { 86 | Write-Host "Image $($image.Name) is not in use." 87 | 88 | if (-not $DryRun) { 89 | # Delete the unused image 90 | Write-Host "Deleting image: $($image.Name)" 91 | Remove-AzImage -ResourceGroupName $image.ResourceGroupName -Name $image.Name -Force 92 | } else { 93 | Write-Host "Dry Run: Image $($image.Name) would be deleted." 94 | } 95 | } else { 96 | Write-Host "Image $($image.Name) is in use by one or more VMs." 97 | } 98 | } 99 | } 100 | # Get all images in the resource group 101 | 102 | 103 | Write-Host "Image cleanup completed." 104 | -------------------------------------------------------------------------------- /azure-ps/avd/stack/Update-AzWvdWorkspace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates an Azure Virtual Desktop Workspace. 4 | 5 | .DESCRIPTION 6 | This script updates the properties of an Azure Virtual Desktop Workspace. 7 | 8 | .PARAMETER Name 9 | The name of the workspace. 10 | 11 | .PARAMETER ResourceGroup 12 | The name of the resource group. 13 | 14 | .PARAMETER ApplicationGroupReference 15 | References to application groups. 16 | 17 | .PARAMETER Description 18 | The description of the workspace. 19 | 20 | .PARAMETER FriendlyName 21 | The friendly name of the workspace. 22 | 23 | .PARAMETER PublicNetworkAccess 24 | Specifies whether the workspace is accessible over a public network. 25 | 26 | .PARAMETER Tags 27 | A hashtable of tags to assign to the workspace. 28 | 29 | .EXAMPLE 30 | PS C:\> .\Update-AzWvdWorkspace.ps1 -Name "MyWorkspace" -ResourceGroup "MyResourceGroup" -Description "Updated Description" 31 | 32 | .LINK 33 | https://learn.microsoft.com/en-us/powershell/module/az.DesktopVirtualization 34 | 35 | .LINK 36 | https://learn.microsoft.com/en-us/powershell/module/az.desktopvirtualization/update-azwvdworkspace?view=azps-12.3.0 37 | 38 | .LINK 39 | https://github.com/xoap-io/scripted-actions 40 | 41 | .COMPONENT 42 | Azure PowerShell 43 | 44 | #> 45 | 46 | [CmdletBinding()] 47 | param ( 48 | [Parameter(Mandatory=$true)] 49 | [ValidateNotNullOrEmpty()] 50 | [string]$Name, 51 | 52 | [Parameter(Mandatory=$true)] 53 | [ValidateNotNullOrEmpty()] 54 | [string]$ResourceGroup, 55 | 56 | [Parameter(Mandatory=$false)] 57 | [ValidateNotNullOrEmpty()] 58 | [string]$ApplicationGroupReference, 59 | 60 | [Parameter(Mandatory=$false)] 61 | [ValidateNotNullOrEmpty()] 62 | [string]$Description, 63 | 64 | [Parameter(Mandatory=$false)] 65 | [ValidateNotNullOrEmpty()] 66 | [string]$FriendlyName, 67 | 68 | [Parameter(Mandatory=$false)] 69 | [ValidateNotNullOrEmpty()] 70 | [ValidateSet( 71 | "Enabled", 72 | "Disabled" 73 | )] 74 | [string]$PublicNetworkAccess, 75 | 76 | [Parameter(Mandatory=$false)] 77 | [ValidateNotNullOrEmpty()] 78 | [hashtable]$Tags 79 | ) 80 | 81 | # Splatting parameters for better readability 82 | $parameters = @{ 83 | Name = $Name 84 | ResourceGroup = $ResourceGroup 85 | } 86 | 87 | if ($ApplicationGroupReference) { 88 | $parameters['ApplicationGroupReference'], $ApplicationGroupReference 89 | } 90 | 91 | if ($Description) { 92 | $parameters['Description'], $Description 93 | } 94 | 95 | if ($FriendlyName) { 96 | $parameters['FriendlyName'], $FriendlyName 97 | } 98 | 99 | if ($PublicNetworkAccess) { 100 | $parameters['PublicNetworkAccess'], $PublicNetworkAccess 101 | } 102 | 103 | if ($Tags) { 104 | $parameters['Tag'], $Tags 105 | } 106 | 107 | # Set Error Action to Stop 108 | $ErrorActionPreference = "Stop" 109 | 110 | try { 111 | # Update the Azure Virtual Desktop Workspace and capture the result 112 | $result = Update-AzWvdWorkspace @parameters 113 | 114 | # Output the result 115 | Write-Output "Azure Virtual Desktop Workspace updated successfully:" 116 | Write-Output $result 117 | 118 | } catch [System.Exception] { 119 | 120 | Write-Error "Failed to update the Azure Virtual Desktop Workspace: $($_.Exception.Message)" 121 | 122 | } finally { 123 | # Cleanup code if needed 124 | Write-Output "Script execution completed." 125 | } 126 | -------------------------------------------------------------------------------- /aws-cli/ec2/aws-cli-create-ec2-instance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an EC2 instance in AWS. 4 | 5 | .DESCRIPTION 6 | This script creates an EC2 instance in AWS. The script uses the following AWS CLI command: 7 | aws ec2 run-instances --image-id $AwsAmiId --count $AwsInstanceCount --instance-type $AwsInstanceType --key-name $AwsKeyPairName --security-group-ids $AwsSecurityGroupId --subnet-id $AwsSubnetId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsAmiId 28 | Defines the ID of the Amazon Machine Image (AMI). 29 | 30 | .PARAMETER AwsInstanceCount 31 | Defines the number of instances to launch. 32 | 33 | .PARAMETER AwsInstanceType 34 | Defines the type of instance to launch. 35 | 36 | .PARAMETER AwsKeyPairName 37 | Defines the name of the key pair. 38 | 39 | .PARAMETER AwsSecurityGroupId 40 | Defines the ID of the security group. 41 | 42 | .PARAMETER AwsSubnetId 43 | Defines the ID of the subnet. 44 | 45 | #> 46 | [CmdletBinding()] 47 | param( 48 | [Parameter(Mandatory)] 49 | [string]$AwsAmiId = "myAmiId", 50 | [Parameter(Mandatory)] 51 | [int]$AwsInstanceCount = 1, 52 | [Parameter(Mandatory)] 53 | [ValidateSet('t2.micro', 't2.small', 't2.medium', 't2.large', 'm4.large', 'm4.xlarge', 'm4.2xlarge', 'm4.4xlarge', 'm4.10xlarge', 'm4.16xlarge', 'm5.large', 'm5.xlarge', 'm5.2xlarge', 'm5.4xlarge', 'm5.12xlarge', 'm5.24xlarge', 'm5d.large', 'm5d.xlarge', 'm5d.2xlarge', 'm5d.4xlarge', 'm5d.12xlarge', 'm5d.24xlarge', 'c4.large', 'c4.xlarge', 'c4.2xlarge', 'c4.4xlarge', 'c4.8xlarge', 'c5.large', 'c5.xlarge', 'c5.2xlarge', 'c5.4xlarge', 'c5.9xlarge', 'c5.18xlarge', 'c5d.large', 'c5d.xlarge', 'c5d.2xlarge', 'c5d.4xlarge', 'c5d.9xlarge', 'c5d.18xlarge', 'r4.large', 'r4.xlarge', 'r4.2xlarge', 'r4.4xlarge', 'r4.8xlarge', 'r4.16xlarge', 'r5.large', 'r5.xlarge', 'r5.2xlarge', 'r5.4xlarge', 'r5.12xlarge', 'r5.24xlarge', 'r5d.large', 'r5d.xlarge', 'r5d.2xlarge', 'r5d.4xlarge', 'r5d.12xlarge', 'r5d.24xlarge', 'i3.large', 'i3.xlarge', 'i3.2xlarge', 'i3.4xlarge', 'i3.8xlarge', 'i3.16xlarge', 'i3en.large', 'i3en.xlarge', 'i3en.2xlarge', 'i3en.3xlarge')] 54 | [string]$AwsInstanceType, 55 | [Parameter(Mandatory)] 56 | [string]$AwsKeyPairName = "myKeyPairName", 57 | [Parameter(Mandatory)] 58 | [string]$AwsSecurityGroupId = "mySecurityGroupId", 59 | [Parameter(Mandatory)] 60 | [string]$AwsSubnetId = "mySubnetId" 61 | ) 62 | 63 | #Set Error Action to Silently Continue 64 | $ErrorActionPreference = "Stop" 65 | 66 | 67 | aws ec2 run-instances ` 68 | --image-id $AwsAmiId ` 69 | --count $AwsInstanceCount ` 70 | --instance-type $AwsInstanceType ` 71 | --key-name $AwsKeyPairName ` 72 | --security-group-ids $AwsSecurityGroupId ` 73 | --subnet-id $AwsSubnetId 74 | -------------------------------------------------------------------------------- /aws-cli/ec2/e2evc-aws-cli-create-ec2-instance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates an EC2 instance in AWS. 4 | 5 | .DESCRIPTION 6 | This script creates an EC2 instance in AWS. The script uses the following AWS CLI command: 7 | aws ec2 run-instances --image-id $AwsAmiId --count $AwsInstanceCount --instance-type $AwsInstanceType --key-name $AwsKeyPairName --security-group-ids $AwsSecurityGroupId --subnet-id $AwsSubnetId 8 | 9 | The script sets the ErrorActionPreference to SilentlyContinue to suppress error messages. 10 | 11 | It does not return any output. 12 | 13 | .NOTES 14 | This PowerShell script was developed and optimized for the usage with the XOAP Scripted Actions module. 15 | The use of the scripts does not require XOAP, but it will make your life easier. 16 | You are allowed to pull the script from the repository and use it with XOAP or other solutions 17 | The terms of use for the XOAP platform do not apply to this script. In particular, RIS AG assumes no liability for the function, 18 | the use and the consequences of the use of this freely available script. 19 | PowerShell is a product of Microsoft Corporation. XOAP is a product of RIS AG. © RIS AG 20 | 21 | .COMPONENT 22 | AWS CLI 23 | 24 | .LINK 25 | https://github.com/xoap-io/scripted-actions 26 | 27 | .PARAMETER AwsAmiId 28 | Defines the ID of the Amazon Machine Image (AMI). 29 | 30 | .PARAMETER AwsInstanceCount 31 | Defines the number of instances to launch. 32 | 33 | .PARAMETER AwsInstanceType 34 | Defines the type of instance to launch. 35 | 36 | .PARAMETER AwsKeyPairName 37 | Defines the name of the key pair. 38 | 39 | .PARAMETER AwsSecurityGroupId 40 | Defines the ID of the security group. 41 | 42 | .PARAMETER AwsSubnetId 43 | Defines the ID of the subnet. 44 | 45 | #> 46 | [CmdletBinding()] 47 | param( 48 | [Parameter(Mandatory)] 49 | [string]$AwsAmiId = "myAmiId", 50 | [Parameter(Mandatory)] 51 | [int]$AwsInstanceCount = 1, 52 | [Parameter(Mandatory)] 53 | [ValidateSet('t2.micro', 't2.small', 't2.medium', 't2.large', 'm4.large', 'm4.xlarge', 'm4.2xlarge', 'm4.4xlarge', 'm4.10xlarge', 'm4.16xlarge', 'm5.large', 'm5.xlarge', 'm5.2xlarge', 'm5.4xlarge', 'm5.12xlarge', 'm5.24xlarge', 'm5d.large', 'm5d.xlarge', 'm5d.2xlarge', 'm5d.4xlarge', 'm5d.12xlarge', 'm5d.24xlarge', 'c4.large', 'c4.xlarge', 'c4.2xlarge', 'c4.4xlarge', 'c4.8xlarge', 'c5.large', 'c5.xlarge', 'c5.2xlarge', 'c5.4xlarge', 'c5.9xlarge', 'c5.18xlarge', 'c5d.large', 'c5d.xlarge', 'c5d.2xlarge', 'c5d.4xlarge', 'c5d.9xlarge', 'c5d.18xlarge', 'r4.large', 'r4.xlarge', 'r4.2xlarge', 'r4.4xlarge', 'r4.8xlarge', 'r4.16xlarge', 'r5.large', 'r5.xlarge', 'r5.2xlarge', 'r5.4xlarge', 'r5.12xlarge', 'r5.24xlarge', 'r5d.large', 'r5d.xlarge', 'r5d.2xlarge', 'r5d.4xlarge', 'r5d.12xlarge', 'r5d.24xlarge', 'i3.large', 'i3.xlarge', 'i3.2xlarge', 'i3.4xlarge', 'i3.8xlarge', 'i3.16xlarge', 'i3en.large', 'i3en.xlarge', 'i3en.2xlarge', 'i3en.3xlarge')] 54 | [string]$AwsInstanceType, 55 | [Parameter(Mandatory)] 56 | [string]$AwsKeyPairName = "E2EVC-Madrid", 57 | [Parameter(Mandatory)] 58 | [string]$AwsSecurityGroupId = "mySecurityGroupId", 59 | [Parameter(Mandatory)] 60 | [string]$AwsSubnetId = "subnet-030459ac24bf1e8da" 61 | ) 62 | 63 | #Set Error Action to Silently Continue 64 | $ErrorActionPreference = "Stop" 65 | 66 | 67 | aws ec2 run-instances ` 68 | --image-id $AwsAmiId ` 69 | --count $AwsInstanceCount ` 70 | --instance-type $AwsInstanceType ` 71 | --key-name $AwsKeyPairName ` 72 | --security-group-ids $AwsSecurityGroupId ` 73 | --subnet-id $AwsSubnetId 74 | -------------------------------------------------------------------------------- /azure-cli/avd/az-cli-avd-workspace-create.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create an Azure Virtual Desktop workspace with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script creates an Azure Virtual Desktop workspace with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az desktopvirtualization workspace create --name $AzWorkspaceName --resource-group $AzResourceGroup 9 | 10 | .PARAMETER Name 11 | The name of the Azure Virtual Desktop workspace. 12 | 13 | .PARAMETER ResourceGroup 14 | The name of the Azure Resource Group. 15 | 16 | .PARAMETER ApplicationGroupReferences 17 | The application group references. 18 | 19 | .PARAMETER Description 20 | The description of the Azure Virtual Desktop workspace. 21 | 22 | .PARAMETER FriendlyName 23 | The friendly name of the Azure Virtual Desktop workspace. 24 | 25 | .PARAMETER Location 26 | The location of the Azure Virtual Desktop workspace. 27 | 28 | .PARAMETER Tags 29 | The tags for the Azure Virtual Desktop workspace. 30 | 31 | .EXAMPLE 32 | .\az-cli-avd-workspace-create.ps1 -WorkspaceName "MyWorkspace" -ResourceGroup "MyResourceGroup" 33 | 34 | .LINK 35 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace 36 | 37 | .LINK 38 | https://learn.microsoft.com/en-us/cli/azure/desktopvirtualization/workspace?view=azure-cli-latest 39 | 40 | .LINK 41 | https://github.com/xoap-io/scripted-actions 42 | 43 | .COMPONENT 44 | Azure CLI 45 | #> 46 | 47 | [CmdletBinding()] 48 | param( 49 | [Parameter(Mandatory=$true)] 50 | [ValidateNotNullOrEmpty()] 51 | [string]$Name, 52 | 53 | [Parameter(Mandatory=$true)] 54 | [ValidateNotNullOrEmpty()] 55 | [string]$ResourceGroup, 56 | 57 | [Parameter(Mandatory=$false)] 58 | [ValidateNotNullOrEmpty()] 59 | [string]$ApplicationGroupReferences, 60 | 61 | [Parameter(Mandatory=$false)] 62 | [ValidateNotNullOrEmpty()] 63 | [string]$Description, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [ValidateNotNullOrEmpty()] 67 | [string]$FriendlyName, 68 | 69 | [Parameter(Mandatory=$false)] 70 | [ValidateNotNullOrEmpty()] 71 | [string]$Location, 72 | 73 | [Parameter(Mandatory=$false)] 74 | [ValidateNotNullOrEmpty()] 75 | [string]$Tags 76 | ) 77 | 78 | # Splatting parameters for better readability 79 | $parameters = ` 80 | '--name', $WorkspaceName 81 | '--resource-group', $ResourceGroup 82 | 83 | if ($ApplicationGroupReferences) { 84 | $parameters += '--application-group-references', $ApplicationGroupReferences 85 | } 86 | 87 | if ($Description) { 88 | $parameters += '--description', $Description 89 | } 90 | 91 | if ($FriendlyName) { 92 | $parameters += '--friendly-name', $FriendlyName 93 | } 94 | 95 | if ($Location) { 96 | $parameters += '--location', $Location 97 | } 98 | 99 | if ($Tags) { 100 | $parameters += '--tags', $Tags 101 | } 102 | 103 | # Set Error Action to Stop 104 | $ErrorActionPreference = "Stop" 105 | 106 | try { 107 | # Create the Azure Virtual Desktop workspace 108 | az desktopvirtualization workspace create @parameters 109 | 110 | # Output the result 111 | Write-Output "Azure Virtual Desktop workspace created successfully." 112 | 113 | } catch { 114 | # Log the error to the console 115 | Write-Output "Error message $errorMessage" 116 | Write-Error "Failed to create the Azure Virtual Desktop workspace: $($_.Exception.Message)" 117 | 118 | } finally { 119 | # Cleanup code if needed 120 | Write-Output "Script execution completed." 121 | } 122 | -------------------------------------------------------------------------------- /azure-ps/az-ps-install-webserver-windows.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script installs the Web Server feature on a Windows VM in Azure. 4 | 5 | .DESCRIPTION 6 | This script installs the Web Server feature on a Windows VM in Azure. The script uses the Azure PowerShell to run a PowerShell script on the specified Azure VM. 7 | The script uses the following Azure PowerShell command: 8 | Invoke-AzVMRunCommand -ResourceGroup $AzResourceGroup -VMName $AzVmName -CommandId 'RunPowerShellScript' -ScriptString 'Install-WindowsFeature -Name Web-Server -IncludeManagementTools' 9 | The script sets the ErrorActionPreference to Stop to handle errors properly. 10 | 11 | .PARAMETER AzResourceGroup 12 | Defines the name of the Azure Resource Group. 13 | 14 | .PARAMETER AzVmName 15 | Defines the name of the Azure VM. 16 | 17 | .PARAMETER AzDebug 18 | Increase logging verbosity to show all debug logs. 19 | 20 | .PARAMETER AzOnlyShowErrors 21 | Only show errors, suppressing warnings. 22 | 23 | .PARAMETER AzOutput 24 | Output format. 25 | 26 | .PARAMETER AzQuery 27 | JMESPath query string. 28 | 29 | .PARAMETER AzVerbose 30 | Increase logging verbosity. 31 | 32 | .PARAMETER WhatIf 33 | Shows what would happen if the cmdlet runs. The cmdlet is not run. 34 | 35 | .PARAMETER Confirm 36 | Prompts you for confirmation before running the cmdlet. 37 | 38 | .EXAMPLE 39 | .\az-ps-install-webserver-windows.ps1 -AzResourceGroup "myResourceGroup" -AzVmName "myVm" 40 | 41 | .NOTES 42 | Ensure that Azure PowerShell is installed and authenticated before running the script. 43 | Author: Your Name 44 | Date: 2024-09-03 45 | Version: 1.1 46 | Requires: Azure PowerShell 47 | 48 | .LINK 49 | https://github.com/xoap-io/scripted-actions 50 | #> 51 | 52 | [CmdletBinding()] 53 | param( 54 | [Parameter(Mandatory=$true)] 55 | [ValidateNotNullOrEmpty()] 56 | [string]$AzResourceGroup = "myResourceGroup", 57 | 58 | [Parameter(Mandatory=$true)] 59 | [ValidateNotNullOrEmpty()] 60 | [string]$AzVmName = "myVm", 61 | 62 | [Parameter(Mandatory=$false)] 63 | [switch]$AzDebug, 64 | 65 | [Parameter(Mandatory=$false)] 66 | [switch]$AzOnlyShowErrors, 67 | 68 | [Parameter(Mandatory=$false)] 69 | [string]$AzOutput, 70 | 71 | [Parameter(Mandatory=$false)] 72 | [string]$AzQuery, 73 | 74 | [Parameter(Mandatory=$false)] 75 | [switch]$AzVerbose, 76 | 77 | 78 | ) 79 | 80 | # Splatting parameters for better readability 81 | $parameters = @{ 82 | ResourceGroup = $AzResourceGroup 83 | Name = $AzVmName 84 | Debug = $AzDebug 85 | OnlyShowErrors = $AzOnlyShowErrors 86 | Output = $AzOutput 87 | Query = $AzQuery 88 | Verbose = $AzVerbose 89 | } 90 | 91 | # Set Error Action to Stop 92 | $ErrorActionPreference = "Stop" 93 | 94 | try { 95 | # Install Web Server feature on the VM 96 | Invoke-AzVMRunCommand @parameters -CommandId 'RunPowerShellScript' -ScriptString 'Install-WindowsFeature -Name Web-Server -IncludeManagementTools' 97 | 98 | # Output the result 99 | Write-Output "Web Server feature installed successfully on Azure VM '$($AzVmName)'." 100 | } catch { 101 | # Log the error to the console 102 | 103 | Write-Output "Error message $errorMessage" 104 | 105 | 106 | Write-Error "Failed to install Web Server feature on Azure VM: $($_.Exception.Message)" 107 | } finally { 108 | # Cleanup code if needed 109 | Write-Output "Script execution completed." 110 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Problem_with_resource.yml: -------------------------------------------------------------------------------- 1 | name: Problem with a resource 2 | description: If you have a problem, bug, or enhancement with a resource in this resource module. 3 | labels: [] 4 | assignees: [] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Please prefix the issue title (above) with the resource name, e.g. 'ResourceName: Short description of my issue'! 10 | 11 | Your feedback and support is greatly appreciated, thanks for contributing! 12 | - type: textarea 13 | id: description 14 | attributes: 15 | label: Problem description 16 | description: Details of the scenario you tried and the problem that is occurring. 17 | validations: 18 | required: true 19 | - type: textarea 20 | id: logs 21 | attributes: 22 | label: Verbose logs 23 | description: | 24 | Verbose logs showing the problem. **NOTE! Sensitive information should be obfuscated.** _Will be automatically formatted as plain text._ 25 | placeholder: | 26 | Paste verbose logs here 27 | render: text 28 | validations: 29 | required: true 30 | - type: textarea 31 | id: configuration 32 | attributes: 33 | label: DSC configuration 34 | description: | 35 | The DSC configuration that is used to reproduce the issue (as detailed as possible). **NOTE! Sensitive information should be obfuscated.** _Will be automatically formatted as PowerShell code._ 36 | placeholder: | 37 | Paste DSC configuration here 38 | render: powershell 39 | validations: 40 | required: true 41 | - type: textarea 42 | id: suggestedSolution 43 | attributes: 44 | label: Suggested solution 45 | description: Do you have any suggestions how to solve the issue? 46 | validations: 47 | required: true 48 | - type: textarea 49 | id: targetNodeOS 50 | attributes: 51 | label: Operating system the target node is running 52 | description: | 53 | Please provide as much as possible about the target node, for example edition, version, build, and language. _Will be automatically formatted as plain text._ 54 | 55 | On OS with WMF 5.1 the following command can help get this information: `Get-ComputerInfo -Property @('OsName','OsOperatingSystemSKU','OSArchitecture','WindowsVersion','WindowsBuildLabEx','OsLanguage','OsMuiLanguages')` 56 | placeholder: | 57 | Add operating system information here 58 | render: text 59 | validations: 60 | required: true 61 | - type: textarea 62 | id: targetNodePS 63 | attributes: 64 | label: PowerShell version and build the target node is running 65 | description: | 66 | Please provide the version and build of PowerShell the target node is running. _Will be automatically formatted as plain text._ 67 | 68 | To help with this information, please run this command: `$PSVersionTable` 69 | placeholder: | 70 | Add PowerShell information here 71 | render: text 72 | validations: 73 | required: true 74 | - type: textarea 75 | id: moduleVersion 76 | attributes: 77 | label: xoap-application-packaging-dsc version 78 | description: | 79 | Please provide the version of the xoap-application-packaging-dsc module that was used. _Will be automatically formatted as plain text._ 80 | 81 | To help with this information, please run this command: `Get-Module -Name 'xoap-application-packaging-dsc' -ListAvailable | ft Name,Version,Path` 82 | placeholder: | 83 | Add module information here 84 | render: text 85 | validations: 86 | required: true 87 | -------------------------------------------------------------------------------- /azure-cli/vms/wip_az-cli-delete-image-builder-linux.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete an Azure Image Builder Linux VM and its associated resources. 4 | 5 | .DESCRIPTION 6 | This script deletes an Azure Image Builder Linux VM and its associated resources, including the image template, role assignments, identities, image versions, image definitions, and the resource group. 7 | 8 | .PARAMETER ResourceGroup 9 | Defines the name of the Azure Resource Group. 10 | 11 | .PARAMETER OpenPorts 12 | Defines the ports to open on the Azure Virtual Machine. 13 | 14 | .EXAMPLE 15 | .\wip_az-cli-delete-image-builder-linux.ps1 -AzResourceGroup "myResourceGroup" -AzOpenPorts "3389" 16 | 17 | .LINK 18 | https://learn.microsoft.com/en-us/cli/azure/vm 19 | #> 20 | 21 | [CmdletBinding()] 22 | param( 23 | [Parameter(Mandatory=$true)] 24 | [ValidateNotNullOrEmpty()] 25 | [string]$ResourceGroup = 'myResourceGroup', 26 | 27 | [Parameter(Mandatory=$true)] 28 | [ValidateNotNullOrEmpty()] 29 | [string]$OpenPorts = '3389' 30 | ) 31 | 32 | # Splatting parameters for better readability 33 | $parameters = ` 34 | 'resource-group', $AzResourceGroup 35 | 'open-ports', $AzOpenPorts 36 | 37 | # Set Error Action to Stop 38 | $ErrorActionPreference = "Stop" 39 | 40 | try { 41 | # Delete the image template 42 | az resource delete ` 43 | --resource-group $parameters.resource_group ` 44 | --resource-type Microsoft.VirtualMachineImages/imageTemplates ` 45 | --name helloImageTemplateforSIG01 ` 46 | --no-wait 47 | 48 | # Delete the role assignment 49 | az role assignment delete ` 50 | --assignee $imgBuilderCliId ` 51 | --role "$imageRoleDefName" ` 52 | --scope /subscriptions/$subscriptionID/resourceGroups/$parameters.resource_group 53 | 54 | # Delete the role definition 55 | az role definition delete --name "$imageRoleDefName" 56 | 57 | # Delete the identity 58 | az identity delete --ids $imgBuilderId 59 | 60 | # Get the image version 61 | $sigDefImgVersion = az sig image-version list ` 62 | -g $parameters.resource_group ` 63 | --gallery-name $sigName ` 64 | --gallery-image-definition $imageDefName ` 65 | --subscription $subscriptionID --query [].'name' -o json | grep 0. | tr -d '"' 66 | 67 | # Delete the image version 68 | az sig image-version delete ` 69 | -g $parameters.resource_group ` 70 | --gallery-image-version $sigDefImgVersion ` 71 | --gallery-name $sigName ` 72 | --gallery-image-definition $imageDefName ` 73 | --subscription $subscriptionID 74 | 75 | # Delete the image definition 76 | az sig image-definition delete ` 77 | -g $parameters.resource_group ` 78 | --gallery-name $sigName ` 79 | --gallery-image-definition $imageDefName ` 80 | --subscription $subscriptionID 81 | 82 | # Delete the shared image gallery 83 | az sig delete -r $sigName -g $parameters.resource_group 84 | 85 | # Delete the resource group 86 | az group delete -n $parameters.resource_group -y 87 | 88 | # Output the result 89 | Write-Output "Azure Image Builder Linux VM and associated resources deleted successfully." 90 | } catch { 91 | # Log the error to the console 92 | 93 | Write-Output "Error message $errorMessage" 94 | 95 | 96 | Write-Error "Failed to delete Azure Image Builder Linux VM and associated resources: $($_.Exception.Message)" 97 | } finally { 98 | # Cleanup code if needed 99 | Write-Output "Script execution completed." 100 | } -------------------------------------------------------------------------------- /azure-cli/avd/todo/az-cli-avd-vm-ephemeral-disk-create.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create an Azure Virtual Machine with the Azure CLI. 4 | 5 | .DESCRIPTION 6 | This script creates an Azure Virtual Machine with the Azure CLI. 7 | The script uses the following Azure CLI command: 8 | az vm create --resource-group $AzResourceGroup --name $AzVMName --image $AzImageName 9 | 10 | .PARAMETER AzResourceGroup 11 | Defines the name of the Azure Resource Group. 12 | 13 | .PARAMETER AzVMName 14 | Defines the name of the Azure Virtual Machine. 15 | 16 | .PARAMETER AzImageName 17 | Defines the name of the image to use for the VM. 18 | 19 | .PARAMETER AzEphemeralOSDisk 20 | Specifies whether to use an ephemeral OS disk. 21 | 22 | .PARAMETER AzEphemeralOSDiskPlacement 23 | Specifies the placement of the ephemeral OS disk. 24 | 25 | .PARAMETER AzOSDiskCaching 26 | Specifies the caching mode of the OS disk. 27 | 28 | .PARAMETER AzAdminUsername 29 | Specifies the admin username for the VM. 30 | 31 | .PARAMETER AzGenerateSSHKeys 32 | Specifies whether to generate SSH keys. 33 | 34 | .PARAMETER AzSubscription 35 | Name or ID of subscription. 36 | 37 | .PARAMETER AzDefaultProfile 38 | The default profile. 39 | 40 | .PARAMETER WhatIf 41 | Shows what would happen if the cmdlet runs. The cmdlet is not run. 42 | 43 | .PARAMETER Confirm 44 | Prompts you for confirmation before running the cmdlet. 45 | 46 | .EXAMPLE 47 | .\az-cli-vm-create.ps1 -AzResourceGroup "MyResourceGroup" -AzVMName "MyVM" -AzImageName "UbuntuLTS" 48 | 49 | .NOTES 50 | Author: Your Name 51 | Date: 2024-09-03 52 | Version: 1.1 53 | Requires: Azure CLI 54 | 55 | .LINK 56 | https://learn.microsoft.com/en-us/cli/azure/vm 57 | #> 58 | 59 | [CmdletBinding()] 60 | param( 61 | [Parameter(Mandatory=$true)] 62 | [ValidateNotNullOrEmpty()] 63 | [string]$AzResourceGroup = "myResourceGroup", 64 | 65 | [Parameter(Mandatory=$true)] 66 | [ValidateNotNullOrEmpty()] 67 | [string]$AzVMName = "myVM", 68 | 69 | [Parameter(Mandatory=$true)] 70 | [ValidateNotNullOrEmpty()] 71 | [string]$AzImageName = "UbuntuLTS", 72 | 73 | [Parameter(Mandatory=$false)] 74 | [bool]$AzEphemeralOSDisk = $true, 75 | 76 | [Parameter(Mandatory=$false)] 77 | [string]$AzEphemeralOSDiskPlacement = "ResourceDisk", 78 | 79 | [Parameter(Mandatory=$false)] 80 | [string]$AzOSDiskCaching = "ReadOnly", 81 | 82 | [Parameter(Mandatory=$false)] 83 | [string]$AzAdminUsername = "azureuser", 84 | 85 | [Parameter(Mandatory=$false)] 86 | [bool]$AzGenerateSSHKeys = $true 87 | ) 88 | 89 | # Splatting parameters for better readability 90 | $parameters = ` 91 | 'resource-group', $AzResourceGroup 92 | 'name', $AzVMName 93 | 'image', $AzImageName 94 | 'ephemeral-os-disk', $AzEphemeralOSDisk 95 | 'ephemeral-os-disk-placement', $AzEphemeralOSDiskPlacement 96 | 'os-disk-caching', $AzOSDiskCaching 97 | 'admin-username', $AzAdminUsername 98 | 'generate-ssh-keys', $AzGenerateSSHKeys 99 | 100 | # Set Error Action to Stop 101 | $ErrorActionPreference = "Stop" 102 | 103 | try { 104 | # Create the Azure Virtual Machine 105 | az vm create @parameters 106 | 107 | # Output the result 108 | Write-Output "Azure Virtual Machine created successfully." 109 | 110 | } catch { 111 | # Log the error to the console 112 | Write-Output "Error message $errorMessage" 113 | Write-Error "Failed to create the Azure Virtual Machine: $($_.Exception.Message)" 114 | 115 | } finally { 116 | # Cleanup code if needed 117 | Write-Output "Script execution completed." 118 | } 119 | --------------------------------------------------------------------------------