%3CLINGO-SUB%20id%3D%22lingo-sub-1847417%22%20slang%3D%22en-US%22%3EAzure%20CLI%20%26amp%3B%20Flexible%20Server%20for%20Postgres%3A%20Better%20Together%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1847417%22%20slang%3D%22en-US%22%3E%3CP%20data-unlink%3D%22true%22%3EIf%20you%20prefer%20using%20a%20CLI%E2%80%94for%20one-time%20tasks%20as%20well%20as%20for%20more%20complicated%2C%20automated%20scripts%E2%80%94you%20can%20use%20the%20Azure%20CLI%20to%20take%20advantage%20of%20the%20improvements%20for%20provisioning%20and%20managing%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fpostgresql%2Fflexible-server%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EFlexible%20Server%20(in%20preview)%3C%2FA%3E%20in%20Azure%20Database%20for%20PostgreSQL.%26nbsp%3B%3CSPAN%3EFlexible%20Server%20is%20a%20new%20deployment%20option%20(now%20in%20preview)%20for%20our%20fully-managed%20Postgres%20database%20service%20and%20is%20designed%20to%20give%20you%20more%20granular%20control%20and%20flexibility%20over%20database%20management%20functions%20and%20configuration%20settings.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20new%20Azure%20CLI%20experience%20with%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-for-postgresql%2Fwhat-is-flexible-server-in-azure-database-for-postgresql%2Fba-p%2F1741346%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EFlexible%20Server%3C%2FA%3E%20for%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fpostgresql%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Database%20for%20PostgreSQL%3C%2FA%3E%20includes%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ERefined%20output%20to%20keep%20you%20informed%20about%20what's%20going%20on%20behind%20the%20scenes.%3C%2FLI%3E%0A%3CLI%3EOne%20command%20to%20create%20a%20secure%20server%20inside%20a%20virtual%20network.%3C%2FLI%3E%0A%3CLI%3EAbility%20to%20use%20contextual%20information%20between%20CLI%20commands%20help%20reduce%20the%20number%20of%20keystrokes%20for%20each%20command.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ETry%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%3Fview%3Dazure-cli-latest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Database%20for%20PostgreSQL%20-%20Flexible%20Server%20CLI%20commands.%3C%2FA%3E%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22screenshot-welcome-to-azure-cli-postgres-blog.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F233660i76537E1ED1CEE9B1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22screenshot-welcome-to-azure-cli-postgres-blog.png%22%20alt%3D%22Screenshot%20of%20Azure%20CLI%20welcome%20message%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EScreenshot%20of%20Azure%20CLI%20welcome%20message%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1209595719%22%20id%3D%22toc-hId--1209595719%22%3EUse%20local%20context%20to%20store%20common%20information%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFlexible%20server%20CLI%20commands%20support%20local%20context%20%26nbsp%3Bwith%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fconfig%2Fparam-persist%3Fview%3Dazure-cli-latest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20config%20param-persist%3C%2FA%3E%20%26nbsp%3Bcommand%20that%20stores%20information%20locally%20such%20as%20region%2C%20resource%20group%2C%20subscription%20ID%2C%20resource%20name%2C%20etc.%20for%20every%20sequential%20CLI%20command%20you%20run.%20You%20can%20easily%20turn%20on%20local%20context%20to%20store%20information%20with%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fconfig%2Fparam-persist%3Fview%3Dazure-cli-latest%23az_config_param_persist_on%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20config%20param%20persist%20on%3C%2FA%3E.%26nbsp%3B%20If%20local%20context%20is%20turned%20on%2C%20you%20can%20see%20the%20contextual%20information%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fconfig%2Fparam-persist%3Fview%3Dazure-cli-latest%23az_config_param_persist_show%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20config%20param-persist%20show%3C%2FA%3E.%20You%20can%20always%20turn%20if%20off%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fconfig%2Fparam-persist%3Fview%3Dazure-cli-latest%23az_config_param_persist_off%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20config%20param%20persist%20off%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERun%20the%20command%20to%20view%20what%20is%20in%20your%20local%20context.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eaz%20config%20param-persist%20show%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20as%20shown%20below%20will%20tell%20you%20the%20values%20stored%20in%20your%20local%20context.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3ECommand%20group%20%22config%20param-persist%22%20is%20experimental%20and%20not%20covered%20by%20customer%20support.%0A%7B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%22all%22%3A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7B%26nbsp%3B%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22location%22%3A%22eastus%22%2C%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22resource_group_name%22%3A%22mynewproject%22%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%26nbsp%3B%26nbsp%3B%26nbsp%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1277917114%22%20id%3D%22toc-hId-1277917114%22%3EEase%20of%20provisioning%20and%20deprovisioning%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20creating%20a%20Postgres%20server%20using%20our%20managed%20database%20service%20on%20Azure%2C%20you%20probably%20want%20to%20get%20started%20quickly.%20Especially%20if%20you're%20just%20trying%20things%20out.%20With%20the%20new%20and%20improved%20Azure%20CLI%20for%20Flexible%20Server%20on%20Azure%20Database%20for%20PostgreSQL%2C%20you%20can%20quickly%20create%20a%20Postgres%20server%20inside%20a%20virtual%20network.%20Or%20if%20you%20prefer%2C%20you%20can%20easily%20provision%20a%20server%20with%20firewall%20rules%20in%20one%20single%20step.%20You%20can%20also%20view%20the%20progress%20visually%20as%20CLI%20commands%20keep%20you%20informed%20about%20what's%20going%20on%20behind%20the%20scenes.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--529537349%22%20id%3D%22toc-hId--529537349%22%3ECreate%20a%20Postgres%20Flexible%20Server%20inside%20a%20new%20virtual%20network%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EInstead%20of%20creating%20a%20resource%20group%2C%20a%20virtual%20network%2C%20and%20a%20subnet%20with%20separate%20commands%2C%20you%20can%20use%20one%20command%E2%80%94%3CEM%3E%3CA%20title%3D%22postgres%20flexible%20server%20create%20command%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%3Fview%3Dazure-cli-latest%23az_postgres_flexible_server_create%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20postgres%20flexible-server%20create%3C%2FA%3E%3C%2FEM%3E%20as%20shown%20below%E2%80%94to%20create%20a%20secure%20PostgreSQL%20Flexible%20Server%20inside%20a%20new%20virtual%20network%20and%20have%20a%20new%20subnet%20delegated%20to%20the%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERun%20the%20command%20to%20create%20a%20secure%20server%20inside%20a%20virtual%20network.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eaz%20postgres%20flexible-server%20create%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20shows%20you%20at%20the%20steps%20taken%20to%20create%20this%20server%20with%20the%20virtual%20network%2C%20subnet%2C%20username%2C%20and%20password%20are%20all%20auto-generated.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3ELocal%20context%20is%20turned%20on.%20Its%20information%20is%20saved%20in%20working%20directory%20%2Fhome%2Fazuser.%20You%20can%20run%20az%20local-context%20off%20to%20turn%20it%20off.%0ACommand%20argument%20values%20from%20local%20context%3A%20--resource-group%3A%20mynewproject%2C%20--location%3A%20eastus%0ACommand%20group%20%22postgres%20flexible-server%22%20is%20in%20preview.%20It%20may%20be%20changed%2Fremoved%20in%20a%20future%20release.%0AChecking%20the%20existence%20of%20the%20resource%20group%20%22mynewproject%22...%0AResource%20group%20%22mynewproject%22%20exists%20%3F%20%3A%20True%0ACreating%20new%20vnet%20%22VNET095447391%22%20in%20resource%20group%20%22mynewproject%22...%0ACreating%20new%20subnet%20%22Subnet095447391%22%20in%20resource%20group%20%22mynewproject%22%20and%20delegating%20it%20to%20%22Microsoft.DBforPostgreSQL%2FflexibleServers%22...%0ACreating%20PostgreSQL%20Server%20%22server095447391%22%20in%20group%20%22mynewproject%22...%0AYour%20server%20%22server095447391%22%20is%20using%20sku%20%22Standard_D2s_v3%22%20(Paid%20Tier).%20Please%20refer%20to%20https%3A%2F%2Faka.ms%2Fpostgres-pricing%20for%20pricing%20details%0AMake%20a%20note%20of%20your%20password.%20If%20you%20forget%2C%20you%20would%20have%20to%20reset%20your%20password%20with%20%22az%20postgres%20flexible-server%20update%20-n%20server095447391%20-g%20mynewproject%20-p%20%3CNEW-PASSWORD%3E%22.%0A%7B%0A%26nbsp%3B%20%22connectionString%22%3A%20%22postgresql%3A%2F%2Fusername%3Ayour-password%40server095447391.postgres.database.azure.com%2Fpostgres%3Fsslmode%3Drequire%22%2C%0A%26nbsp%3B%20%22host%22%3A%20%22server095447391.postgres.database.azure.com%22%2C%0A%26nbsp%3B%20%22id%22%3A%20%22%2Fsubscriptions%2Fyour-subscription-id%2FresourceGroups%2Fmynewproject%2Fproviders%2FMicrosoft.DBforPostgreSQL%2FflexibleServers%2Fserver095447391%22%2C%0A%26nbsp%3B%20%22location%22%3A%20%22East%20US%22%2C%0A%26nbsp%3B%20%22password%22%3A%20%22your-password%22%2C%0A%26nbsp%3B%20%22resourceGroup%22%3A%20%22mynewproject%22%2C%0A%26nbsp%3B%20%22skuname%22%3A%20%22Standard_D2s_v3%22%2C%0A%26nbsp%3B%20%22subnetId%22%3A%20%22%2Fsubscriptions%2Fyour-subscription-id%2FresourceGroups%2Fmynewproject%2Fproviders%2FMicrosoft.Network%2FvirtualNetworks%2FVNET095447391%2Fsubnets%2FSubnet095447391%22%2C%0A%26nbsp%3B%20%22username%22%3A%20%22your-username%22%2C%0A%26nbsp%3B%20%22version%22%3A%20%2212%22%0A%7D%3C%2FNEW-PASSWORD%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1957975484%22%20id%3D%22toc-hId-1957975484%22%3ECreate%20a%20PostgreSQL%20Flexible%20Server%20with%20public%20access%20to%20all%20IPs%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUse%20%3CA%20title%3D%22command%3A%20az%20postgres%20flexible-server%20create%20%E2%80%93public-access%20all%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%3Fview%3Dazure-cli-latest%23az_postgres_flexible_server_create%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CEM%3Eaz%20postgres%20flexible-server%20create%20%E2%80%93public-access%20all%3C%2FEM%3E%3C%2FA%3E%26nbsp%3Bif%20you%20want%20to%20create%20a%20publicly%20accessible%20postgres%20server.%20Publicly%20accessible%20server%20can%20be%20access%20from%20any%20client%20machine%20as%20long%20as%20you%20have%20the%20correct%20username%20and%20password.%20%26nbsp%3BIf%20you%20want%20to%20restrict%20access%20only%20to%20your%20IP%20set%3CCODE%3E--public%20-access%3C%2FCODE%3Eargument%20to%20either%20your%20%3CIP%3E%20or%20an%20IP%20address%20range%20such%20as%20%3CSTART%20ip%3D%22%22%20address-%3D%22%22%20end%3D%22%22%20ip%3D%22%22%20address%3D%22%22%3E.%26nbsp%3B%3C%2FSTART%3E%3C%2FIP%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERun%20the%20command%20create%20a%20server%20will%20public%20access.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eaz%20postgres%20flexible-server%20create%20--public-access%20all%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20shows%20your%20a%20new%20server%20created%20with%20a%20firewall%20rule%20that%20allows%20IPs%20from%200.0.0.0%20to%20255.255.255.255%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3ELocal%20context%20is%20turned%20on.%20Its%20information%20is%20saved%20in%20working%20directory%20%2Fhome%2Fazuser.%20You%20can%20run%20az%20local-context%20off%20to%20turn%20it%20off.%0ACommand%20argument%20values%20from%20local%20context%3A%20--resource-group%3A%20mynewproject%2C%20--location%3A%20eastus%0ACommand%20group%20%22postgres%20flexible-server%22%20is%20in%20preview.%20It%20may%20be%20changed%2Fremoved%20in%20a%20future%20release.%0AChecking%20the%20existence%20of%20the%20resource%20group%20%22mynewproject%22...%0AResource%20group%20%22mynewproject%22%20exists%20%3F%20%3A%20True%0ACreating%20PostgreSQL%20Server%20%22server184001358%22%20in%20group%20%22mynewproject%22...%0AYour%20server%20%22server184001358%22%20is%20using%20sku%20%22Standard_D2s_v3%22%20(Paid%20Tier).%20Please%20refer%20to%20https%3A%2F%2Faka.ms%2Fpostgres-pricing%20for%20pricing%20details%0AConfiguring%20server%20firewall%20rule%20to%20accept%20connections%20from%20%220.0.0.0%22%20to%20%22255.255.255.255%22...%0AMake%20a%20note%20of%20your%20password.%20If%20you%20forget%2C%20you%20would%20have%20to%26nbsp%3B%20reset%20your%20password%20with%20%22az%20postgres%20flexible-server%20update%20-n%20server184001358%20-g%20mynewproject%20-p%20%3CNEW-PASSWORD%3E%22.%0A%7B%0A%22connectionString%22%3A%20%22postgresql%3A%2F%2Fusername%3Ayour-password%40server184001358.postgres.database.azure.com%2Fpostgres%3Fsslmode%3Drequire%22%2C%0A%22firewallName%22%3A%20%22AllowAll_2020-11-11_20-29-34%22%2C%0A%22host%22%3A%20%22server184001358.postgres.database.azure.com%22%2C%0A%22id%22%3A%20%22%2Fsubscriptions%2Fyour-subscription-id%2FresourceGroups%2Fmynewproject%2Fproviders%2FMicrosoft.DBforPostgreSQL%2FflexibleServers%2Fserver184001358%22%2C%0A%22location%22%3A%20%22East%20US%22%2C%0A%22password%22%3A%20%22your-password%22%2C%0A%22resourceGroup%22%3A%20%22mynewproject%22%2C%0A%22skuname%22%3A%20%22Standard_D2s_v3%22%2C%0A%22username%22%3A%20%22your-username%22%2C%0A%22version%22%3A%20%2212%22%0A%7D%3C%2FNEW-PASSWORD%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-150521021%22%20id%3D%22toc-hId-150521021%22%3EDelete%20the%20server%20when%20using%20local%20context%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUse%20%3CEM%3E%3CA%20title%3D%22command%20%3A%20az%20postgres%20flexible-server%20delete%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%3Fview%3Dazure-cli-latest%23az_postgres_flexible_server_delete%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20postgres%20flexible-server%20delete%3C%2FA%3E%26nbsp%3B%3C%2FEM%3Eto%20delete%20the%20server%20which%20will%20look%20in%20local%20context%20to%20find%20for%20any%20PostgreSQL%20flexible%20server.%20In%20the%20example%20below%2C%20it%20identified%20%3CEM%3Eserver056513445%3C%2FEM%3E%20in%20local%20context%20and%20hence%20tries%20to%20delete%20that%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERun%20the%20command%20to%20delete%20your%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eaz%20postgres%20flexible-server%20delete%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20prompts%20you%20to%20confirm%20if%20you%20want%20to%20delete%20the%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3ELocal%20context%20is%20turned%20on.%20Its%20information%20is%20saved%20in%20working%20directory%20%2Fhome%2Fazuser.%20You%20can%20run%20az%20local-context%20off%20to%20turn%20it%20off.%0ACommand%20argument%20values%20from%20local%20context%3A%20--resource-group%3A%20mynewproject%2C%20--name%3A%20server184001358%0ACommand%20group%20%22postgres%20flexible-server%22%20is%20in%20preview.%20It%20may%20be%20changed%2Fremoved%20in%20a%20future%20release.%0AAre%20you%20sure%20you%20want%20to%20delete%20the%20server%20%22server184001358%22%20in%20resource%20group%20%22mynewproject%22%20(y%2Fn)%3A%20y%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1656933442%22%20id%3D%22toc-hId--1656933442%22%3ETune%20your%20PostgreSQL%20server%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETuning%20PostgreSQL%26nbsp%3Bdatabase%20parameters%20is%20important%20to%20configure%20your%20server%20to%20fit%20your%20application%E2%80%99s%20needs%20or%20even%20to%20optimize%20performance.%20You%20can%20use%20%3CA%20title%3D%22command%20%3A%20az%20postgres%20flexible-server%20parameter%20set%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%2Fparameter%3Fview%3Dazure-cli-latest%23az_postgres_flexible_server_parameter_set%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20postgres%20flexible-server%20parameter%20set%20command%3C%2FA%3E%20to%20easily%20update%20server%20parameters%20with%20ease.%20You%20can%20view%20all%20the%20server%20parameter%20with%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%2Fparameter%3Fview%3Dazure-cli-latest%23az_postgres_flexible_server_parameter_list%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eparameter%20list%20command%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%2Fparameter%3Fview%3Dazure-cli-latest%23az_postgres_flexible_server_parameter_show%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eparameter%20show%20command%3C%2FA%3E%20to%20view%20the%20parameter%20values%20of%20an%20specific%20server%20parameter.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERun%20the%20command%20to%20configure%3CCODE%3Elog_error_verbosity%3C%2FCODE%3Eparameter%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eaz%20postgres%20flexible-server%20parameter%20set%20--name%20log_error_verbosity%20--value%20TERSE%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20shows%20you%20if%20the%20value%20has%20change%20to%3CCODE%3ETERSE%3C%2FCODE%3E%26nbsp%3B.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%20Local%20context%20is%20turned%20on.%20Its%20information%20is%20saved%20in%20working%20directory%20%2Fhome%2Fazuser.%20You%20can%20run%20az%20local-context%20off%20to%20turn%20it%20off.%0A%20Command%20argument%20values%20from%20local%20context%3A%20--server-name%3A%20server184001358%2C%20--resource-group%3A%20sumuth-flexible-server%0A%20Command%20group%20%22postgres%20flexible-server%20parameter%22%20is%20in%20preview.%20It%20may%20be%20changed%2Fremoved%20in%20a%20future%20release.%0A%0A%7B%0A%20%20%22allowedValues%22%3A%20%22terse%2Cdefault%2Cverbose%22%2C%0A%20%20%22dataType%22%3A%20%22Enumeration%22%2C%0A%20%20%22defaultValue%22%3A%20%22default%22%2C%0A%20%20%22description%22%3A%20%22Sets%20the%20verbosity%20of%20logged%20messages.%22%2C%0A%20%20%22id%22%3A%20%22%2Fsubscriptions%2Fxxxxxxxxxxxxxxxxxxxxxxxxxxx%2FresourceGroups%2Fsumuth-flexible-server%2Fproviders%2FMicrosoft.DBforPostgreSQL%2Fserversv2%2Fserver184001358%2Fconfigurations%2Flog_error_verbosity%22%2C%0A%20%20%22name%22%3A%20%22log_error_verbosity%22%2C%0A%20%20%22resourceGroup%22%3A%20%22sumuth-flexible-server%22%2C%0A%20%20%22source%22%3A%20%22user-override%22%2C%0A%20%20%22type%22%3A%20%22Microsoft.DBforPostgreSQL%2FflexibleServers%2Fconfigurations%22%2C%0A%20%20%22value%22%3A%20%22TERSE%22%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-830579391%22%20id%3D%22toc-hId-830579391%22%3EUse%20powerful%20Azure%20CLI%20utilities%20with%20flexible%20server%20CLI%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20CLI%20has%20powerful%20utilities%20that%20can%20be%20used%20with%20PostgreSQL%20Flexible%20Server%20CLI%20commands%20from%20finding%20right%20commands%2C%20getting%20readable%20output%20or%20even%20running%20REST%20APIs.%20%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20title%3D%22az%20find%20command%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Freference-index%3Fview%3Dazure-cli-latest%23az_find%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20find%20%3C%2FA%3E%20to%20find%20the%20command%20you%20are%20looking.%3C%2FLI%3E%0A%3CLI%3EUse%20the%3CCODE%3E--help%3C%2FCODE%3Eargument%20to%20get%20a%20complete%20list%20of%20commands%20and%20subgroups%20of%20a%20group.%3C%2FLI%3E%0A%3CLI%3EChange%20the%20%3CA%20title%3D%22Azure%20CLI%20output%20types%20supported%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fformat-output-azure-cli%3Fview%3Dazure-cli-latest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eoutput%20formatting%3C%2FA%3E%20to%20%3CEM%3Etable%3C%2FEM%3E%20or%20%3CEM%3Etsv%3C%2FEM%3E%20or%20%3CEM%3Eyaml%20%3C%2FEM%3Eformats%20as%20you%20see%20fit.%3C%2FLI%3E%0A%3CLI%3EUse%20%3CA%20title%3D%22Using%20Azure%20CLI%20in%20interactive%20mode%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Finteractive-azure-cli%3Fview%3Dazure-cli-latest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20interactive%3C%2FA%3E%20mode%20which%20provides%20interactive%20shell%20with%20auto-completion%2C%20command%20descriptions%2C%20and%20examples.%3C%2FLI%3E%0A%3CLI%3EUse%20%3CA%20title%3D%22Upgrade%20Azure%20CLI%20version%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Freference-index%3Fview%3Dazure-cli-latest%23az_upgrade%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20upgrade%3C%2FA%3E%20to%20update%20your%20CLI%20and%20extensions.%3C%2FLI%3E%0A%3CLI%3EUse%20%3CA%20title%3D%22Call%20REST%20APIs%20using%20Azure%20CLI%20securely%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Freference-index%3Fview%3Dazure-cli-latest%23az_rest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaz%20rest%3C%2FA%3E%26nbsp%3Bcommand%20that%20lets%20you%20call%20your%20service%20endpoints%20to%20run%20GET%2C%20PUT%2C%20PATCH%20methods%20in%20a%20secure%20way.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20new%20experience%20has%20been%20designed%20to%20support%20the%20best%20possible%20experience%20for%20developers%20to%20create%20and%20manage%20your%20PostgreSQL%20servers.%20We%E2%80%99d%20love%20for%20you%20to%20try%20out%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fcli%2Fazure%2Fpostgres%2Fflexible-server%3Fview%3Dazure-cli-latest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Database%20for%20PostgreSQL%20Flexible%20server%20CLI%20commands%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Faka.ms%2Fpostgres-cli-feedback%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eshare%20your%20feedback%3C%2FA%3E%20for%20new%20CLI%20commands%20or%20issues%20with%20existing%20ones.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1847417%22%20slang%3D%22en-US%22%3E%3CDIV%3ETips%20for%20using%20Azure%20CLI%20to%20improve%20productivity%20with%20the%20Flexible%20Server%20option%20(Preview)%20in%20Azure%20Database%20for%20PostgreSQL.%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22screenshot-welcome-to-azure-cli-postgres-blog.png%22%20style%3D%22width%3A%20938px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F233659i47350FA7E8B3C66E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22screenshot-welcome-to-azure-cli-postgres-blog.png%22%20alt%3D%22Screenshot%20of%20Azure%20CLI%20welcome%20message%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EScreenshot%20of%20Azure%20CLI%20welcome%20message%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1847417%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20CLI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edeployment%20options%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Epostgresql%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

