Add Azure Function deployment, Log Analytics ingestion, and Bicep infrastructure - #11
Merged
Merged
Conversation
- Add -DceEndpoint and -DcrImmutableId parameters to get-availability.ps1 - Add Send-ToLogAnalytics function (gzip, 900KB batching) - Add ingestion block: builds resource + summary payloads, sends to custom tables - Add subscription-scoped Bicep (getavailability.bicep + resources module) creates: Log Analytics workspace, 2 custom tables, DCE, DCR - Update parameters.dev.bicepparam for new Bicep - Rewrite Setup/README.md for Get-Availability infrastructure - Create csharp/README.md with C#-specific content from root README - Update root README.md: add new params, ingestion section, link to C# README
- Combine getavailability-resources.bicep into getavailability.bicep - Switch from subscription-scoped to resource-group scoped deployment - Remove resourceGroupName param (RG created separately via az group create) - Location defaults to resourceGroup().location - Delete getavailability-resources.bicep module - Update parameters.dev.bicepparam and Setup/README.md accordingly
Disambiguates the historical data source workspace from the ingestion target (DCE/DCR). The new name makes clear it expects a GUID and that it is NOT the workspace used for result ingestion.
- Remove unused $batchSize variable - Remove dead status-code check after -ErrorAction Stop - Extract duplicated gzip logic into local $compressJson scriptblock - Early-return on empty payload; hoist headers out of loop - Add ## doc comments to Resolve-ObservationWindow and Get-ResourceInventory
…S, timer param, modules setup
…forms - Replace gzip scriptblock with nested function + [byte[]] cast to prevent PowerShell pipeline array unrolling that corrupted request bodies - Switch from Invoke-WebRequest to Invoke-RestMethod with retry logic (3 attempts, exponential backoff) and status code logging - Add kind: 'Direct' to DCR (required for Logs Ingestion API) - Fix DCR stream declarations: PeriodStart/PeriodEnd as string with todatetime() in transform KQL to avoid extend-on-existing-column errors
- host.json: remove managedDependency (incompatible with Flex Consumption) - profile.ps1: replace legacy MSI_SECRET with FUNCTIONS_WORKER_RUNTIME check - requirements.psd1: simplify comments for Flex Consumption - get-availability.ps1: extract Get-PlainToken helper (4 call sites), remove -UseBasicParsing (no-op in PS Core), drop ProgressPreference save/restore in Test-BatchEndpoints, remove stale C# reference - README.md: consolidate C# legacy references into single blockquote
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Transforms the standalone PowerShell script into a fully deployed Azure Function with IaC, Log Analytics ingestion, and production-verified pipeline.
What changed
Infrastructure (
Bicep/)GetAvailResources_CL,GetAvailSummary_CL), Data Collection Endpoint, Data Collection Rule, Storage Account, Flex Consumption Function App, Application Insights, Private Endpoints, and RBAC assignmentsparameters.dev.bicepparam— all Function App settings auto-wired at deploy time (no manual configuration afterfunc publish)Azure Function (
Functions/GetAvail/)RunGetAvailability) on Flex Consumption (FC1), PowerShell 7.4, system-assigned managed identityrun.ps1reads all config from App Settings and invokesget-availability.ps1profile.ps1authenticates via managed identity on cold starthost.json,requirements.psd1,.funcignoreconfigured for Flex Consumption (no managed dependencies)Modules/folder for vendored Az modules (Save-Module)Log Analytics ingestion
Send-ToLogAnalyticsfunction: gzip-compressed, batched at 900 KB, with retry (3 attempts, exponential backoff) via the Azure Monitor Ingestion APIkind: DirectandTimeGeneratedinjection transformsScript improvements (
get-availability.ps1)-DceEndpoint/-DcrImmutableIdparameters for optional Log Analytics ingestion-SourceWorkspaceIdrenamed from-Workspacefor clarityN/A)Get-PlainTokenhelper — centralizes Az.Accounts token acquisition (handles both SecureString and plain string returns)-UseBasicParsing(no-op in PowerShell Core) and$ProgressPreferencesave/restore patternRepository structure
Old/with its own READMEBug fixes
extendon existing columns in KQL transformskind: Direct: required for custom table ingestion without agentbyte[]pipeline unrolling: gzip compression produced individual bytes instead of byte array — fixed with nested function and explicit[byte[]]castVerified
AppExceptionstable: 0 entries