mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore: updated notes with the last findings and experiments
This commit is contained in:
@@ -115,6 +115,13 @@ az keyvault key list --query '[].name' -o 'tsv' --vault-name 'key_vault_name'
|
||||
az keyvault secret show --query 'value' \
|
||||
--name 'secret_name' --vault-name 'key_vault_name'
|
||||
|
||||
# Get Key ID and Access Policy of Disk Encryption Sets.
|
||||
az disk-encryption-set show --ids 'id' \
|
||||
--query "{
|
||||
\"keyId\": activeKey.keyUrl,
|
||||
\"accessPolicyId\": join('/', [activeKey.sourceVault.id, 'objectId', identity.principalId])
|
||||
}"
|
||||
|
||||
# List all the available SKUs for VMs.
|
||||
az vm list-skus
|
||||
az vm list-skus -l 'location'
|
||||
@@ -183,6 +190,19 @@ az devops service-endpoint list -o 'tsv' \
|
||||
--organization 'https://dev.azure.com/organization_name' --project 'project' \
|
||||
--query "[?id=='service_endpoint_id'].name"
|
||||
|
||||
# Filter out users whose Principal Name starts for X and access Y.
|
||||
az devops user list --org 'https://dev.azure.com/organizationName' \
|
||||
--query "
|
||||
items[?
|
||||
startsWith(user.principalName, 'yourNameHere') &&
|
||||
\! contains(accessLevel.licenseDisplayName, 'Test plans')
|
||||
].user.displayName"
|
||||
|
||||
# Get Teams' information.
|
||||
az devops team show \
|
||||
--org 'https://dev.azure.com/organizationName' --project 'project' \
|
||||
--team 'display_name'
|
||||
|
||||
# Get the names of all the Pipelines the current user has access to.
|
||||
az pipelines list --organization 'organization_id_or_name'
|
||||
az pipelines list --detect 'true' --query '[].name' -o 'tsv'
|
||||
|
||||
@@ -4,13 +4,19 @@
|
||||
|
||||
```sh
|
||||
# Filter elements in a list.
|
||||
az devops user list \
|
||||
--org https://dv.azure.com/organizationName \
|
||||
--query "\
|
||||
items[? \
|
||||
startsWith(user.principalName, 'yourNameHere') && \
|
||||
\! contains(accessLevel.licenseDisplayName, 'Test plans') \
|
||||
az devops user list --org 'https://dev.azure.com/organizationName' \
|
||||
--query "
|
||||
items[?
|
||||
startsWith(user.principalName, 'yourNameHere') &&
|
||||
\! contains(accessLevel.licenseDisplayName, 'Test plans')
|
||||
].user.displayName"
|
||||
|
||||
# Print an object with specific keys and values from the input.
|
||||
az disk-encryption-set show --ids 'id' \
|
||||
--query "{
|
||||
\"keyId\": activeKey.keyUrl,
|
||||
\"accessPolicyId\": join('/', [activeKey.sourceVault.id, 'objectId', identity.principalId])
|
||||
}"
|
||||
```
|
||||
|
||||
## Further readings
|
||||
|
||||
@@ -4,22 +4,33 @@
|
||||
|
||||
```sh
|
||||
# Only list keys.
|
||||
jq 'keys' file.json
|
||||
jq 'keys' 'file.json'
|
||||
|
||||
# Sort all the keys.
|
||||
jq --sort-keys '.' input.json > output.json
|
||||
jq --sort-keys '.' 'input.json' > 'output.json'
|
||||
jq --sort-keys '.' 'file.json' | sponge 'file.json'
|
||||
|
||||
# Add a key.
|
||||
# Do not fail due to possibly missing keys.
|
||||
# Postfix operator '?'.
|
||||
jq '.spec.template.spec.containers[]?.env?' 'manifest.kube.json'
|
||||
|
||||
# Add keys.
|
||||
jq --arg REGION ${AWS_REGION} '.spec.template.spec.containers[]?.env? += [{name: "AWS_REGION", value: $REGION}]' /tmp/service.kube.json
|
||||
|
||||
# Delete a key.
|
||||
# Delete keys.
|
||||
jq 'del(.items[].spec.clusterIP)' /tmp/service.kube.json
|
||||
|
||||
# Change a value.
|
||||
# Print objects as 'key [space] "value"' pairs.
|
||||
jq -r 'to_entries[] | "\(.key) \"\(.value)\""' 'file.json'
|
||||
|
||||
# Change single values.
|
||||
# A.K.A. update values.
|
||||
jq '.extensionsGallery
|
||||
| .serviceUrl |= "https://marketplace.visualstudio.com/_apis/public/gallery"' \
|
||||
/usr/lib/code/product.json
|
||||
jq --arg NAMESPACE ${NAMESPACE} '.spec.template.spec.containers[]?.env[]? |= {name: .name, value: (if .name == "KUBERNETES_NAMESPACE" then $NAMESPACE else .value end)}' /tmp/service.kube.json
|
||||
jq --arg NAMESPACE ${NAMESPACE} \
|
||||
'.spec.template.spec.containers[]?.env[]? |= {name: .name, value: (if .name == "KUBERNETES_NAMESPACE" then $NAMESPACE else .value end)}' \
|
||||
/tmp/service.kube.json
|
||||
|
||||
# Change multiple values at once.
|
||||
jq '.extensionsGallery
|
||||
@@ -33,10 +44,8 @@ jq '.extensionsGallery + {
|
||||
itemUrl: "https://marketplace.visualstudio.com/items"
|
||||
}' /usr/lib/code/product.json
|
||||
|
||||
# Add elements from an array from another file.
|
||||
# Add elements from arrays from other files.
|
||||
jq '.rules=([input.rules]|flatten)' starting-rule-set.json ending-rule-set.json
|
||||
|
||||
# Add elements from an array from multiple files.
|
||||
jq '.rules=([inputs.rules]|flatten)' starting-rule-set.json parts/*.json
|
||||
|
||||
# Put specific keys on top.
|
||||
|
||||
Reference in New Issue
Block a user