@marcfargas/skills 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,242 @@
1
+ # Serverless & Containers: App Service, Functions, Container Apps, AKS, ACR
2
+
3
+ ## App Service (Web Apps)
4
+
5
+ ```bash
6
+ # Create App Service plan
7
+ az appservice plan create \
8
+ --resource-group my-rg \
9
+ --name my-plan \
10
+ --sku B1 \
11
+ --is-linux
12
+
13
+ # WRITE — create web app (Node.js)
14
+ az webapp create \
15
+ --resource-group my-rg \
16
+ --plan my-plan \
17
+ --name my-webapp \
18
+ --runtime "NODE:20-lts"
19
+
20
+ # Deploy from local source (zip deploy)
21
+ az webapp up --resource-group my-rg --name my-webapp --runtime "NODE:20-lts"
22
+
23
+ # Deploy from GitHub
24
+ az webapp deployment source config \
25
+ --resource-group my-rg \
26
+ --name my-webapp \
27
+ --repo-url https://github.com/user/repo \
28
+ --branch main
29
+
30
+ # Deploy from container image
31
+ az webapp create \
32
+ --resource-group my-rg \
33
+ --plan my-plan \
34
+ --name my-webapp \
35
+ --deployment-container-image-name myregistry.azurecr.io/myimage:tag
36
+
37
+ # READ
38
+ az webapp list --resource-group my-rg -o table
39
+ az webapp show --name my-webapp --resource-group my-rg -o json
40
+ az webapp log tail --name my-webapp --resource-group my-rg
41
+
42
+ # WRITE — app settings (env vars)
43
+ az webapp config appsettings set \
44
+ --resource-group my-rg \
45
+ --name my-webapp \
46
+ --settings KEY=value DB_HOST=mydb.postgres.database.azure.com
47
+
48
+ az webapp config appsettings list --resource-group my-rg --name my-webapp -o json
49
+
50
+ # WRITE — connection strings
51
+ az webapp config connection-string set \
52
+ --resource-group my-rg \
53
+ --name my-webapp \
54
+ --connection-string-type PostgreSQL \
55
+ --settings MyDB="host=...;database=...;user=...;password=..."
56
+
57
+ # Scale
58
+ az appservice plan update --name my-plan --resource-group my-rg --sku S1
59
+ az webapp scale --name my-webapp --resource-group my-rg --instance-count 3
60
+
61
+ # Deployment slots
62
+ az webapp deployment slot create --name my-webapp --resource-group my-rg --slot staging
63
+ az webapp deployment slot swap --name my-webapp --resource-group my-rg --slot staging --target-slot production
64
+
65
+ # Custom domain
66
+ az webapp config hostname add --webapp-name my-webapp --resource-group my-rg --hostname www.example.com
67
+ az webapp config ssl bind --certificate-thumbprint THUMBPRINT --ssl-type SNI \
68
+ --name my-webapp --resource-group my-rg
69
+
70
+ # Restart / stop
71
+ az webapp restart --name my-webapp --resource-group my-rg
72
+ az webapp stop --name my-webapp --resource-group my-rg
73
+ az webapp start --name my-webapp --resource-group my-rg
74
+
75
+ # ⚠️ DESTRUCTIVE
76
+ az webapp delete --name my-webapp --resource-group my-rg
77
+ az appservice plan delete --name my-plan --resource-group my-rg
78
+ ```
79
+
80
+ ### App Service Pricing
81
+
82
+ | SKU | ~Cost/mo | vCPU | RAM | Notes |
83
+ |-----|----------|------|-----|-------|
84
+ | F1 | Free | Shared | 1 GB | Dev/test, 60 min/day |
85
+ | B1 | ~$13 | 1 | 1.75 GB | Basic |
86
+ | S1 | ~$73 | 1 | 1.75 GB | Standard, slots, autoscale |
87
+ | P1v3 | ~$138 | 2 | 8 GB | Premium, VNet integration |
88
+
89
+ ## Azure Functions
90
+
91
+ ```bash
92
+ # Create Function App (Consumption plan — pay per execution)
93
+ az functionapp create \
94
+ --resource-group my-rg \
95
+ --name my-func \
96
+ --consumption-plan-location westeurope \
97
+ --runtime node \
98
+ --runtime-version 20 \
99
+ --storage-account mystorageaccount \
100
+ --functions-version 4
101
+
102
+ # Deploy from local
103
+ func azure functionapp publish my-func
104
+
105
+ # Or with zip deploy
106
+ az functionapp deployment source config-zip \
107
+ --resource-group my-rg \
108
+ --name my-func \
109
+ --src app.zip
110
+
111
+ # READ
112
+ az functionapp list --resource-group my-rg -o table
113
+ az functionapp show --name my-func --resource-group my-rg -o json
114
+ az functionapp function list --name my-func --resource-group my-rg -o json
115
+
116
+ # App settings
117
+ az functionapp config appsettings set \
118
+ --resource-group my-rg \
119
+ --name my-func \
120
+ --settings KEY=value
121
+
122
+ # ⚠️ DESTRUCTIVE
123
+ az functionapp delete --name my-func --resource-group my-rg
124
+ ```
125
+
126
+ ## Container Apps
127
+
128
+ ```bash
129
+ # Create Container Apps environment
130
+ az containerapp env create \
131
+ --resource-group my-rg \
132
+ --name my-env \
133
+ --location westeurope
134
+
135
+ # WRITE — deploy container app
136
+ az containerapp create \
137
+ --resource-group my-rg \
138
+ --name my-app \
139
+ --environment my-env \
140
+ --image myregistry.azurecr.io/myimage:tag \
141
+ --target-port 8080 \
142
+ --ingress external \
143
+ --cpu 0.5 --memory 1.0Gi \
144
+ --min-replicas 0 --max-replicas 5
145
+
146
+ # Deploy from source (buildpack)
147
+ az containerapp up --name my-app --resource-group my-rg --source .
148
+
149
+ # READ
150
+ az containerapp list --resource-group my-rg -o table
151
+ az containerapp show --name my-app --resource-group my-rg -o json
152
+ az containerapp logs show --name my-app --resource-group my-rg
153
+
154
+ # Update image
155
+ az containerapp update --name my-app --resource-group my-rg \
156
+ --image myregistry.azurecr.io/myimage:newtag
157
+
158
+ # Scale rules
159
+ az containerapp update --name my-app --resource-group my-rg \
160
+ --min-replicas 1 --max-replicas 10
161
+
162
+ # Environment variables / secrets
163
+ az containerapp update --name my-app --resource-group my-rg \
164
+ --set-env-vars "KEY=value" "SECRET=secretref:my-secret"
165
+
166
+ # Revisions
167
+ az containerapp revision list --name my-app --resource-group my-rg -o table
168
+
169
+ # ⚠️ DESTRUCTIVE
170
+ az containerapp delete --name my-app --resource-group my-rg
171
+ az containerapp env delete --name my-env --resource-group my-rg
172
+ ```
173
+
174
+ ## Azure Kubernetes Service (AKS)
175
+
176
+ ```bash
177
+ # ⚠️ EXPENSIVE — ~$70+/month for 3-node Standard_B2s cluster (+ node costs)
178
+ az aks create \
179
+ --resource-group my-rg \
180
+ --name my-cluster \
181
+ --node-count 3 \
182
+ --node-vm-size Standard_B2s \
183
+ --enable-managed-identity \
184
+ --generate-ssh-keys \
185
+ --location westeurope
186
+
187
+ # Get kubectl credentials
188
+ az aks get-credentials --resource-group my-rg --name my-cluster
189
+
190
+ # READ
191
+ az aks list -o table
192
+ az aks show --name my-cluster --resource-group my-rg -o json
193
+ az aks nodepool list --cluster-name my-cluster --resource-group my-rg -o table
194
+
195
+ # Scale
196
+ az aks scale --name my-cluster --resource-group my-rg --node-count 5
197
+ az aks nodepool scale --cluster-name my-cluster --resource-group my-rg \
198
+ --name nodepool1 --node-count 2
199
+
200
+ # Enable autoscaler
201
+ az aks update --name my-cluster --resource-group my-rg \
202
+ --enable-cluster-autoscaler --min-count 1 --max-count 10
203
+
204
+ # Upgrade
205
+ az aks get-upgrades --name my-cluster --resource-group my-rg -o table
206
+ az aks upgrade --name my-cluster --resource-group my-rg --kubernetes-version 1.29.0
207
+
208
+ # ⚠️ DESTRUCTIVE
209
+ az aks delete --name my-cluster --resource-group my-rg
210
+ ```
211
+
212
+ ## Azure Container Registry (ACR)
213
+
214
+ ```bash
215
+ # Create registry
216
+ az acr create --resource-group my-rg --name myregistry --sku Basic
217
+
218
+ # Login to registry
219
+ az acr login --name myregistry
220
+
221
+ # Build and push (ACR Tasks — no local Docker needed)
222
+ az acr build --registry myregistry --image myimage:tag .
223
+
224
+ # Tag and push (local Docker)
225
+ docker tag myimage myregistry.azurecr.io/myimage:tag
226
+ docker push myregistry.azurecr.io/myimage:tag
227
+
228
+ # READ
229
+ az acr list -o table
230
+ az acr repository list --name myregistry -o json
231
+ az acr repository show-tags --name myregistry --repository myimage -o json
232
+
233
+ # ⚠️ DESTRUCTIVE
234
+ az acr repository delete --name myregistry --repository myimage --tag tag
235
+ az acr delete --name myregistry --resource-group my-rg
236
+ ```
237
+
238
+ ### Grant AKS access to ACR
239
+
240
+ ```bash
241
+ az aks update --name my-cluster --resource-group my-rg --attach-acr myregistry
242
+ ```
@@ -0,0 +1,215 @@
1
+ # Storage: Accounts, Blobs, File Shares, Queues, Tables
2
+
3
+ ## Storage Accounts
4
+
5
+ ```bash
6
+ # Check name availability (globally unique)
7
+ az storage account check-name --name mystorageaccount -o json
8
+
9
+ # Create
10
+ az storage account create \
11
+ --resource-group my-rg \
12
+ --name mystorageaccount \
13
+ --location westeurope \
14
+ --sku Standard_LRS \
15
+ --kind StorageV2
16
+
17
+ # READ
18
+ az storage account list --resource-group my-rg -o table
19
+ az storage account show --name mystorageaccount --resource-group my-rg -o json
20
+
21
+ # Get connection string (for apps)
22
+ az storage account show-connection-string --name mystorageaccount -o tsv
23
+
24
+ # Get access keys
25
+ az storage account keys list --account-name mystorageaccount -o json
26
+
27
+ # ⚠️ SECURITY — regenerate key (invalidates existing connections using that key)
28
+ az storage account keys renew --account-name mystorageaccount --key primary
29
+
30
+ # ⚠️ DESTRUCTIVE
31
+ az storage account delete --name mystorageaccount --resource-group my-rg
32
+ ```
33
+
34
+ ### SKU Reference
35
+
36
+ | SKU | Redundancy | ~Cost (100GB/mo) |
37
+ |-----|-----------|-------------------|
38
+ | `Standard_LRS` | Local (3 copies, 1 datacenter) | ~$2 |
39
+ | `Standard_ZRS` | Zone (3 zones) | ~$2.50 |
40
+ | `Standard_GRS` | Geo (2 regions) | ~$4 |
41
+ | `Premium_LRS` | Local, SSD | ~$15 |
42
+
43
+ ## Blob Storage
44
+
45
+ ### Auth for blob commands
46
+
47
+ ```bash
48
+ # Option 1: Use login credentials (RBAC — preferred)
49
+ # Requires "Storage Blob Data Contributor" role
50
+ az storage blob list --account-name mystorageaccount --container-name mycontainer --auth-mode login -o table
51
+
52
+ # Option 2: Connection string (convenient for scripts)
53
+ export AZURE_STORAGE_CONNECTION_STRING=$(az storage account show-connection-string --name mystorageaccount -o tsv)
54
+
55
+ # Option 3: Account key
56
+ export AZURE_STORAGE_KEY=$(az storage account keys list --account-name mystorageaccount --query "[0].value" -o tsv)
57
+ ```
58
+
59
+ ### Containers
60
+
61
+ ```bash
62
+ # Create container
63
+ az storage container create --name mycontainer --account-name mystorageaccount
64
+
65
+ # List containers
66
+ az storage container list --account-name mystorageaccount -o table
67
+
68
+ # ⚠️ DESTRUCTIVE
69
+ az storage container delete --name mycontainer --account-name mystorageaccount
70
+ ```
71
+
72
+ ### Upload & Download
73
+
74
+ ```bash
75
+ # Upload single file
76
+ az storage blob upload \
77
+ --account-name mystorageaccount \
78
+ --container-name mycontainer \
79
+ --file ./local.txt \
80
+ --name remote.txt
81
+
82
+ # Upload directory (batch)
83
+ az storage blob upload-batch \
84
+ --account-name mystorageaccount \
85
+ --destination mycontainer \
86
+ --source ./local-dir
87
+
88
+ # Download
89
+ az storage blob download \
90
+ --account-name mystorageaccount \
91
+ --container-name mycontainer \
92
+ --name remote.txt \
93
+ --file ./local.txt
94
+
95
+ # Download directory
96
+ az storage blob download-batch \
97
+ --account-name mystorageaccount \
98
+ --source mycontainer \
99
+ --destination ./local-dir
100
+
101
+ # Copy between containers/accounts
102
+ az storage blob copy start \
103
+ --destination-container dest-container \
104
+ --destination-blob dest.txt \
105
+ --source-uri "https://sourceaccount.blob.core.windows.net/source-container/source.txt" \
106
+ --account-name destaccount
107
+ ```
108
+
109
+ ### List & Info
110
+
111
+ ```bash
112
+ az storage blob list --account-name mystorageaccount --container-name mycontainer -o table
113
+ az storage blob show --account-name mystorageaccount --container-name mycontainer --name myfile.txt -o json
114
+
115
+ # Show blob content (small files)
116
+ az storage blob download --account-name mystorageaccount --container-name mycontainer --name myfile.txt --file /dev/stdout
117
+ ```
118
+
119
+ ### Delete
120
+
121
+ ```bash
122
+ # ⚠️ DESTRUCTIVE
123
+ az storage blob delete --account-name mystorageaccount --container-name mycontainer --name myfile.txt
124
+
125
+ # Batch delete
126
+ az storage blob delete-batch --account-name mystorageaccount --source mycontainer --pattern "*.tmp"
127
+ ```
128
+
129
+ ### SAS Tokens
130
+
131
+ ```bash
132
+ # Generate SAS for a blob (time-limited access)
133
+ END=$(date -u -d "+1 hour" +%Y-%m-%dT%H:%MZ)
134
+ az storage blob generate-sas \
135
+ --account-name mystorageaccount \
136
+ --container-name mycontainer \
137
+ --name myfile.txt \
138
+ --permissions r \
139
+ --expiry "$END" \
140
+ --auth-mode key -o tsv
141
+
142
+ # Generate SAS for entire container
143
+ az storage container generate-sas \
144
+ --account-name mystorageaccount \
145
+ --name mycontainer \
146
+ --permissions rl \
147
+ --expiry "$END" \
148
+ --auth-mode key -o tsv
149
+ ```
150
+
151
+ ## File Shares (Azure Files)
152
+
153
+ ```bash
154
+ # Create share
155
+ az storage share create --name myshare --account-name mystorageaccount --quota 5
156
+
157
+ # Upload
158
+ az storage file upload --share-name myshare --source ./local.txt --account-name mystorageaccount
159
+
160
+ # Download
161
+ az storage file download --share-name myshare --path remote.txt --dest ./local.txt --account-name mystorageaccount
162
+
163
+ # List
164
+ az storage file list --share-name myshare --account-name mystorageaccount -o table
165
+
166
+ # Create directory
167
+ az storage directory create --share-name myshare --name mydir --account-name mystorageaccount
168
+
169
+ # ⚠️ DESTRUCTIVE
170
+ az storage share delete --name myshare --account-name mystorageaccount
171
+ ```
172
+
173
+ ## Queues
174
+
175
+ ```bash
176
+ az storage queue create --name myqueue --account-name mystorageaccount
177
+ az storage queue list --account-name mystorageaccount -o table
178
+
179
+ # Put message
180
+ az storage message put --queue-name myqueue --content "Hello" --account-name mystorageaccount
181
+
182
+ # Peek (read without removing)
183
+ az storage message peek --queue-name myqueue --account-name mystorageaccount -o json
184
+
185
+ # Get (read and start visibility timeout)
186
+ az storage message get --queue-name myqueue --account-name mystorageaccount -o json
187
+
188
+ # ⚠️ DESTRUCTIVE
189
+ az storage queue delete --name myqueue --account-name mystorageaccount
190
+ ```
191
+
192
+ ## Tables
193
+
194
+ ```bash
195
+ az storage table create --name mytable --account-name mystorageaccount
196
+ az storage table list --account-name mystorageaccount -o table
197
+
198
+ # ⚠️ DESTRUCTIVE
199
+ az storage table delete --name mytable --account-name mystorageaccount
200
+ ```
201
+
202
+ ## azcopy (Bulk Transfers)
203
+
204
+ For large-scale transfers, use `azcopy` instead of `az storage blob`:
205
+
206
+ ```bash
207
+ # Login (uses Azure AD)
208
+ azcopy login
209
+
210
+ # Sync local → blob
211
+ azcopy sync ./local-dir "https://mystorageaccount.blob.core.windows.net/mycontainer" --recursive
212
+
213
+ # Copy with SAS
214
+ azcopy copy ./local.txt "https://mystorageaccount.blob.core.windows.net/mycontainer/remote.txt?$SAS_TOKEN"
215
+ ```
@@ -53,6 +53,7 @@ Operations classified by risk. **Follow this model for all gcloud commands.**
53
53
  | **FORBIDDEN** | Refuse; escalate to human | `gcloud iam service-accounts keys create`, `gcloud projects delete`, passwords in CLI args |
