-
Notifications
You must be signed in to change notification settings - Fork 27
ARM Script to Create SQL Resources with Approved Naming Convention and Tags #156
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
ARM Script to Create SQL Resources with Approved Naming Convention and Tags #156
Conversation
…l storage names under the same subscription
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a couple comments about the db name and the server name
I also think you should rename the files so that the folder is sql (lowercase) and the files are something like create_sql_server and sql_server_params or something similarly descriptive
Also, instead of using your personal username and password, you should be using the Service Principal applicationId and secret, also in the key vault.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice update! Good work! I see you added the tags into your script and parametrized it! I removed my tags again and just added them in azure after running the script. I might add these into my ARM template later ;)
@@ -1,19 +1,23 @@ | |||
# Creates resource group and Azure SQL logical server | |||
|
|||
param( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely organized param!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks good. Cleverly imported Login module, clean params, good and simple validations. Good work, Natalia!
Purpose
This script creates a sql server and an empty sql db on Azure, based on user's inputs.
To test
Download the code, navigate to the .Automation/SQL folder and run the following command in Powershell with appropriate inputs:
.\azureDeploy.ps1 -tenantId <retrieveFromTheCohortsKeyVault> -subscriptionId <retrieveFromTheCohortsKeyVault> -applicationId <retrieve'automation-sp-appid'fromKeyVault/orYourAzurelogin> -secret <retrieve'automation-sp-appsecret'from KeyVault/orYourAzurePassword> -resourceGroupName testnsc-rg-dev-usw2-thursday -administratorLogin testnsc-admin-usw2-thursday -administratorLoginPassword Password123A$!@-location westus2 -serverName testnsc-sqlsrv-dev-usw2-test-thursday -sqlDBName testnsc-sqldb-dev-usw2-thursday -createdBy <yourName> -creatorsEmail <yourEmail>
You can choose to create a new resource group (rg), or point to the existing rg. Creation of the resource will not overwrite the resources already in the rg. Please delete all resources after testing.
It does take a while to create the server and db, you may need to give the script good 5mins to run.
When the script is done running, check the resource group and observe the server and db resources created.
To create an operational db, when a templateDB is available (in this case, nsc-sqldb-dev-usw2-thursday) in one of the Azure resource groups, this simple script may be run in PowerShell to create a brand new db and copy contents of the existing templateDB to a brand new db the script will create. Note: the script does not work for population of existing empty db resources: