Skip to content

Add Predictive Maintenance to MicroHack - #543

Merged
Marco Weber (qxsch) merged 19 commits into
microsoft:mainfrom
pewill-msft:feature/predictive-maintenance
Oct 12, 2026
Merged

Marco Weber (qxsch) merged 19 commits into
microsoft:mainfrom
pewill-msft:feature/predictive-maintenance

Conversation

@pewill-msft

Copy link
Copy Markdown
Contributor

Migrate the agentic predictive maintenance workshop from microsoft/agentic-factory-hack into the MicroHack repository structure.

Validated provisioning through Hack Console.

Remove Yarn apt repository to prevent expired GPG key errors during installations.
…ctive Maintenance hack

- Add challenges/challenge-01.md through challenge-05.md, converted from the
  original agentic-factory-hack challenge-0..4 READMEs, renumbered and
  restructured to fit the MicroHack challenge/walkthrough split (long sample
  output moved out to future walkthrough docs, code paths updated to the
  planned src/ layout).
- Add challenges/finish.md wrap-up page.
- Reuse all original hand-drawn diagrams/screenshots from the source repo in
  challenges/images/ (no AI-generated diagrams).
- Update README.md to use the real diagrams instead of mermaid.
- Add .github/copilot-instructions.md and .github/agents/agentplanning.agent.md
  carried over from the source repo, updated for the new numbering/paths.
- Fix devcontainer.json postCreateCommand and add setup-dotnet.sh for the
  root-level devcontainer selector.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…aintenance hack

- Add data/ with seed JSON files and kb-wiki markdown articles
- Add src/agents/ with the five Python agent scripts (flat layout,
  merged from the source repo's challenge-1 and challenge-3 folders)
  plus the create_knowledge_base.ipynb notebook and run-batch.py
- Add src/agent-workflow/ (Aspire host: Python app, .NET workflow host,
  React frontend), fixing two stale relative-path constants in
  app/agents.py that also corrected a pre-existing upstream bug in
  WORKSPACE_ROOT resolution
- Add labautomation/get-keys.sh, referenced by challenge-01.md
- Add walkthrough/challenge-01..05/solution-0N.md with exact commands,
  expected output, troubleshooting, and validation checklists
- Add walkthrough/challenge-03/RepairPlanner/ as the reference C#
  solution for the one challenge where participants build the agent
  themselves

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pins the same dependency set the source repo installed via
requirements.txt, but as a uv-managed project so `uv sync --frozen`
(already assumed by the devcontainer's postCreateCommand and
challenge-01.md) resolves to a reproducible environment. Verified
`uv lock` and `uv sync --frozen` both succeed and that key packages
(agent_framework, azure.cosmos, azure.identity, a2a, dotenv) import
correctly from the resulting .venv.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Convert the source ARM template to labautomation/main.bicep: Storage +
  machine-wiki blob container, Cosmos DB (FactoryOpsDB + 10 containers),
  AI Search, Container Registry + Container Apps environment, Microsoft
  Foundry account/project/model deployments, and APIM (Machine API /
  Maintenance API) with inline Cosmos-proxy policies generated via Bicep
  user-defined functions. Drops two vestigial resources found unused by
  any challenge (Content Safety account, placeholder container app).
- Add labautomation/deploy-lab.ps1: deploys main.bicep via
  Invoke-MhhDeploymentWithRegionFallback, then seeds Cosmos DB documents
  (signed REST calls, HMAC-SHA256 over the primary key) and the
  knowledge-base markdown files (az storage blob upload-batch) directly
  from the repo's data/ folder -- no bash or Python required.
- Add labautomation/shared-deploy-lab.ps1 (resource provider registration)
  and labautomation/lab-defaults.json (platform scoping config).
- Add labautomation/README.md documenting the automated seeding flow.
- Update labautomation/get-keys.sh's deployment-name lookup for the new
  mhh*-prefixed platform deployment naming.
- Fix a blob container naming bug (kb-wiki -> machine-wiki) in
  challenges/challenge-01.md and walkthrough/challenge-01/solution-01.md,
  and document the Cosmos DB fallback re-seed path in the latter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Refactor get-keys.sh to rely primarily on Bicep deployment outputs with
  clean fallback discovery by Azure resource type.
- Reduce emitted .env variables from 48 down to the 16 actually consumed by
  agents, notebooks, and workflow services.
- Remove redundant duplicate aliases (AI_FOUNDRY_*, legacy Azure OpenAI
  chat endpoint variables, COSMOS_CONNECTION_STRING, ACR credentials).
- Harmonize COSMOS_ACCOUNT_NAME in walkthrough/challenge-01/solution-01.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add scripts/install-pwsh.sh to install PowerShell 7 on-demand on Linux
  for local testing without bloating the participant devcontainer.
- Add scripts/test-deploy.ps1 to mock Hackbox platform cmdlets and test
  labautomation/deploy-lab.ps1 and Cosmos REST HMAC seeding end-to-end.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ation

- labautomation/main.bicep: fix APIM Cosmos query policies. Bicep
  triple-quoted multi-line strings do not support ${...} interpolation, so
  placeholders like ${resourceAudience} were being deployed as literal text,
  causing authentication-managed-identity to receive an invalid resource URI
  and throw an unhandled exception (surfaced as a generic APIM 500 instead of
  the intended 502 Cosmos DB Query Failed). Wrapped the policy templates in
  nested replace() calls to substitute the placeholders after template
  evaluation. Verified live against a deployed lab: all Machine/Maintenance
  API list and by-id/by-field operations now return 200 with real data.

- labautomation/deploy-lab.ps1: fix Cosmos DB document seeding. The Gateway
  REST API requires the x-ms-documentdb-partitionkey header on document
  upserts (not inferred from the body), which was missing and caused every
  upsert to fail with 400 Bad Request. Added a -PartitionKeyPath parameter to
  Invoke-CosmosDocumentUpsert and restructured  to carry each
  container's partition key path (matching main.bicep's cosmosContainers
  definitions). Verified live: all 10 containers seed successfully.
  Also added the #!/usr/bin/env pwsh shebang and made the script executable.

- labautomation/shared-deploy-lab.ps1: add shebang and executable bit so the
  script can be run directly on Linux/macOS.

- scripts/test-deploy.ps1: add shebang and executable bit; add an optional
  -Tag parameter so local test runs can supply extra resource group tags
  (e.g. to satisfy subscription policies); derive the resource-naming hash
  seed from -ResourceGroupName in addition to the caller's Entra user ID so
  repeated local test runs against different resource groups don't collide
  on already-provisioned globally-unique resource names (storage account,
  Azure AI Search, Cognitive Services custom subdomain) left over from a
  previous test resource group.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@qxsch
Marco Weber (qxsch) merged commit 1cb0079 into microsoft:main Oct 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants