az hack
is a command-line utility for quickly bootstrapping Azure resources commonly used for a student hack project. With az hack create
you will be able to spin up and configure databases, web hosting, and even artificial intelligence.
- Azure App Service plan, which creates a VM in Azure for your site
- Azure App Service, which will host and run your site
- Database, including Azure SQL Database, Azure Database for MySQL, or CosmosDB using Mongo API
- Key for Azure Cognitive Services, which can be used to add artificial intelligence into your application
All resources are placed in the same resource group
Pricing Note: The database and Cognitive Services keys may incur charging. Please consult the documentation for up-to-date pricing information.
All generated passwords, keys, and names will be displayed on the screen upon completion of the command. In addition, all values are stored as environmental variables in the website, and can be accessed in your application as such.
Note: You may want to consider using a package such as Node dotenv, python-dotenv, dotenv.net or PHP dotenv to simplify managing environmental variables for your application.
az hack
is an Azure Command Line Interface (CLI) extension, and is designed to be run locally.
az login
- Install the hack extension
az extension add --name hack
az hack create --name
--database {mysql, sql, cosmosdb}
--runtime {python, tomcat, jetty, php, aspnet, node}
--location
[--ai]
Base name of the application. Must be 10 characters or less. A random set of characters will be placed at the end to ensure uniqueness.
Type of database to create - cosmosdb (for Mongo API), mysql, or sql
Note for MySQL If you are using Azure Databases for MySQL, you will need to enable SSL for your application to connect
Note about firewalls By default, the firewall for SQL or MySQL will be configured to only allow resources on Azure to connect to your database. To enable your local system to connect, you will need to add your IP address to the MySQL firewall rules or SQL firewall rules. You can determine your systems public IP address by using a search engine and searching "What is my IP".
Runtime or framework for website - tomcat or jetty for Java, php, python, aspnet, node
Region for the application. See full list by using az location list
(Optional) Creates a key for use with Cognitive Services