If you prefer using a CLI—for one-time tasks as well as for more complicated, automated scripts—you can use the Azure CLI to take advantage of the improvements for provisioning and managing Flexible Server (in preview) in Azure Database for PostgreSQL. Flexible Server is a new deployment option (now in preview) for our fully-managed Postgres database service and is designed to give you more granular control and flexibility over database management functions and configuration settings. 

 

The new Azure CLI experience with Flexible Server for Azure Database for PostgreSQL includes:

  1. Refined output to keep you informed about what's going on behind the scenes.
  2. One command to create a secure server inside a virtual network.
  3. Ability to use contextual information between CLI commands help reduce the number of keystrokes for each command.

Try Azure Database for PostgreSQL - Flexible Server CLI commands.

 

Screenshot of Azure CLI welcome messageScreenshot of Azure CLI welcome message

 

Use local context to store common information

 

Flexible server CLI commands support local context  with az config param-persist  command that stores information locally such as region, resource group, subscription ID, resource name, etc. for every sequential CLI command you run. You can easily turn on local context to store information with az config param persist on.  If local context is turned on, you can see the contextual information using az config param-persist show. You can always turn if off using az config param persist off.

 

Run the command to view what is in your local context.

 

az config param-persist show

 

The output as shown below will tell you the values stored in your local context.

 

