[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69BSVMF814QA7227HKB2EFS":3,"skill-same:01M69BSVMF814QA7227HKB2EFS":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":28,"linkOnly":29,"markdownContent":30,"markdownBody":31,"frontMatter":32,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":14,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":38,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M69BSVMF814QA7227HKB2EFS","local-postgres-to-azure",null,"Provision Azure Database for PostgreSQL Flexible Server and migrate a local PostgreSQL database using Azure CLI, pg_dump, and pg_restore. Use when asked to migrate the local campsite database to Azure, move local PostgreSQL to the cloud, or verify a PostgreSQL migration. Requires explicit approval before Azure changes; does not deploy an application.","microsoft\u002Fbobpgdemos","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69BSNXCFXGXZ9FADQT531RS",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fbobpgdemos\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Flocal-postgres-to-azure\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[24,25,26,27],"azure","local postgres to azure","cli","deploy","2026-11-10 10:12:30",false,"---\nname: local-postgres-to-azure\ndescription: 'Provision Azure Database for PostgreSQL Flexible Server and migrate a local PostgreSQL database using Azure CLI, pg_dump, and pg_restore. Use when asked to migrate the local campsite database to Azure, move local PostgreSQL to the cloud, or verify a PostgreSQL migration. Requires explicit approval before Azure changes; does not deploy an application.'\n---\n\n# Local PostgreSQL to Azure\n\n## Scope\n\nFor this repository's specific campsite demo, use\n[campsite-demo](..\u002Fcampsite-demo\u002FSKILL.md) for known target defaults, preflight,\nand approval-gated client-IP refresh before following this migration procedure.\n\nMove the database, not an application. This repository's database-only demo is\nin `campsites\u002F`. Use the steps below for provisioning and standard PostgreSQL\ndump\u002Frestore. Do not substitute the managed migration service without approval:\nthat service requires network access from Azure to the source, whereas this\nworkflow connects outward from the laptop. Never expose local PostgreSQL publicly.\n\nUse PowerShell on Windows. Consult current Microsoft Learn documentation and\n`az ... --help` before executing Azure commands; CLI flags and regional support\ncan change. Do not install or upgrade tooling without checking what exists.\n\n## 1. Inspect and verify the source\n\n- Confirm the source host, port, database, and user. For this demo they are\n  `localhost`, `55432`, `campsites`, and `campsite_admin`.\n- Run `campsites\\scripts\\local.ps1 -Action Verify`, then `-Action Demo`.\n  If the database is not running, ask before starting Docker or using another\n  PostgreSQL instance. Do not change the user's existing databases.\n- Query `server_version` and `pg_extension` for actual versions. Record database\n  size, campsite and reservation counts, and a deterministic data fingerprint.\n- Inventory extensions, roles, ownership, privileges, collations, and tablespaces.\n  Never assume local superuser access is available in Flexible Server.\n- Check `az account show`, `psql --version`, `pg_dump --version`, and\n  `pg_restore --version`. Use compatible clients, at least the target major\n  version. This demo REQUIRES exact source\u002Ftarget PostgreSQL major and minor\n  equality: compare `SHOW server_version_num` from both running servers before\n  dumping, and again before restoring. Stop on a mismatch. Azure manages minor\n  updates, so a previous check or the documentation is not sufficient.\n  Pin the local image by digest and assert its expected version at startup.\n  Preserve old volumes when preparing a new major version; never attach an\n  older PostgreSQL data directory to a newer major-version image.\n- Do not print credentials, access tokens, local password files, or connection\n  strings containing secrets. No secrets in source control, chat, or CLI arguments.\n\n## 2. Plan and get approval\n\nAsk for missing subscription, resource group, region, globally unique server\nname, database name, administrative identity, budget\u002FSKU, and network policy.\nOffer reusing an existing Flexible Server rather than assuming a new one.\n\nShow subscription name AND ID, region, resource group, PostgreSQL version,\ncompute\u002Fstorage SKU, estimated recurring cost with assumptions, authentication,\nnetwork exposure, and resources to create or change. Confirm compatible PostGIS,\npg_trgm, and btree_gist versions using Microsoft's extension matrix. If local\nextensions are newer than the target supports, stop and resolve compatibility.\n\nAsk explicit approval before provisioning, altering firewall\u002Fallowlist\u002Fauth\nsettings, granting privileges, or writing into a cloud database. Approval to\ncreate files is NOT approval to spend money or migrate data.\n\nFor public access, scope the migration firewall rule to the approved client IP.\nDo not enable `0.0.0.0`\u002FAllowAzureServices or a broad IP range. Private access\nrequires a working local route and DNS. Require TLS certificate verification.\nDo not change any existing rule or Entra administrator without approval.\n\n## 3. Provision or prepare the approved target\n\nUse Azure CLI (`az postgres flexible-server create`, `db create`, `parameter\nset`, and the relevant Entra\u002Fnetwork commands) or approved Bicep. Specify the\nsubscription explicitly. Do not rely on the current default subscription.\nValidate the chosen CLI syntax and configuration before execution.\n\nUse Entra authentication where possible. For an Entra database connection, obtain\na token with `az account get-access-token --resource-type oss-rdbms`, keep it only\nin process memory, and set `PGPASSWORD` for the client process. The connecting\nEntra role must already be configured on PostgreSQL. Refresh expired tokens.\nIf another credential is required, use an approved secret store or interactive\nsecure input; do not request a plaintext password in chat.\n\nAllowlist `postgis`, `pg_trgm`, and `btree_gist` through `azure.extensions`.\nPreserve existing allowlist entries. Verify `pg_available_extensions` and\npermission to create extensions before restoring.\n\nRestore only into an approved EMPTY database. Check for application tables and\nstop if present. Do not use `--clean`, drop a database, or overwrite data.\nDo not blindly copy local roles, passwords, superuser attributes, or ownership.\n\n## 4. Migrate from the laptop\n\nAgree on a maintenance window; stop source writers for the final copy. A\n`pg_dump` snapshot is consistent, but later source writes are NOT replicated.\nFor this tiny demo, an offline move is sufficient. Record dump\u002Frestore duration.\n\nUse a custom-format database dump (`pg_dump --format=custom`) and restore it\nwith `pg_restore --no-owner --no-acl --exit-on-error --single-transaction`.\nUse the actual source and target database names. Include the complete database\nobjects needed by the application, including extensions, indexes, constraints,\ngenerated columns, and identity sequences. For the container source, execute\n`pg_dump` inside its container and use `docker compose cp` to copy the archive\nto the ignored `campsites\\.local\\` folder. Never pipe binary archives through\nPowerShell text pipelines.\n\nRun `pg_restore` locally against the Azure hostname. Use `PGSSLMODE=verify-full`\nand a trusted root certificate store\u002Fbundle supported by the installed libpq.\nDo not weaken TLS if verification fails; fix trust configuration.\n\nCheck every native command's exit code. Preserve and restore previous process\nenvironment variables in `finally`. On errors stop, report the failed stage, and\nkeep the source intact. A failed restore is not success. Do not automatically\nretry destructive steps or expose credential-bearing command output.\n\n## 5. Verify and hand off\n\n- Compare source and destination counts and deterministic data fingerprints.\n  Serialize geography with `ST_AsEWKB`, JSONB as text, and order rows by primary\n  key; compare reservation business data and identity sequence state as well.\n- Execute `campsites\\sql\\04-verify.sql` on the target with\n  `psql -X -v ON_ERROR_STOP=1`. This checks behavior inside a rolled-back\n  transaction, so obtain permission for its temporary test writes first.\n- Execute `campsites\\sql\\03-demo.sql` and confirm exactly six combined\n  spatial\u002Ffull-text\u002FJSONB results and the typo-tolerant name match.\n- Verify extension versions, indexes, the exclusion constraint, and identities.\n  A restored row count alone is not sufficient.\n- For a concurrency demonstration use two sessions with overlapping date ranges\n  for the same campsite. The second must wait for the first transaction and fail\n  with SQLSTATE `23P01` after the first commits. Adjacent stays must succeed.\n  Use agreed test dates and remove only the specifically created test bookings.\n- Report actual measured migration duration, checks passed\u002Ffailed, target\n  hostname\u002Fdatabase (no credentials), and any remaining work.\n- Keep the local source available. Ask before deleting archives, removing the\n  temporary client firewall rule, or deleting Azure resources. Do not switch\n  applications, grant a future App Service identity, or claim an application\n  migration occurred; those are separate tasks requiring approval.\n\n## References\n\n- [Demo setup and presenter instructions](..\u002F..\u002F..\u002Fcampsites\u002FREADME.md)\n- [Azure CLI provisioning](https:\u002F\u002Flearn.microsoft.com\u002Fcli\u002Fazure\u002Fpostgres\u002Fflexible-server)\n- [Dump and restore](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fpostgresql\u002Fmigrate\u002Fhow-to-migrate-using-dump-and-restore)\n- [Supported extensions](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fpostgresql\u002Fextensions\u002Fconcepts-extensions-by-engine)\n- [Azure CLI managed migrations](https:\u002F\u002Flearn.microsoft.com\u002Fcli\u002Fazure\u002Fpostgres\u002Fflexible-server\u002Fmigration)\n","# Local PostgreSQL to Azure\n\n## Scope\n\nFor this repository's specific campsite demo, use\n[campsite-demo](..\u002Fcampsite-demo\u002FSKILL.md) for known target defaults, preflight,\nand approval-gated client-IP refresh before following this migration procedure.\n\nMove the database, not an application. This repository's database-only demo is\nin `campsites\u002F`. Use the steps below for provisioning and standard PostgreSQL\ndump\u002Frestore. Do not substitute the managed migration service without approval:\nthat service requires network access from Azure to the source, whereas this\nworkflow connects outward from the laptop. Never expose local PostgreSQL publicly.\n\nUse PowerShell on Windows. Consult current Microsoft Learn documentation and\n`az ... --help` before executing Azure commands; CLI flags and regional support\ncan change. Do not install or upgrade tooling without checking what exists.\n\n## 1. Inspect and verify the source\n\n- Confirm the source host, port, database, and user. For this demo they are\n  `localhost`, `55432`, `campsites`, and `campsite_admin`.\n- Run `campsites\\scripts\\local.ps1 -Action Verify`, then `-Action Demo`.\n  If the database is not running, ask before starting Docker or using another\n  PostgreSQL instance. Do not change the user's existing databases.\n- Query `server_version` and `pg_extension` for actual versions. Record database\n  size, campsite and reservation counts, and a deterministic data fingerprint.\n- Inventory extensions, roles, ownership, privileges, collations, and tablespaces.\n  Never assume local superuser access is available in Flexible Server.\n- Check `az account show`, `psql --version`, `pg_dump --version`, and\n  `pg_restore --version`. Use compatible clients, at least the target major\n  version. This demo REQUIRES exact source\u002Ftarget PostgreSQL major and minor\n  equality: compare `SHOW server_version_num` from both running servers before\n  dumping, and again before restoring. Stop on a mismatch. Azure manages minor\n  updates, so a previous check or the documentation is not sufficient.\n  Pin the local image by digest and assert its expected version at startup.\n  Preserve old volumes when preparing a new major version; never attach an\n  older PostgreSQL data directory to a newer major-version image.\n- Do not print credentials, access tokens, local password files, or connection\n  strings containing secrets. No secrets in source control, chat, or CLI arguments.\n\n## 2. Plan and get approval\n\nAsk for missing subscription, resource group, region, globally unique server\nname, database name, administrative identity, budget\u002FSKU, and network policy.\nOffer reusing an existing Flexible Server rather than assuming a new one.\n\nShow subscription name AND ID, region, resource group, PostgreSQL version,\ncompute\u002Fstorage SKU, estimated recurring cost with assumptions, authentication,\nnetwork exposure, and resources to create or change. Confirm compatible PostGIS,\npg_trgm, and btree_gist versions using Microsoft's extension matrix. If local\nextensions are newer than the target supports, stop and resolve compatibility.\n\nAsk explicit approval before provisioning, altering firewall\u002Fallowlist\u002Fauth\nsettings, granting privileges, or writing into a cloud database. Approval to\ncreate files is NOT approval to spend money or migrate data.\n\nFor public access, scope the migration firewall rule to the approved client IP.\nDo not enable `0.0.0.0`\u002FAllowAzureServices or a broad IP range. Private access\nrequires a working local route and DNS. Require TLS certificate verification.\nDo not change any existing rule or Entra administrator without approval.\n\n## 3. Provision or prepare the approved target\n\nUse Azure CLI (`az postgres flexible-server create`, `db create`, `parameter\nset`, and the relevant Entra\u002Fnetwork commands) or approved Bicep. Specify the\nsubscription explicitly. Do not rely on the current default subscription.\nValidate the chosen CLI syntax and configuration before execution.\n\nUse Entra authentication where possible. For an Entra database connection, obtain\na token with `az account get-access-token --resource-type oss-rdbms`, keep it only\nin process memory, and set `PGPASSWORD` for the client process. The connecting\nEntra role must already be configured on PostgreSQL. Refresh expired tokens.\nIf another credential is required, use an approved secret store or interactive\nsecure input; do not request a plaintext password in chat.\n\nAllowlist `postgis`, `pg_trgm`, and `btree_gist` through `azure.extensions`.\nPreserve existing allowlist entries. Verify `pg_available_extensions` and\npermission to create extensions before restoring.\n\nRestore only into an approved EMPTY database. Check for application tables and\nstop if present. Do not use `--clean`, drop a database, or overwrite data.\nDo not blindly copy local roles, passwords, superuser attributes, or ownership.\n\n## 4. Migrate from the laptop\n\nAgree on a maintenance window; stop source writers for the final copy. A\n`pg_dump` snapshot is consistent, but later source writes are NOT replicated.\nFor this tiny demo, an offline move is sufficient. Record dump\u002Frestore duration.\n\nUse a custom-format database dump (`pg_dump --format=custom`) and restore it\nwith `pg_restore --no-owner --no-acl --exit-on-error --single-transaction`.\nUse the actual source and target database names. Include the complete database\nobjects needed by the application, including extensions, indexes, constraints,\ngenerated columns, and identity sequences. For the container source, execute\n`pg_dump` inside its container and use `docker compose cp` to copy the archive\nto the ignored `campsites\\.local\\` folder. Never pipe binary archives through\nPowerShell text pipelines.\n\nRun `pg_restore` locally against the Azure hostname. Use `PGSSLMODE=verify-full`\nand a trusted root certificate store\u002Fbundle supported by the installed libpq.\nDo not weaken TLS if verification fails; fix trust configuration.\n\nCheck every native command's exit code. Preserve and restore previous process\nenvironment variables in `finally`. On errors stop, report the failed stage, and\nkeep the source intact. A failed restore is not success. Do not automatically\nretry destructive steps or expose credential-bearing command output.\n\n## 5. Verify and hand off\n\n- Compare source and destination counts and deterministic data fingerprints.\n  Serialize geography with `ST_AsEWKB`, JSONB as text, and order rows by primary\n  key; compare reservation business data and identity sequence state as well.\n- Execute `campsites\\sql\\04-verify.sql` on the target with\n  `psql -X -v ON_ERROR_STOP=1`. This checks behavior inside a rolled-back\n  transaction, so obtain permission for its temporary test writes first.\n- Execute `campsites\\sql\\03-demo.sql` and confirm exactly six combined\n  spatial\u002Ffull-text\u002FJSONB results and the typo-tolerant name match.\n- Verify extension versions, indexes, the exclusion constraint, and identities.\n  A restored row count alone is not sufficient.\n- For a concurrency demonstration use two sessions with overlapping date ranges\n  for the same campsite. The second must wait for the first transaction and fail\n  with SQLSTATE `23P01` after the first commits. Adjacent stays must succeed.\n  Use agreed test dates and remove only the specifically created test bookings.\n- Report actual measured migration duration, checks passed\u002Ffailed, target\n  hostname\u002Fdatabase (no credentials), and any remaining work.\n- Keep the local source available. Ask before deleting archives, removing the\n  temporary client firewall rule, or deleting Azure resources. Do not switch\n  applications, grant a future App Service identity, or claim an application\n  migration occurred; those are separate tasks requiring approval.\n\n## References\n\n- [Demo setup and presenter instructions](..\u002F..\u002F..\u002Fcampsites\u002FREADME.md)\n- [Azure CLI provisioning](https:\u002F\u002Flearn.microsoft.com\u002Fcli\u002Fazure\u002Fpostgres\u002Fflexible-server)\n- [Dump and restore](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fpostgresql\u002Fmigrate\u002Fhow-to-migrate-using-dump-and-restore)\n- [Supported extensions](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fpostgresql\u002Fextensions\u002Fconcepts-extensions-by-engine)\n- [Azure CLI managed migrations](https:\u002F\u002Flearn.microsoft.com\u002Fcli\u002Fazure\u002Fpostgres\u002Fflexible-server\u002Fmigration)\n",{"name":5,"description":7},"main","890174684faeec2700194a538e3ad7d1bd67aad3",".github\u002Fskills\u002Flocal-postgres-to-azure","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fbobpgdemos","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-01 06:13:38",{"source":8,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add microsoft\u002Fbobpgdemos --skill local-postgres-to-azure",{"tool":47,"command":48},"bunx","bunx skills add microsoft\u002Fbobpgdemos --skill local-postgres-to-azure",{"tool":50,"command":51},"pnpm","pnpm dlx skills add microsoft\u002Fbobpgdemos --skill local-postgres-to-azure","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fbobpgdemos\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Flocal-postgres-to-azure\u002FSKILL.md",true,[55,61,65],{"path":56,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Farchitectures.md","REFERENCE","参考文档",14044,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fai-research\u002Femerging-techniques-moe-training\u002Freferences\u002Farchitectures.md",{"path":62,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Finference.md",8239,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fai-research\u002Femerging-techniques-moe-training\u002Freferences\u002Finference.md",{"path":66,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Ftraining.md",9707,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fai-research\u002Femerging-techniques-moe-training\u002Freferences\u002Ftraining.md",[70,80],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":28},"01M69BST2HRKZ8ZT2FV4CXQMT8","campsite-demo","Run or explain this repository's specific campsite PostgreSQL portability demo. Use when asked to run the campsite demo, run the local campsite or campsites demo, explain the local demo, find your next escape, run campsite preflight or pre-flight, refresh the campsite demo client IP, prepare the campsite migration demo, or demonstrate local PostgreSQL to Azure Flexible Server. Local mode demonstrates PostGIS, full-text search, JSONB, typo tolerance, and availability without Azure access. Cloud mode checks exact versions, uses Entra and verified TLS, and gates firewall changes and migrations separately.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fbobpgdemos\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcampsite-demo\u002FSKILL.md",[],[77,78,24,79],"campsite demo","prepare","run",{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":89,"publishedAt":28},"01M69BSRJ7KQX7RGXMK131QS76","caldova-demo6","Preflight, build\u002Fdeploy, run, or reset this repository's Caldova Logistics Demo 6 (Knowledge Hub vector search kept fresh by a HorizonDB AI pipeline, with a live failover step). Use when asked to run, preflight, pre-flight, deploy, build, open, reset, or check Caldova demo 6, the Knowledge Hub, the AI pipeline vector app, or the Caldova failover demo. Includes the Demo 3 preflight (Foundry embedding model and AI extensions) as a prerequisite, but does not run the Demo 3 demo itself.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fbobpgdemos\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcaldova-demo6\u002FSKILL.md",[86],{"categoryNo":87,"categoryName":88,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署",[90,91,27,79,92],"caldova demo6","foundry","caldova demo"]