Merge pull request #14 from pamelafox/updates-apr13
Browse files- README.md +3 -5
- infra/main.bicep +2 -5
- infra/main.parameters.json +0 -3
README.md
CHANGED
@@ -90,21 +90,19 @@ This repository is set up for deployment on Azure App Service (w/PostgreSQL flex
|
|
90 |
|
91 |
1. Sign up for a [free Azure account](https://azure.microsoft.com/free/)
|
92 |
2. Install the [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd). (If you open this repository in Codespaces or with the VS Code Dev Containers extension, that part will be done for you.)
|
93 |
-
3.
|
94 |
|
95 |
```shell
|
96 |
-
azd
|
97 |
```
|
98 |
|
99 |
-
It will prompt you to provide a name (like "django-app") that will later be used in the name of the deployed resources.
|
100 |
-
|
101 |
4. Provision and deploy all the resources:
|
102 |
|
103 |
```shell
|
104 |
azd up
|
105 |
```
|
106 |
|
107 |
-
It will prompt you to
|
108 |
|
109 |
5. To be able to access `/admin`, you'll need a Django superuser. Navigate to the Azure Portal for the App Service, select SSH, and run this command:
|
110 |
|
|
|
90 |
|
91 |
1. Sign up for a [free Azure account](https://azure.microsoft.com/free/)
|
92 |
2. Install the [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd). (If you open this repository in Codespaces or with the VS Code Dev Containers extension, that part will be done for you.)
|
93 |
+
3. Login to Azure:
|
94 |
|
95 |
```shell
|
96 |
+
azd auth login
|
97 |
```
|
98 |
|
|
|
|
|
99 |
4. Provision and deploy all the resources:
|
100 |
|
101 |
```shell
|
102 |
azd up
|
103 |
```
|
104 |
|
105 |
+
It will prompt you to provide an `azd` environment name (like "django-app"), select a subscription from your Azure account, and select a location (like "eastus"). Then it will provision the resources in your account and deploy the latest code. If you get an error with deployment, changing the location can help, as there may be availability constraints for some of the resources.
|
106 |
|
107 |
5. To be able to access `/admin`, you'll need a Django superuser. Navigate to the Azure Portal for the App Service, select SSH, and run this command:
|
108 |
|
infra/main.bicep
CHANGED
@@ -9,10 +9,6 @@ param name string
|
|
9 |
@description('Primary location for all resources')
|
10 |
param location string
|
11 |
|
12 |
-
@secure()
|
13 |
-
@description('PostGreSQL Server administrator username')
|
14 |
-
param postgresAdminUser string
|
15 |
-
|
16 |
@secure()
|
17 |
@description('PostGreSQL Server administrator password')
|
18 |
param postgresAdminPassword string
|
@@ -24,6 +20,7 @@ param principalId string = ''
|
|
24 |
@description('Django SECRET_KEY for cryptographic signing')
|
25 |
param djangoSecretKey string
|
26 |
|
|
|
27 |
var resourceToken = toLower(uniqueString(subscription().id, name, location))
|
28 |
var tags = { 'azd-env-name': name }
|
29 |
|
@@ -36,7 +33,7 @@ resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
|
|
36 |
var prefix = '${name}-${resourceToken}'
|
37 |
|
38 |
var postgresServerName = '${prefix}-postgresql'
|
39 |
-
|
40 |
var postgresDatabaseName = 'django'
|
41 |
|
42 |
module postgresServer 'core/database/postgresql/flexibleserver.bicep' = {
|
|
|
9 |
@description('Primary location for all resources')
|
10 |
param location string
|
11 |
|
|
|
|
|
|
|
|
|
12 |
@secure()
|
13 |
@description('PostGreSQL Server administrator password')
|
14 |
param postgresAdminPassword string
|
|
|
20 |
@description('Django SECRET_KEY for cryptographic signing')
|
21 |
param djangoSecretKey string
|
22 |
|
23 |
+
|
24 |
var resourceToken = toLower(uniqueString(subscription().id, name, location))
|
25 |
var tags = { 'azd-env-name': name }
|
26 |
|
|
|
33 |
var prefix = '${name}-${resourceToken}'
|
34 |
|
35 |
var postgresServerName = '${prefix}-postgresql'
|
36 |
+
var postgresAdminUser = 'admin${uniqueString(resourceGroup.id)}'
|
37 |
var postgresDatabaseName = 'django'
|
38 |
|
39 |
module postgresServer 'core/database/postgresql/flexibleserver.bicep' = {
|
infra/main.parameters.json
CHANGED
@@ -11,9 +11,6 @@
|
|
11 |
"principalId": {
|
12 |
"value": "${AZURE_PRINCIPAL_ID}"
|
13 |
},
|
14 |
-
"postgresAdminUser": {
|
15 |
-
"value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} postgresAdminUser)"
|
16 |
-
},
|
17 |
"postgresAdminPassword": {
|
18 |
"value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} postgresAdminPassword)"
|
19 |
},
|
|
|
11 |
"principalId": {
|
12 |
"value": "${AZURE_PRINCIPAL_ID}"
|
13 |
},
|
|
|
|
|
|
|
14 |
"postgresAdminPassword": {
|
15 |
"value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} postgresAdminPassword)"
|
16 |
},
|