Command group "config param-persist" is experimental and not covered by customer support.
{
   "all":
     {  
       "location":"eastus",
       "resource_group_name":"mynewproject"
     }   
}

 

Ease of provisioning and deprovisioning

 

When creating a Postgres server using our managed database service on Azure, you probably want to get started quickly. Especially if you're just trying things out. With the new and improved Azure CLI for Flexible Server on Azure Database for PostgreSQL, you can quickly create a Postgres server inside a virtual network. Or if you prefer, you can easily provision a server with firewall rules in one single step. You can also view the progress visually as CLI commands keep you informed about what's going on behind the scenes.

 

Create a Postgres Flexible Server inside a new virtual network

 

Instead of creating a resource group, a virtual network, and a subnet with separate commands, you can use one command—az postgres flexible-server create as shown below—to create a secure PostgreSQL Flexible Server inside a new virtual network and have a new subnet delegated to the server.

 

Run the command to create a secure server inside a virtual network.

 

az postgres flexible-server create

 

The output shows you at the steps taken to create this server with the virtual network, subnet, username, and password are all auto-generated. 

 

Local context is turned on. Its information is saved in working directory /home/azuser. You can run az local-context off to turn it off.
Command argument values from local context: --resource-group: mynewproject, --location: eastus
Command group "postgres flexible-server" is in preview. It may be changed/removed in a future release.
Checking the existence of the resource group "mynewproject"...
Resource group "mynewproject" exists ? : True
Creating new vnet "VNET095447391" in resource group "mynewproject"...
Creating new subnet "Subnet095447391" in resource group "mynewproject" and delegating it to "Microsoft.DBforPostgreSQL/flexibleServers"...
Creating PostgreSQL Server "server095447391" in group "mynewproject"...
Your server "server095447391" is using sku "Standard_D2s_v3" (Paid Tier). Please refer to https://aka.ms/postgres-pricing for pricing details
Make a note of your password. If you forget, you would have to reset your password with "az postgres flexible-server update -n server095447391 -g mynewproject -p <new-password>".
{
  "connectionString": "postgresql://username:your-password@server095447391.postgres.database.azure.com/postgres?sslmode=require",
  "host": "server095447391.postgres.database.azure.com",
  "id": "/subscriptions/your-subscription-id/resourceGroups/mynewproject/providers/Microsoft.DBforPostgreSQL/flexibleServers/server095447391",
  "location": "East US",
  "password": "your-password",
  "resourceGroup": "mynewproject",
  "skuname": "Standard_D2s_v3",
  "subnetId": "/subscriptions/your-subscription-id/resourceGroups/mynewproject/providers/Microsoft.Network/virtualNetworks/VNET095447391/subnets/Subnet095447391",
  "username": "your-username",
  "version": "12"
}

 

Create a PostgreSQL Flexible Server with public access to all IPs

 

Use az postgres flexible-server create –public-access all if you want to create a publicly accessible postgres server. Publicly accessible server can be access from any client machine as long as you have the correct username and password.  If you want to restrict access only to your IP set --public -access argument to either your <IP – address> or an IP address range such as <Start IP address- End IP address>. 

 

Run the command create a server will public access.

 

az postgres flexible-server create --public-access all

 

The output shows your a new server created with a firewall rule that allows IPs from 0.0.0.0 to 255.255.255.255:

 

Local context is turned on. Its information is saved in working directory /home/azuser. You can run az local-context off to turn it off.
Command argument values from local context: --resource-group: mynewproject, --location: eastus
Command group "postgres flexible-server" is in preview. It may be changed/removed in a future release.
Checking the existence of the resource group "mynewproject"...
Resource group "mynewproject" exists ? : True
Creating PostgreSQL Server "server184001358" in group "mynewproject"...
Your server "server184001358" is using sku "Standard_D2s_v3" (Paid Tier). Please refer to https://aka.ms/postgres-pricing for pricing details
Configuring server firewall rule to accept connections from "0.0.0.0" to "255.255.255.255"...
Make a note of your password. If you forget, you would have to  reset your password with "az postgres flexible-server update -n server184001358 -g mynewproject -p <new-password>".
{
"connectionString": "postgresql://username:your-password@server184001358.postgres.database.azure.com/postgres?sslmode=require",
"firewallName": "AllowAll_2020-11-11_20-29-34",
"host": "server184001358.postgres.database.azure.com",
"id": "/subscriptions/your-subscription-id/resourceGroups/mynewproject/providers/Microsoft.DBforPostgreSQL/flexibleServers/server184001358",
"location": "East US",
"password": "your-password",
"resourceGroup": "mynewproject",
"skuname": "Standard_D2s_v3",
"username": "your-username",
"version": "12"
}

 

