About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_first
⚠️
missing_linux_example
Summary:
The documentation provides only a PowerShell script for deploying Arc-enabled PostgreSQL in an Extended Zone, with no equivalent Bash or Linux shell example. The script uses PowerShell-specific syntax and patterns, which are native to Windows environments. There is no mention of how to perform the same steps on Linux or macOS, and the only code samples and automation guidance are Windows-centric.
Recommendations:
- Provide a Bash (or POSIX shell) script example that performs the same deployment steps, using az CLI and standard Linux shell conventions.
- Explicitly mention that the steps can be performed from Linux/macOS as well as Windows, and clarify any OS-specific requirements.
- Where possible, use cross-platform scripting (e.g., az CLI commands in Bash) in the main flow, and move PowerShell-specific automation to a separate section or appendix.
- Ensure that all prerequisite tools and instructions are described in a cross-platform manner, including installation steps for Linux/macOS.
- Add notes or callouts for any steps that are different or require adaptation on Linux/macOS.
Create pull request
Flagged Code Snippets
. "./CreateArcEnabledAksOnEZ"
function CreatePostgreSqlOnArcEnabledAksEz {
param(
[string] $SubscriptionId,
[string] $AKSClusterResourceGroupName,
[string] $location = "westus",
[string] $AKSName,
[string] $edgeZone,
[int] $nodeCount = 2,
[string] $vmSize = "standard_nv12ads_a10_v5",
[string] $ArcResourceGroupName,
[string] $DataControllerName,
[string] $CustomLocationName,
[string] $Namespace,
[string] $DataControllerConfigProfile,
[string] $KeyVaultName,
[string] $VaultSecretUser,
[string] $VaultSecretPass,
[string] $PostgreSqlName,
[switch] $Debug
)
try {
# Set the subscription
az account set --subscription $SubscriptionId
# Create the Arc-enabled EZ AKS cluster
createArcEnabledAksOnEz -SubscriptionId $SubscriptionId -AKSClusterResourceGroupName $AKSClusterResourceGroupName -location $location -AKSName $AKSName -edgeZone $edgeZone -nodeCount $nodeCount -vmSize $vmSize -ArcResourceGroupName $ArcResourceGroupName -Debug:$Debug
# Define name of the connected cluster resource
$CLUSTER_NAME = "$ArcResourceGroupName-cluster"
# Create a key vault and store login
$AZDATA_USERNAME = az keyvault secret show --vault-name $KeyVaultName --name $VaultSecretUser --query value -o tsv
$AZDATA_PASSWORD = az keyvault secret show --vault-name $KeyVaultName --name $VaultSecretPass --query value -o tsv
# Define login for data controller and metrics
$ENV:AZDATA_LOGSUI_USERNAME = $AZDATA_USERNAME
$ENV:AZDATA_LOGSUI_PASSWORD = $AZDATA_PASSWORD
$ENV:AZDATA_METRICSUI_USERNAME = $AZDATA_USERNAME
$ENV:AZDATA_METRICSUI_PASSWORD = $AZDATA_PASSWORD
$ENV:AZDATA_USERNAME = $AZDATA_USERNAME
$ENV:AZDATA_PASSWORD = $AZDATA_PASSWORD
# Define the connected cluster and extension for the custom location
$CONNECTED_CLUSTER_ID=$(az connectedk8s show --resource-group $ArcResourceGroupName --name $CLUSTER_NAME --query id --output tsv)
$EXTENSION_ID=$(az k8s-extension show `
--cluster-type connectedClusters `
--name 'my-data-controller-custom-location-ext' `
--cluster-name $CLUSTER_NAME `
--resource-group $ArcResourceGroupName `
--query id `
--output tsv)
# Create a custom location for the data controller
Write-Output "Creating data controller custom location..."
az customlocation create `
--resource-group $ArcResourceGroupName `
--name $CustomLocationName `
--host-resource-id $CONNECTED_CLUSTER_ID `
--namespace $Namespace `
--cluster-extension-ids $EXTENSION_ID
# Create data controller on Arc-enabled AKS cluster
Write-Output "Creating Arc Data Controller..."
az arcdata dc create --name $DataControllerName --subscription $SubscriptionId --cluster-name $CLUSTER_NAME --resource-group $ArcResourceGroupName --connectivity-mode direct --custom-location $CustomLocationName --profile-name $DataControllerConfigProfile
# Create PostgreSQL server on Arc-enabled AKS cluster
Write-Output "Creating PostgreSQL server..."
az postgres server-arc create --name $PostgreSqlName --k8s-namespace $Namespace --use-k8s
}
catch {
# Catch any error
Write-Error "An error occurred"
Write-Error $Error[0]
}
}
CreatePostgreSqlOnArcEnabledAksEz -SubscriptionId "<your subscription>" `
-AKSClusterResourceGroupName "my-aks-cluster-group" `
-location "westus" `
-AKSName "my-aks-cluster" `
-edgeZone "losangeles" `
-nodeCount 2 `
-vmSize "standard_nv12ad-DataControllerConfigProfiles_a10_v5" `
-ArcResourceGroupName "myArcResourceGroup" `
-DataControllerName "myDataController" `
-CustomLocationName "dc-custom-location" `
-Namespace "my-data-controller-custom-location" `
-DataControllerConfigProfile "azure-arc-aks-premium-storage" `
-KeyVaultName "ezDataControllerConfig" `
-VaultSecretUser "AZDATA-USERNAME" `
-VaultSecretPass "AZDATA-PASSWORD" `
-PostgreSqlName "my-postgresql"