2 Commits

3 changed files with 64 additions and 3 deletions
+61
View File
@@ -401,6 +401,67 @@ func azure functionapp publish <function-app-name> --no-build
`--no-build` tells `func` to skip its own build step since we already compiled the TypeScript output. To also push application settings from `local.settings.json` in the same step, append `--publish-local-settings --overwrite-settings`. This is useful for the initial deployment or when settings and code change together. `--no-build` tells `func` to skip its own build step since we already compiled the TypeScript output. To also push application settings from `local.settings.json` in the same step, append `--publish-local-settings --overwrite-settings`. This is useful for the initial deployment or when settings and code change together.
### Triggering and verifying a deployed function
Set these variables once, then all snippets below are copy-pastable:
```sh
FUNCTION_APP=<function-app-name>
RESOURCE_GROUP=<resource-group>
APP_INSIGHTS=<app-insights-name> # only needed for the query at the end
```
After deployment, trigger the timer function immediately without waiting for the schedule:
```sh
MASTER_KEY=$(az functionapp keys list \
--name $FUNCTION_APP \
--resource-group $RESOURCE_GROUP \
--query masterKey -o tsv)
curl -X POST \
"https://${FUNCTION_APP}.azurewebsites.net/admin/functions/acmeProvisioner" \
-H "Content-Type: application/json" \
-H "x-functions-key: ${MASTER_KEY}" \
-d '{}'
```
Stream live logs while the function runs:
```sh
func azure functionapp logstream $FUNCTION_APP
```
Or tail logs via the Azure CLI:
```sh
az webapp log tail \
--name $FUNCTION_APP \
--resource-group $RESOURCE_GROUP
```
A successful run produces output similar to:
```
Initializing ACME account
Scanning DNS zones
Found 2 domain(s) tagged for ACME management
Issuing certificate for *.example.com, example.com
Certificate stored in KeyVault as 'cert-wildcard-example-com'
Done. Issued: 1, Renewed: 0, Skipped: 0, Errors: 0
```
If Application Insights is configured, query recent invocations with:
```sh
az monitor app-insights query \
--app $APP_INSIGHTS \
--resource-group $RESOURCE_GROUP \
--analytics-query "traces | where timestamp > ago(1h) | order by timestamp desc"
```
---
### Local testing ### Local testing
Create `local.settings.json` at the project root (gitignored) and fill in your values: Create `local.settings.json` at the project root (gitignored) and fill in your values:
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "@slawek/azure-acme-provisioner", "name": "@slawek/azure-acme-provisioner",
"version": "0.6.1", "version": "0.6.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@slawek/azure-acme-provisioner", "name": "@slawek/azure-acme-provisioner",
"version": "0.6.1", "version": "0.6.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/arm-authorization": "^9.0.0", "@azure/arm-authorization": "^9.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@slawek/azure-acme-provisioner", "name": "@slawek/azure-acme-provisioner",
"version": "0.6.1", "version": "0.6.2",
"author": { "author": {
"name": "Sławomir Koszewski", "name": "Sławomir Koszewski",
"url": "https://github.com/skoszewski" "url": "https://github.com/skoszewski"