Delete the server when using local context

 

Use az postgres flexible-server delete to delete the server which will look in local context to find for any PostgreSQL flexible server. In the example below, it identified server056513445 in local context and hence tries to delete that server.

 

Run the command to delete your server.

 

az postgres flexible-server delete

 

The output prompts you to confirm if you want to delete the server.

 

Local context is turned on. Its information is saved in working directory /home/azuser. You can run az local-context off to turn it off.
Command argument values from local context: --resource-group: mynewproject, --name: server184001358
Command group "postgres flexible-server" is in preview. It may be changed/removed in a future release.
Are you sure you want to delete the server "server184001358" in resource group "mynewproject" (y/n): y

 

Tune your PostgreSQL server

 

Tuning PostgreSQL database parameters is important to configure your server to fit your application’s needs or even to optimize performance. You can use az postgres flexible-server parameter set command to easily update server parameters with ease. You can view all the server parameter with parameter list command and parameter show command to view the parameter values of an specific server parameter.

 

Run the command to configure log_error_verbosity parameter:

 

az postgres flexible-server parameter set --name log_error_verbosity --value TERSE

 

The output shows you if the value has change to TERSE .

 

 Local context is turned on. Its information is saved in working directory /home/azuser. You can run az local-context off to turn it off.
 Command argument values from local context: --server-name: server184001358, --resource-group: sumuth-flexible-server
 Command group "postgres flexible-server parameter" is in preview. It may be changed/removed in a future release.

