Skip to content

[DRAFT] Enable manual approvals for deployment to production environments #97

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

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
342 changes: 342 additions & 0 deletions .github/workflows/contoso-traders-provisioning-deployment-template.yml

Large diffs are not rendered by default.

336 changes: 8 additions & 328 deletions .github/workflows/contoso-traders-provisioning-deployment.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## Documentation and Resources

* [Deployment Guide](./docs/App-Deployment-Guide.md)
* [Deployment Guide](./docs/app-deployment-Guide.md)
* [Deployment Guide for Inventory Management PowerApp](./docs/Inventory-power-app-deployment-guide.md)
* [Contributing](./docs/contributing.md)
* [Bicep Templates](./iac/)
Expand Down
2 changes: 1 addition & 1 deletion demo-scripts/devsecops/technical-walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The key takeaways from this demo are:

## Before you Begin

You must have Contoso Traders deployed in your environment and setup with GitHub Actions. Please refer to the deployment instructions [here](https://github.com/microsoft/ContosoTraders/blob/main/docs/App-Deployment-Guide.md)
You must have Contoso Traders deployed in your environment and setup with GitHub Actions. Please refer to the deployment instructions [here](https://github.com/microsoft/ContosoTraders/blob/main/docs/app-deployment-Guide.md)

## Walkthrough – DevSecOps with Contoso Traders

Expand Down
490 changes: 254 additions & 236 deletions docs/App-Deployment-Guide.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/Inventory-power-app-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You will be using a pre-created Package to import the Power App & Power Automate
<h2>Pre-Requisite</h2>
You will need the following before we start the deploymment

1. You need to have ContosoTraders App deployed in your Azure Subscription. If you have not deployed it yet, please refer the [documentation](../docs/App-Deployment-Guide.md).
1. You need to have ContosoTraders App deployed in your Azure Subscription. If you have not deployed it yet, please refer the [documentation](../docs/app-deployment-Guide.md).

2. An account with global administrator rights on the M365 tenant.

Expand Down
5 changes: 2 additions & 3 deletions docs/setup-local-instructions.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Instructions to run Contoso Traders locally.
# Instructions to run Contoso Traders locally

## Setting up ContosoTraders Infrastructure

1. You'll need an Azure subscription with the `Microsoft.OperationsManagement` resource provider registered ([steps](https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-register-resource-provider?tabs=azure-portal)).
2. You'll need a service principal in the `owner` role on the Azure subscription where the infrastructure is to be provisioned.
3. Git clone this repository to your machine.
4. Create the `SERVICEPRINCIPAL`, `ENVIRONMENT`, and `SQL_PASSWORD` github secrets ([instructions here](./App-Deployment-Guide)).
4. Create the `SERVICEPRINCIPAL`, `ENVIRONMENT_SUFFIX`, and `SQL_PASSWORD` github secrets ([instructions here](./app-deployment-Guide)).
5. Next, run the `contoso-traders-provisioning-deployment` github workflow. You can do this by going to the github repo's `Actions` tab, selecting the workflow, and clicking on the `Run workflow` button. This will both provision the infrastructure on Azure as well as deploy the applications (APIs, UI) to the infrastructure.


## Running ContosoTraders Locally

1. First ensure that the infrastructure setup has been completed as per steps above.
Expand Down
59 changes: 31 additions & 28 deletions iac/createResources.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ param prefixHyphenated string = 'contoso-traders'
// variables
////////////////////////////////////////////////////////////////////////////////

// common
var suffix = toLower(environment)

// key vault
var kvName = '${prefix}kv${environment}'
var kvName = '${prefix}kv${suffix}'
var kvSecretNameProductsApiEndpoint = 'productsApiEndpoint'
var kvSecretNameProductsDbConnStr = 'productsDbConnectionString'
var kvSecretNameProfilesDbConnStr = 'profilesDbConnectionString'
Expand All @@ -43,89 +46,89 @@ var kvSecretNameCognitiveServicesAccountKey = 'cognitiveServicesAccountKey'
var kvSecretNameAppInsightsConnStr = 'appInsightsConnectionString'

// user-assigned managed identity (for key vault access)
var userAssignedMIForKVAccessName = '${prefixHyphenated}-mi-kv-access${environment}'
var userAssignedMIForKVAccessName = '${prefixHyphenated}-mi-kv-access${suffix}'

// cosmos db (stocks db)
var stocksDbAcctName = '${prefixHyphenated}-stocks${environment}'
var stocksDbAcctName = '${prefixHyphenated}-stocks${suffix}'
var stocksDbName = 'stocksdb'
var stocksDbStocksContainerName = 'stocks'

// cosmos db (carts db)
var cartsDbAcctName = '${prefixHyphenated}-carts${environment}'
var cartsDbAcctName = '${prefixHyphenated}-carts${suffix}'
var cartsDbName = 'cartsdb'
var cartsDbStocksContainerName = 'carts'

// app service plan (products api)
var productsApiAppSvcPlanName = '${prefixHyphenated}-products${environment}'
var productsApiAppSvcName = '${prefixHyphenated}-products${environment}'
var productsApiAppSvcPlanName = '${prefixHyphenated}-products${suffix}'
var productsApiAppSvcName = '${prefixHyphenated}-products${suffix}'
var productsApiSettingNameKeyVaultEndpoint = 'KeyVaultEndpoint'
var productsApiSettingNameManagedIdentityClientId = 'ManagedIdentityClientId'

// sql azure (products db)
var productsDbServerName = '${prefixHyphenated}-products${environment}'
var productsDbServerName = '${prefixHyphenated}-products${suffix}'
var productsDbName = 'productsdb'
var productsDbServerAdminLogin = 'localadmin'
var productsDbServerAdminPassword = sqlPassword

// sql azure (profiles db)
var profilesDbServerName = '${prefixHyphenated}-profiles${environment}'
var profilesDbServerName = '${prefixHyphenated}-profiles${suffix}'
var profilesDbName = 'profilesdb'
var profilesDbServerAdminLogin = 'localadmin'
var profilesDbServerAdminPassword = sqlPassword

// azure container app (carts api)
var cartsApiAcaName = '${prefixHyphenated}-carts${environment}'
var cartsApiAcaEnvName = '${prefix}acaenv${environment}'
var cartsApiAcaName = '${prefixHyphenated}-carts${suffix}'
var cartsApiAcaEnvName = '${prefix}acaenv${suffix}'
var cartsApiAcaSecretAcrPassword = 'acr-password'
var cartsApiAcaContainerDetailsName = '${prefixHyphenated}-carts${environment}'
var cartsApiAcaContainerDetailsName = '${prefixHyphenated}-carts${suffix}'
var cartsApiSettingNameKeyVaultEndpoint = 'KeyVaultEndpoint'
var cartsApiSettingNameManagedIdentityClientId = 'ManagedIdentityClientId'


// storage account (product images)
var productImagesStgAccName = '${prefix}img${environment}'
var productImagesStgAccName = '${prefix}img${suffix}'
var productImagesProductDetailsContainerName = 'product-details'
var productImagesProductListContainerName = 'product-list'

// storage account (old website)
var uiStgAccName = '${prefix}ui${environment}'
var uiStgAccName = '${prefix}ui${suffix}'

// storage account (new website)
var ui2StgAccName = '${prefix}ui2${environment}'
var ui2StgAccName = '${prefix}ui2${suffix}'

// storage account (image classifier)
var imageClassifierStgAccName = '${prefix}ic${environment}'
var imageClassifierStgAccName = '${prefix}ic${suffix}'
var imageClassifierWebsiteUploadsContainerName = 'website-uploads'

// cognitive service (image recognition)
var cognitiveServiceName = '${prefixHyphenated}-cs${environment}'
var cognitiveServiceName = '${prefixHyphenated}-cs${suffix}'

// cdn
var cdnProfileName = '${prefixHyphenated}-cdn${environment}'
var cdnImagesEndpointName = '${prefixHyphenated}-images${environment}'
var cdnUiEndpointName = '${prefixHyphenated}-ui${environment}'
var cdnUi2EndpointName = '${prefixHyphenated}-ui2${environment}'
var cdnProfileName = '${prefixHyphenated}-cdn${suffix}'
var cdnImagesEndpointName = '${prefixHyphenated}-images${suffix}'
var cdnUiEndpointName = '${prefixHyphenated}-ui${suffix}'
var cdnUi2EndpointName = '${prefixHyphenated}-ui2${suffix}'

// redis cache
var redisCacheName = '${prefixHyphenated}-cache${environment}'
var redisCacheName = '${prefixHyphenated}-cache${suffix}'

// azure container registry
var acrName = '${prefix}acr${environment}'
var acrName = '${prefix}acr${suffix}'
// var acrCartsApiRepositoryName = '${prefix}apicarts' // @TODO: unused, probably remove later

// load testing service
var loadTestSvcName = '${prefixHyphenated}-loadtest${environment}'
var loadTestSvcName = '${prefixHyphenated}-loadtest${suffix}'

// application insights
var logAnalyticsWorkspaceName = '${prefixHyphenated}-loganalytics${environment}'
var appInsightsName = '${prefixHyphenated}-ai${environment}'
var logAnalyticsWorkspaceName = '${prefixHyphenated}-loganalytics${suffix}'
var appInsightsName = '${prefixHyphenated}-ai${suffix}'

// portal dashboard
var portalDashboardName = '${prefixHyphenated}-dashboard${environment}'
var portalDashboardName = '${prefixHyphenated}-dashboard${suffix}'

// aks cluster
var aksClusterName = '${prefixHyphenated}-aks${environment}'
var aksClusterDnsPrefix = '${prefixHyphenated}-aks${environment}'
var aksClusterName = '${prefixHyphenated}-aks${suffix}'
var aksClusterDnsPrefix = '${prefixHyphenated}-aks${suffix}'
var aksClusterNodeResourceGroup = '${prefixHyphenated}-aks-nodes-rg'

// tags
Expand Down