$ npm config list | grep prefix
prefix = "/usr/local/Cellar/node/7.10.0/libexec/npm"
export PATH=/usr/local/Cellar/node/7.10.0/libexec/npm/bin:$PATH
| # PowerShell | |
| $regions = "eu-west-1" | |
| foreach ($region in $regions) { | |
| aws cloudformation create-stack ` | |
| --parameters file://$PWD\..\templates\stack_parameters.json ` | |
| --tags file://$PWD\..\templates\stack_tags.json ` | |
| --stack-policy-body file://$PWD\..\templates\stack_policy.json ` | |
| --template-body file://$PWD\..\templates\log_bucket_template.json ` |
| Param( | |
| [array]$region = @( "eu-west-1") | |
| ) | |
| foreach ($item in $region) { | |
| echo $item | |
| } | |
| #PS> .\array_as_param.ps1 us-east-1,eu-west-1 |
| // requirements | |
| // aws cli has to be installed | |
| // working AWS credentials file ~/.aws/credentials | |
| // copy this file as tasks.json under the .vscode directory in your templates project directory | |
| // open your CloudFormation template and hit Ctrl + Shift + B | |
| { | |
| "version": "0.1.0", | |
| "command": "aws", | |
| "isShellCommand": true, |
| "s3:DeleteReplicationConfiguration" | |
| does not work in bucket policies | |
| s3:GetObjectVersion | |
| means tha you will actually GET OBJECT = one of the object's version. |
| Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -name Shell -Value 'PowerShell.exe -noExit' |
| # Works both with IDLE and PTVS for Visual Studio | |
| import os | |
| import boto3 | |
| os.environ['HTTPS_PROXY'] = '<proxyurl>:<port>' | |
| s3 = boto3.client('s3') | |
| s3.list_buckets() |
Following will create service principal in Azure outputting auth creds in JSON format compatible with GitHub Actions. https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Cwindows
az ad sp create-for-rbac --name "myApp" --json-authIn this scenario we want to access predefined variable $Build.Reason from the PowerShell script. $Build.Reason will have different value based on what triggered the build.
Map $Build.Reason to env variable for the powershell script.
- powershell: |
.\scripts\git-package.ps1
| # Get IAM Role name from Instance Profile Id | |
| curl http://169.254.169.254/latest/meta-data/iam/info | |
| # Get credentials | |
| curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> | |
| # More info | |
| http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html | |