{
  "allowedValues": "terse,default,verbose",
  "dataType": "Enumeration",
  "defaultValue": "default",
  "description": "Sets the verbosity of logged messages.",
  "id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/sumuth-flexible-server/providers/Microsoft.DBforPostgreSQL/serversv2/server184001358/configurations/log_error_verbosity",
  "name": "log_error_verbosity",
  "resourceGroup": "sumuth-flexible-server",
  "source": "user-override",
  "type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
  "value": "TERSE"
}

 

Use powerful Azure CLI utilities with flexible server CLI

 

Azure CLI has powerful utilities that can be used with PostgreSQL Flexible Server CLI commands from finding right commands, getting readable output or even running REST APIs.  

  • az find to find the command you are looking.
  • Use the --help argument to get a complete list of commands and subgroups of a group.
  • Change the output formatting to table or tsv or yaml formats as you see fit.
  • Use az interactive mode which provides interactive shell with auto-completion, command descriptions, and examples.
  • Use az upgrade to update your CLI and extensions.
  • Use az rest command that lets you call your service endpoints to run GET, PUT, PATCH methods in a secure way.

The new experience has been designed to support the best possible experience for developers to create and manage your PostgreSQL servers. We’d love for you to try out Azure Database for PostgreSQL Flexible server CLI commands and share your feedback for new CLI commands or issues with existing ones.