-
Notifications
You must be signed in to change notification settings - Fork 35
Azure Docs: DB for PostgreSQL #561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+493
−2
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,239 @@ | ||
| --- | ||
| title: "DB for PostgreSQL" | ||
| description: API coverage for Microsoft.DBforPostgreSQL in LocalStack for Azure. | ||
| description: Get started with Azure DB for PostgreSQL on LocalStack | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
| template: doc | ||
| --- | ||
|
|
||
| import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage"; | ||
|
|
||
| ## Introduction | ||
|
|
||
| Azure DB for PostgreSQL is a managed relational database service built on the PostgreSQL engine. | ||
| It helps provision and operate PostgreSQL servers with Azure control plane APIs for server, database, and network management. | ||
| This service is commonly used for application backends that require PostgreSQL compatibility with managed infrastructure workflows. For more information, see [Azure Database for PostgreSQL documentation](https://learn.microsoft.com/en-us/azure/postgresql/). | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| LocalStack for Azure provides a local environment for building and testing applications that make use of Azure DB for PostgreSQL. | ||
| The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of DB for PostgreSQL integration with LocalStack. | ||
|
|
||
| ## Getting started | ||
|
|
||
| This guide is designed for users new to Azure DB for PostgreSQL and assumes basic knowledge of the Azure CLI and our `azlocal` wrapper script. | ||
|
|
||
| Launch LocalStack using your preferred method. For more information, see [Introduction to LocalStack for Azure](/azure/getting-started/). Once the container is running, enable Azure CLI interception by running: | ||
|
|
||
| ```bash | ||
| azlocal start-interception | ||
| ``` | ||
|
|
||
| This command points the `az` CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API. | ||
| To revert this configuration, run: | ||
|
|
||
| ```bash | ||
| azlocal stop-interception | ||
| ``` | ||
|
|
||
| This reconfigures the `az` CLI to send commands to the official Azure management REST API. | ||
|
|
||
| ### Create a resource group | ||
|
|
||
| Create a resource group for your PostgreSQL resources: | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```bash | ||
| az group create \ | ||
| --name rg-postgres-demo \ | ||
| --location westeurope | ||
| ``` | ||
|
|
||
| ```bash title="Output" | ||
| { | ||
| "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-postgres-demo", | ||
| "location": "westeurope", | ||
| "name": "rg-postgres-demo", | ||
| "properties": { | ||
| "provisioningState": "Succeeded" | ||
| }, | ||
| ... | ||
| } | ||
| ``` | ||
|
|
||
| ### Create and inspect a PostgreSQL flexible server | ||
|
|
||
| Create a flexible server: | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```bash | ||
| az resource create \ | ||
| --resource-group rg-postgres-demo \ | ||
| --namespace Microsoft.DBforPostgreSQL \ | ||
| --resource-type flexibleServers \ | ||
| --name pgdoc96 \ | ||
| --location westeurope \ | ||
| --api-version 2024-08-01 \ | ||
| --properties '{"administratorLogin":"pgadmin","administratorLoginPassword":"P@ssword1234!","version":"16","storage":{"storageSizeGB":32},"sku":{"name":"Standard_B1ms","tier":"Burstable"}}' | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ```bash title="Output" | ||
| { | ||
| "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-postgres-demo/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgdoc96", | ||
| "name": "pgdoc96", | ||
| "location": "westeurope", | ||
| "properties": { | ||
| "administratorLogin": "pgadmin", | ||
| "state": "Ready", | ||
| "version": "16", | ||
| ... | ||
| }, | ||
| "sku": { | ||
| "name": "Standard_D2s_v3", | ||
| "tier": "GeneralPurpose" | ||
| }, | ||
| ... | ||
| } | ||
|
HarshCasper marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| Get and list flexible servers: | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```bash | ||
| az postgres flexible-server show \ | ||
| --name pgdoc96 \ | ||
| --resource-group rg-postgres-demo | ||
|
|
||
| az postgres flexible-server list \ | ||
| --resource-group rg-postgres-demo | ||
| ``` | ||
|
|
||
| ```bash title="Output" | ||
| { | ||
| "name": "pgdoc96", | ||
| "location": "westeurope", | ||
| "state": "Ready", | ||
| "version": "16", | ||
| "fullyQualifiedDomainName": "172.17.0.4", | ||
| ... | ||
| } | ||
| [ | ||
| { | ||
| "name": "pgdoc96", | ||
| "state": "Ready", | ||
| "version": "16", | ||
| ... | ||
| } | ||
| ] | ||
| ``` | ||
|
HarshCasper marked this conversation as resolved.
|
||
|
|
||
| ### Create and inspect a database | ||
|
|
||
| Create a database in the server: | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```bash | ||
| az postgres flexible-server db create \ | ||
| --resource-group rg-postgres-demo \ | ||
| --server-name pgdoc96 \ | ||
| --database-name appdb | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ```bash title="Output" | ||
| { | ||
| "charset": "utf8", | ||
| "collation": "en_US.utf8", | ||
| "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-postgres-demo/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgdoc96/databases/appdb", | ||
| "name": "appdb", | ||
| ... | ||
| } | ||
|
HarshCasper marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| Get and list databases: | ||
|
|
||
| ```bash | ||
| az postgres flexible-server db show \ | ||
| --resource-group rg-postgres-demo \ | ||
| --server-name pgdoc96 \ | ||
| --database-name appdb | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| az postgres flexible-server db list \ | ||
| --resource-group rg-postgres-demo \ | ||
| --server-name pgdoc96 | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ```bash title="Output" | ||
| { | ||
| "name": "appdb", | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
| "charset": "utf8", | ||
| "collation": "en_US.utf8", | ||
| ... | ||
| } | ||
| [ | ||
| { | ||
| "name": "postgres", | ||
| ... | ||
| }, | ||
| { | ||
| "name": "azure_sys", | ||
| ... | ||
| }, | ||
| { | ||
| "name": "azure_maintenance", | ||
| ... | ||
| }, | ||
| { | ||
| "name": "appdb", | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
| ... | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| ### Create and inspect a firewall rule | ||
|
|
||
| Create a firewall rule: | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```bash | ||
| az postgres flexible-server firewall-rule create \ | ||
| --resource-group rg-postgres-demo \ | ||
| --name pgdoc96 \ | ||
| --rule-name allow-local \ | ||
| --start-ip-address 0.0.0.0 \ | ||
| --end-ip-address 0.0.0.0 | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ```bash title="Output" | ||
| { | ||
| "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-postgres-demo/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgdoc96/firewallRules/allow-local", | ||
| "name": "allow-local", | ||
| "startIpAddress": "0.0.0.0", | ||
| "endIpAddress": "0.0.0.0", | ||
| ... | ||
| } | ||
|
HarshCasper marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| Get and list firewall rules: | ||
|
|
||
| ```bash | ||
| az postgres flexible-server firewall-rule show \ | ||
| --resource-group rg-postgres-demo \ | ||
| --name pgdoc96 \ | ||
| --rule-name allow-local | ||
|
HarshCasper marked this conversation as resolved.
Outdated
|
||
|
|
||
| az postgres flexible-server firewall-rule list \ | ||
| --resource-group rg-postgres-demo \ | ||
| --name pgdoc96 | ||
| ``` | ||
|
|
||
| ```bash title="Output" | ||
| { | ||
| "name": "allow-local", | ||
| "startIpAddress": "0.0.0.0", | ||
| "endIpAddress": "0.0.0.0", | ||
| ... | ||
| } | ||
| [ | ||
| { | ||
| "name": "allow-local", | ||
| "startIpAddress": "0.0.0.0", | ||
| "endIpAddress": "0.0.0.0", | ||
| ... | ||
| } | ||
| ] | ||
|
HarshCasper marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
|
HarshCasper marked this conversation as resolved.
|
||
| ## API Coverage | ||
|
|
||
| <AzureFeatureCoverage service="Microsoft.DBforPostgreSQL" client:load /> | ||
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.
Uh oh!
There was an error while loading. Please reload this page.