54
54
 
55
55
  **Rules**:
56
+
56
57
  - **Never combine `--quiet` with destructive operations** — it suppresses the only safety gate
57
58
  - **Never put passwords/secrets as command-line arguments** — visible in process list & shell history
58
59
  - **Always use `--format=json`** for machine-parseable output (agents can't reliably parse tables)
@@ -60,7 +61,7 @@ Operations classified by risk. **Follow this model for all gcloud commands.**
60
61
 
61
62
  ## Command Structure
62
63
 
63
- ```
64
+ ```text
64
65
  gcloud [RELEASE_LEVEL] COMPONENT ENTITY OPERATION [ARGS] [FLAGS]
65
66
  ```
66
67
 
@@ -47,6 +47,7 @@ gcloud auth application-default revoke
47
47
  ```
48
48
 
49
49
  **ADC search order**:
50
+
50
51
  1. `GOOGLE_APPLICATION_CREDENTIALS` env var
51
52
  2. `~/.config/gcloud/application_default_credentials.json`
52
53
  3. GCE/GKE metadata server (when running on GCP)
@@ -102,6 +103,7 @@ gcloud config get-value compute/zone
102
103
  ```
103
104
 
104
105
  Common mismatches that cause failures:
106
+
105
107
  - VM in `europe-west1-b` connecting to Cloud SQL in `us-central1`
106
108
  - GKE cluster in one zone, persistent disks in another
107
109
  - Cloud Run in `europe-west1` accessing a VPC in `us-east1`