Azure CLI ‘Command Line Interface’ for Web Site & Database Management
I was having some email discussion today with a professor around his Azure course, the Professor was discusiing how how his institution plans on using Azure to teach the use Cloud tools via the Command Line so using the Azure CLI.
The Professor has a requirements to teach both Windows and Linux + Cloud within the course and the Professor had the following requirements for students on his course
Tasks include using the Azure CLI to create and tear down databases, websites, and mobile app backend services, all through the CLI.
Its interesting how developers and IT Pros are preferring to to spend time managing the Web from the command line.
The Windows Azure Team has spent a lot of time recently updating the Management Portal with amazing new features, but its great to see academic supporting tools such as NPM and Powershell I've ended up managing my Cloud applications with the Azure Command Line in PowerShell.
For me, it's simply faster, clearer and more obvious.
There is a command line tool for Mac, Linux, and Windows (if you install node and run "npm install azure --global") and there's PowerShell commands for the Windows admin. It's also worth noting that you can check out all the code for these as they are all open source and up on github at https://github.com/windowsazure or NPM at https://www.npmjs.com/package/azure-cli. The whole command line app is written in JavaScript, in fact.
Just as the command line version of the management tools has a very specific and comfortable noun/verb/options style, the cmdlets are very "PowerShelly" and will feel comfortable folks who are used to PowerShell. The documentation and tools for Azure Powershell Cmd Line.
So coming back to the requirements above
Tasks include using the Azure CLI to create and tear down databases, websites, and mobile app backend services, all through the CLI.
Commands to manage your Azure cloud services
Azure cloud services are applications and services hosted on web roles and worker roles. The following commands can be used to manage Azure cloud services.
service create [options] <serviceName>
This command creates a new cloud service
~$ azure service create newservicemsopentech
info: Executing command service create
+ Getting locations
help: Location:
1) East Asia
2) Southeast Asia
3) North Europe
4) West Europe
5) East US
6) West US
: 6
+ Creating cloud service
data: Cloud service name newservicemsopentech
info: service create command OK
service show [options] <serviceName>
This command shows the details of an Azure cloud service
~$ azure service show newservicemsopentech
info: Executing command service show
+ Getting cloud service
data: Name newservicemsopentech
data: Url https://management.core.windows.net/9e672699-1055-41ae-9c36-e85152f2e352/services/hostedservices/newservicemsopentech
data: Properties location West US
data: Properties label newservicemsopentech
data: Properties status Created
data: Properties dateCreated
data: Properties dateLastModified
info: service show command OK
service list [options]
This command lists Azure cloud services.
~$ azure service list
info: Executing command service list
data: Name Status
data: ----------- -------
data: service1 Created
data: service2 Created
info: service list command OK
service delete [options] <name>
This command deletes an Azure cloud service.
~$ azure service delete myservice
info: Executing command service delete myservice
info: cloud-service delete command OK
To force the deletion, use the -q
parameter.
Commands to manage your web apps
An Azure web app is a web configuration accessible by URI. Web apps are hosted in virtual machines, but you do not need to think about the details of creating and deploying the virtual machine yourself. Those details are handled for you by Azure.
site list [options]
This command lists your web apps.
~$ azure site list
info: Executing command site list
data: Name State Host names
data: -------------- ------- --------------------------------------------------
data: mongosite Running mongosite.antdf0.antares.windows.net
data: myphpsite Running myphpsite.antdf0.antares.windows.net
data: mydrupalsite36 Running mydrupalsite36.antdf0.antares.windows.net
info: site list command OK
site set [options] [name]
This command will set configuration options for your web app [name]
~$ azure site set
info: Executing command site set
Web site name: mydemosite
+ Getting sites
+ Updating site config information
info: site set command OK
site deploymentscript [options]
This command will generate a custom deployment script
~$ azure site deploymentscript --node
info: Executing command site deploymentscript
info: Generating deployment script for node.js Web Site
info: Generated deployment script files
info: site deploymentscript command OK
site create [options] [name]
This command creates a new web app and local directory.
~$ azure site create mysite
info: Executing command site create
info: Using location northeuropewebspace
info: Creating a new web site
info: Created web site at mysite.antdf0.antares.windows.net
info: Initializing repository
info: Repository initialized
info: site create command OK
Note:
The site name must be unique. You cannot create a site with the same DNS name as an existing site.
site browse [options] [name]
This command opens your web app in a browser.
~$ azure site browse mysite
info: Executing command site browse
info: Launching browser to https://mysite.antdf0.antares-test.windows-int.net
info: site browse command OK
site show [options] [name]
This command shows details for a web app.
~$ azure site show mysite
info: Executing command site show
info: Showing details for site
data: Site AdminEnabled true
data: Site HostNames mysite.antdf0.antares-test.windows-int.net
data: Site Name mysite
data: Site Owner 00060000814EDDEE
data: Site RepositorySiteName mysite
data: Site SelfLink https://s1.api.antdf0.antares.windows.net:454/subscriptions/444e62ff-4c5f-4116-a695-5c803ed584a5/webspaces/northeuropewebspace/sites/mysite
data: Site State Running
data: Site UsageState Normal
data: Site WebSpace northeuropewebspace
data: Config AppSettings
data: Config ConnectionStrings
data: Config DefaultDocuments 0=Default.htm, 1=Default.asp, 2=index.htm, 3=index.html, 4=iisstart.htm, 5=default.aspx, 6=index.php, 7=hostingstart.aspx
data: Config DetailedErrorLoggingEnabled false
data: Config HttpLoggingEnabled false
data: Config Metadata
data: Config NetFrameworkVersion v4.0
data: Config NumberOfWorkers 1
data: Config PhpVersion 5.3
data: Config PublishingPassword rJ}[Er2v[Y]q16B6vTD]n$[C2z}Z.pvgLfRcLnAp%ax]xstiLny};o@vmMAote@d
data: Config RequestTracingEnabled false
data: Repository https://mysite.scm.antdf0.antares-test.windows-int.net/
info: site show command OK
site delete [options] [name]
This command deletes a web app.
~$ azure site delete mysite
info: Executing command site delete
info: Deleting site mysite
info: Site mysite has been deleted
info: site delete command OK
site swap [options] [name]
This command swaps two web app slots.
This command supports the following additional option:
-q or **--quiet: Do not prompt for confirmation. Use this option in automated scripts.
site start [options] [name]
This command starts a web app.
~$ azure site start mysite
info: Executing command site start
info: Starting site mysite
info: Site mysite has been started
info: site start command OK
site stop [options] [name]
This command stops a web app.
~$ azure site stop mysite
info: Executing command site stop
info: Stopping site mysite
info: Site mysite has been stopped
info: site stop command OK
**site restart [options] [name]
This command stops and then starts a specified web app.
This command supports the following additional option:
--slot <slot>: The name of the slot to restart.
site location list [options]
This command lists your web app locations.
~$ azure site location list
info: Executing command site location list
+ Getting locations
data: Name
data: ----------------
data: West Europe
data: West US
data: North Central US
data: North Europe
data: East Asia
data: East US
info: site location list command OK
Commands to manage Azure Mobile Services
Azure Mobile Services brings together a set of Azure services that enable backend capabilities for your apps. Mobile Services commands are divided into the following categories:
- Commands to manage mobile service instances
- Commands to manage mobile service configuration
- Commands to manage mobile service tables
- Commands to manage mobile service scripts
- Commands to manage scheduled jobs
- Commands to scale a mobile service
The following options apply to most Mobile Services commands:
- -h or --help: Display output usage information.
- -s
<id>
or --subscription<id>
: Use a specific subscription, specified as<id>
. - -v or --verbose: Write verbose output.
- --json: Write JSON output.
Commands to manage mobile service instances
mobile locations [options]
This command lists geographic locations supported by Mobile Services.
~$ azure mobile locations
info: Executing command mobile locations
info: East US (default)
info: West US
info: North Europe
mobile create [options] [servicename] [sqlAdminUsername] [sqlAdminPassword]
This command creates a mobile service along with a SQL Database and server.
~$ azure mobile create todolist your_login_name Secure$Password
info: Executing command mobile create
+ Creating mobile service
info: Overall application state: Healthy
info: Mobile service (todolist) state: ProvisionConfigured
info: SQL database (todolist_db) state: Provisioned
info: SQL server (e96ean1c6v) state: ProvisionConfigured
info: mobile create command OK
This command supports the following additional options:
- -r
<sqlServer>
or --sqlServer<sqlServer>
: Use an existing SQL Database server, specified as<sqlServer>
. - -d
<sqlDb>
or --sqlDb<sqlDb>
: Use existing SQL database, specified as<sqlDb>
. - -l
<location>
or --location<location>
: Create the service in a specific location, specified as<location>
. Run azure mobile locations to get available locations. - --sqlLocation
<location>
: Create the SQL server in a specific<location>
; defaults to the location of the mobile service.
mobile delete [options] [servicename]
This command deletes a mobile service along with its SQL Database and server.
~$ azure mobile delete todolist -a -q
info: Executing command mobile delete
data: Mobile service todolist
data: SQL database todolistAwrhcL60azo1C401
data: SQL server fh1kvbc7la
+ Deleting mobile service
info: Deleted mobile service
+ Deleting SQL server
info: Deleted SQL server
+ Deleting mobile application
info: Deleted mobile application
info: mobile delete command OK
This command supports the following additional options:
- -d or --deleteData: Delete all data from this mobile service from the database.
- -a or --deleteAll: Delete the SQL Database and server.
- -q or --quiet: Do not prompt for confirmation. Use this option in automated scripts.
mobile list [options]
This command lists your mobile services.
~$ azure mobile list
info: Executing command mobile list
data: Name State URL
data: ------------ ----- --------------------------------------
data: todolist Ready https://todolist.azure-mobile.net/
data: mymobileapp Ready https://mymobileapp.azure-mobile.net/
info: mobile list command OK
mobile show [options] [servicename]
This command displays details about a mobile service.
~$ azure mobile show todolist
info: Executing command mobile show
+ Getting information
info: Mobile application
data: status Healthy
data: Mobile service name todolist
data: Mobile service status ProvisionConfigured
data: SQL database name todolistAwrhcL60azo1C401
data: SQL database status Linked
data: SQL server name fh1kvbc7la
data: SQL server status Linked
info: Mobile service
data: name todolist
data: state Ready
data: applicationUrl https://todolist.azure-mobile.net/
data: applicationKey XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
data: masterKey XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
data: webspace WESTUSWEBSPACE
data: region West US
data: tables TodoItem
info: mobile show command OK
mobile restart [options] [servicename]
This command restarts a mobile service instance.
~$ azure mobile restart todolist
info: Executing command mobile restart
+ Restarting mobile service
info: Service was restarted.
info: mobile restart command OK
mobile log [options] [servicename]
This command returns mobile service logs, filtering out all log types but error
.
~$ azure mobile log todolist -t error
info: Executing command mobile log
data:
data: timeCreated 2013-01-07T16:04:43.351Z
data: type error
data: source /scheduler/TestingLogs.js
data: message This is an error.
data:
info: mobile log command OK
This command supports the following additional options:
- -r
<query>
or --query<query>
: Executes the specified log query. - -t
<type>
or --type<type>
: Filter the returned logs by entry<type>
, which can beinformation
,warning
, orerror
. - -k
<skip>
or --skip<skip>
: Skips the number of rows specified by<skip>
. - -p
<top>
or --top<top>
: Returns a specific number of rows, specified by<top>
.
Note:
The --query parameter takes precedence over --type, --skip, and --top.
mobile recover [options] [unhealthyservicename] [healthyservicename]
This command recovers an unhealthy mobile service by moving it to a healthy mobile service in a different region.
This command supports the following additional option:
-q or --quiet: Suppress the prompt for confirmation of recovery.
mobile key regenerate [options] [servicename] [type]
This command regenerates the mobile service application key.
~$ azure mobile key regenerate todolist application
info: Executing command mobile key regenerate
info: New application key is SmLorAWVfslMcOKWSsuJvuzdJkfUpt40
info: mobile key regenerate command OK
Key types are master
and application
.
Note:
When you regenerate keys, clients that use the old key may be unable to access your mobile service. When you regenerate the application key, you should update your app with the new key value.
mobile key set [options] [servicename] [type] [value]
This command sets the mobile service key to a specific value.
Commands to manage mobile service configuration
mobile config list [options] [servicename]
This command lists configuration options for a mobile service.
~$ azure mobile config list todolist
info: Executing command mobile config list
+ Getting mobile service configuration
data: dynamicSchemaEnabled true
data: microsoftAccountClientSecret Not configured
data: microsoftAccountClientId Not configured
data: microsoftAccountPackageSID Not configured
data: facebookClientId Not configured
data: facebookClientSecret Not configured
data: twitterClientId Not configured
data: twitterClientSecret Not configured
data: googleClientId Not configured
data: googleClientSecret Not configured
data: apnsMode none
data: apnsPassword Not configured
data: apnsCertifcate Not configured
info: mobile config list command OK
mobile config get [options] [servicename] [key]
This command gets a specific configuration option for a mobile service, in this case dynamic schema.
~$ azure mobile config get todolist dynamicSchemaEnabled
info: Executing command mobile config get
data: dynamicSchemaEnabled true
info: mobile config get command OK
mobile config set [options] [servicename] [key] [value]
This command sets a specific configuration option for a mobile service, in this case dynamic schema.
~$ azure mobile config set todolist dynamicSchemaEnabled false
info: Executing command mobile config set
info: mobile config set command OK
Commands to manage mobile service tables
mobile table list [options] [servicename]
This command lists all tables in your mobile service.
~$azure mobile table list todolist
info: Executing command mobile table list
data: Name Indexes Rows
data: -------- ------- ----
data: Channel 1 0
data: TodoItem 1 0
info: mobile table list command OK
mobile table show [options] [servicename] [tablename]
This command shows returns details about a specific table.
~$azure mobile table show todolist
info: Executing command mobile table show
+ Getting table information
info: Table statistics:
data: Number of records 5
info: Table operations:
data: Operation Script Permissions
data: --------- ----------- -----------
data: insert 1900 bytes user
data: read Not defined user
data: update Not defined user
data: delete Not defined user
info: Table columns:
data: Name Type Indexed
data: ---- ------------- -------
data: id bigint(MSSQL) Yes
data: text string
data: complete boolean
info: mobile table show command OK
mobile table create [options] [servicename] [tablename]
This command creates a table.
~$azure mobile table create todolist Channels
info: Executing command mobile table create
+ Creating table
info: mobile table create command OK
This command supports the following additional option:
- -p
<permissions>
or --permissions<permissions>
: Comma-delimited list of<operation>
=<permission>
pairs, where<operation>
isinsert
,read
,update
, ordelete
and<permissions>
ispublic
,application
(default),user
, oradmin
.
mobile data read [options] [servicename] [tablename] [query]
This command reads data from a table.
~$azure mobile data read todolist TodoItem
info: Executing command mobile data read
data: id text complete
data: -- ------- --------
data: 1 item #1 false
data: 2 item #2 true
data: 3 item #3 false
data: 4 item #4 true
info: mobile data read command OK
This command supports the following additional options:
- -k
<skip>
or --skip<skip>
: Skips the number of rows specified by<skip>
. - -t
<top>
or --top<top>
: Returns a specific number of rows, specified by<top>
. - -l or --list: Returns data in a list format.
mobile table update [options] [servicename] [tablename]
This command changes delete permissions on a table to administrators only.
~$azure mobile table update todolist Channels -p delete=admin
info: Executing command mobile table update
+ Updating permissions
info: Updated permissions
info: mobile table update command OK
This command supports the following additional options:
- -p
<permissions>
or --permissions<permissions>
: Comma-delimited list of<operation>
=<permission>
pairs, where<operation>
isinsert
,read
,update
, ordelete
and<permissions>
ispublic
,application
(default),user
, oradmin
. - --deleteColumn
<columns>
: Comma-delimited list of columns to delete, as<columns>
. - -q or --quiet: Deletes columns without prompting for confirmation.
- --addIndex
<columns>
: Comma-delimited list of columns to include in the index. - --deleteIndex
<columns>
: Comma-delimited list of columns to exclude from the index.
mobile table delete [options] [servicename] [tablename]
This command deletes a table.
~$azure mobile table delete todolist Channels
info: Executing command mobile table delete
Do you really want to delete the table (yes/no): yes
+ Deleting table
info: mobile table delete command OK
Specify the -q parameter to delete the table without confirmation. Do this to prevent blocking of automation scripts.
mobile data truncate [options] [servicename] [tablename]
This commands removes all rows of data from the table.
~$azure mobile data truncate todolist TodoItem
info: Executing command mobile data truncate
info: There are 7 data rows in the table.
Do you really want to delete all data from the table? (y/n): y
info: Deleted 7 rows.
info: mobile data truncate command OK
Commands to manage scripts
Commands in this section are used to manage the server scripts that belong to a mobile service. For more information, see Work with server scripts in Mobile Services.
mobile script list [options] [servicename]
This command lists registered scripts, including both table and scheduler scripts.
~$azure mobile script list todolist
info: Executing command mobile script list
+ Getting script information
info: Table scripts
data: Name Size
data: --------------------- ----
data: table/TodoItem.delete 256
data: table/Devices.insert 1660
error: Unable to get shared scripts
info: Scheduler scripts
data: Name Status Interval Last run Next run
data: ------------------- --------- --------- --------- ---------
data: scheduler/undefined undefined undefined undefined undefined
data: scheduler/undefined undefined undefined undefined undefined
info: mobile script list command OK
mobile script download [options] [servicename] [scriptname]
This command downloads the insert script from the TodoItem table to a file namedtodoitem.insert.js
in the table
subfolder.
~$azure mobile script download todolist table/todoitem.insert.js
info: Executing command mobile script download
info: Saved script to ./table/todoitem.insert.js
info: mobile script download command OK
This command supports the following additional options:
- -p
<path>
or --path<path>
: The location in the file in which to save the script, where the current working directory is the default. - -f
<file>
or --file<file>
: The name of the file in which to save the script. - -o or --override: Overwrite an existing file.
- -c or --console: Write the script to the console instead of to a file.
mobile script upload [options] [servicename] [scriptname]
This command uploads a new script named todoitem.insert.js
from the table
subfolder.
~$azure mobile script upload todolist table/todoitem.insert.js
info: Executing command mobile script upload
info: mobile script upload command OK
The name of the file must be composed from the table and operation names, and it must be located in the table subfolder relative to the location where the command is executed. You can also use the -f <file>
or --file <file>
parameter to specify a different filename and path to the file that contains the script to register.
mobile script delete [options] [servicename] [scriptname]
This command removes the existing insert script from the TodoItem table.
~$azure mobile script delete todolist table/todoitem.insert.js
info: Executing command mobile script delete
info: mobile script delete command OK
Commands to manage scheduled jobs
Commands in this section are used to manage scheduled jobs that belong to a mobile service. For more information, see Schedule jobs.
mobile job list [options] [servicename]
This command lists scheduled jobs.
~$azure mobile job list todolist
info: Executing command mobile job list
info: Scheduled jobs
data: Job name Script name Status Interval Last run Next run
data: ---------- -------------------- -------- ----------- -------------------- --------------------
data: getUpdates scheduler/getUpdates enabled 15 [minute] 2013-01-14T16:15:00Z 2013-01-14T16:30:00Z
info: You can manipulate scheduled job scripts using the 'azure mobile script' command.
info: mobile job list command OK
mobile job create [options] [servicename] [jobname]
This command creates a new job named getUpdates
that is scheduled to run hourly.
~$azure mobile job create -i 1 -u hour todolist getUpdates
info: Executing command mobile job create
info: Job was created in disabled state. You can enable the job using the 'azure mobile job update' command.
info: You can manipulate the scheduled job script using the 'azure mobile script' command.
info: mobile job create command OK
This command supports the following additional options:
- -i
<number>
or --interval<number>
: The job interval, as an integer; the default value is15
. - -u
<unit>
or --intervalUnit<unit>
: The unit for the interval, which can be one of the following values:- minute (default)
- hour
- day
- month
- none (on-demand jobs)
- -t
<time>
--startTime<time>
The start time of the first run for the script, in ISO format; the default value isnow
.
Note:
New jobs are created in a disabled state because a script must still be uploaded. Use the mobile script upload command to upload a script and the mobile job updatecommand to enable the job.
mobile job update [options] [servicename] [jobname]
The following command enables the disabled getUpdates
job.
~$azure mobile job update -a enabled todolist getUpdates
info: Executing command mobile job update
info: mobile job update command OK
This command supports the following additional options:
- -i
<number>
or --interval<number>
: The job interval, as an integer; the default value is15
. - -u
<unit>
or --intervalUnit<unit>
: The unit for the interval, which can be one of the following values:- minute (default)
- hour
- day
- month
- none (on-demand jobs)
- -t
<time>
--startTime<time>
The start time of the first run for the script, in ISO format; the default value isnow
. - -a
<status>
or --status<status>
: The job status, which can be eitherenabled
ordisabled
.
mobile job delete [options] [servicename] [jobname]
This command removes the getUpdates scheduled job from the TodoList server.
~$azure mobile job delete todolist getUpdates
info: Executing command mobile job delete
info: mobile job delete command OK
Note:
Deleting a job also deletes the uploaded script.
Commands to scale a mobile service
Commands in this section are used to scale a mobile service. For more information, see Scaling a mobile service.
mobile scale show [options] [servicename]
This command displays scale information, including current compute mode and number of instances.
~$azure mobile scale show todolist
info: Executing command mobile scale show
data: webspace WESTUSWEBSPACE
data: computeMode Free
data: numberOfInstances 1
info: mobile scale show command OK
mobile scale change [options] [servicename]
This command changes the scale of the mobile service from free to premium mode.
~$azure mobile scale change -c Reserved -i 1 todolist
info: Executing command mobile scale change
+ Rescaling the mobile service
info: mobile scale change command OK
This command supports the following additional options:
- -c
<mode>
or --computeMode<mode>
: The compute mode must be eitherFree
orReserved
. - -i
<count>
or --numberOfInstances<count>
: The number of instances used when running in reserved mode.
Note:
When you set compute mode to Reserved
, all of your mobile services in the same region run in premium mode.
Commands to enable preview features for your Mobile Service
mobile preview list [options] [servicename]
This command displays the preview features available on the specified service and whether they are enabled.
~$ azure mobile preview list mysite
info: Executing command mobile preview list
+ Getting preview features
data: Preview feature Enabled
data: --------------- -------
data: SourceControl No
data: Users No
info: You can enable preview features using the 'azure mobile preview enable' command.
info: mobile preview list command OK
mobile preview enable [options] [servicename] [featurename]
This command enables the specified preview feature for a mobile service. Note that once enabled, preview features cannot be disabled for a mobile service.
Commands to manage your mobile service APIs
mobile api list [options] [servicename]
This command displays a list mobile service custom APIs that you have created for your mobile service.
~$ azure mobile api list mysite
info: Executing command mobile api list
+ Retrieving list of APIs
info: APIs
data: Name Get Put Post Patch Delete
data: -------------------- ----------- ----------- ----------- ----------- -----------
data: myCustomRetrieveAPI application application application application application
info: You can manipulate API scripts using the 'azure mobile script' command.
info: mobile api list command OK
mobile api create [options] [servicename] [apiname]
Creates a mobile service custom API
~$ azure mobile api create mysite myCustomRetrieveAPI
info: Executing command mobile api create
+ Creating custom API: 'myCustomRetrieveAPI'
info: API was created successfully. You can modify the API using the 'azure mobile script' command.
info: mobile api create command OK
This command supports the following additional option:
-p or --permissions <permissions>: A comma delimited list of <method>=<permission> pairs.
mobile api update [options] [servicename] [apiname]
This command updates the specified mobile service custom API.
This command supports the following additional option::
- -p or --permissions <permissions>: A comma delimited list of <method>=<permission> pairs.
- -f or --force: Overrides any custom changes to the permissions metadata file.
mobile api delete [options] [servicename] [apiname]
~$ azure mobile api delete mysite myCustomRetrieveAPI
info: Executing command mobile api delete
+ Deleting API: 'myCustomRetrieveAPI'
info: mobile api delete command OK
This command deletes the specified mobile service custom API.
Commands to manage your mobile application app settings
mobile appsetting list [options] [servicename]
This command displays the mobile application app settings for the specified service.
~$ azure mobile appsetting list mysite
info: Executing command mobile appsetting list
+ Retrieving app settings
data: Name Value
data: ----------------- -----
data: enablebetacontent true
info: mobile appsetting list command OK
mobile appsetting add [options] [servicename] [name] [value]
This command adds a custom application setting for your mobile service.
~$ azure mobile appsetting add mysite enablebetacontent true
info: Executing command mobile appsetting add
+ Retrieving app settings
+ Adding app setting
info: mobile appsetting add command OK
mobile appsetting delete [options] [servicename] [name]
This command removes the specified application setting for your mobile service.
~$ azure mobile appsetting delete mysite enablebetacontent
info: Executing command mobile appsetting delete
+ Retrieving app settings
+ Removing app setting 'enablebetacontent'
info: mobile appsetting delete command OK
mobile appsetting show [options] [servicename] [name]
This command removes the specified application setting for your mobile service.
~$ azure mobile appsetting show mysite enablebetacontent
info: Executing command mobile appsetting show
+ Retrieving app settings
info: enablebetacontent: true
info: mobile appsetting show command OK
Commands to manage SQL Databases
Use these commands to manage your Azure SQL Databases
Commands to manage SQL Servers.
Use these commands to manage your SQL Servers
sql server create <administratorLogin> <administratorPassword> <location>
Create a new database server
~$ azure sql server create test T3stte$t "West US"
info: Executing command sql server create
+ Creating SQL Server
data: Server Name i1qwc540ts
info: sql server create command OK
sql server show <name>
Display server details.
~$ azure sql server show xclfgcndfg
info: Executing command sql server show
+ Getting SQL server
data: SQL Server Name xclfgcndfg
data: SQL Server AdministratorLogin msopentechforums
data: SQL Server Location West US
data: SQL Server FullyQualifiedDomainName xclfgcndfg.database.windows.net
info: sql server show command OK
sql server list
Get the list of servers.
~$ azure sql server list
info: Executing command sql server list
+ Getting SQL server
data: Name Location
data: ---------- --------
data: xclfgcndfg West US
info: sql server list command OK
sql server delete <name>
Deletes a server
~$ azure sql server delete i1qwc540ts
info: Executing command sql server delete
Delete server i1qwc540ts? [y/n] y
+ Removing SQL Server
info: sql server delete command OK
Commands to manage SQL Databases
Use these commands to manage your SQL Databases.
sql db create [options] <serverName> <databaseName> <administratorPassword>
Creates a new database instance
~$ azure sql db create fr8aelne00 newdb test
info: Executing command sql db create
Administrator password: ********
+ Creating SQL Server Database
info: sql db create command OK
sql db show [options] <serverName> <databaseName> <administratorPassword>
Display database details.
C:\windows\system32>azure sql db show fr8aelne00 newdb test
info: Executing command sql db show
Administrator password: ********
+ Getting SQL server databases
data: Database _ ContentRootElement=m:properties, id=https://fr8aelne00.datab
ase.windows.net/v1/ManagementService.svc/Server2('fr8aelne00')/Databases(4), ter
m=Microsoft.SqlServer.Management.Server.Domain.Database, scheme=https://schemas.m
icrosoft.com/ado/2007/08/dataservices/scheme, link=[rel=edit, title=Database, hr
ef=Databases(4), rel=https://schemas.microsoft.com/ado/2007/08/dataservices/relat
ed/Server, type=application/atom+xml;type=entry, title=Server, href=Databases(4)
/Server, rel=https://schemas.microsoft.com/ado/2007/08/dataservices/related/Servi
ceObjective, type=application/atom+xml;type=entry, title=ServiceObjective, href=
Databases(4)/ServiceObjective, rel=https://schemas.microsoft.com/ado/2007/08/data
services/related/DatabaseMetrics, type=application/atom+xml;type=entry, title=Da
tabaseMetrics, href=Databases(4)/DatabaseMetrics, rel=https://schemas.microsoft.c
om/ado/2007/08/dataservices/related/DatabaseCopies, type=application/atom+xml;ty
pe=feed, title=DatabaseCopies, href=Databases(4)/DatabaseCopies], title=, update
d=2013-11-18T19:48:27Z, name=
data: Database Id 4
data: Database Name newdb
data: Database ServiceObjectiveId 910b4fcb-8a29-4c3e-958f-f7ba794388b2
data: Database AssignedServiceObjectiveId 910b4fcb-8a29-4c3e-958f-f7ba794388b2
data: Database ServiceObjectiveAssignmentState 1
data: Database ServiceObjectiveAssignmentStateDescription Complete
data: Database ServiceObjectiveAssignmentErrorCode
data: Database ServiceObjectiveAssignmentErrorDescription
data: Database ServiceObjectiveAssignmentSuccessDate
data: Database Edition Web
data: Database MaxSizeGB 1
data: Database MaxSizeBytes 1073741824
data: Database CollationName SQL_Latin1_General_CP1_CI_AS
data: Database CreationDate
data: Database RecoveryPeriodStartDate
data: Database IsSystemObject
data: Database Status 1
data: Database IsFederationRoot
data: Database SizeMB -1
data: Database IsRecursiveTriggersOn
data: Database IsReadOnly
data: Database IsFederationMember
data: Database IsQueryStoreOn
data: Database IsQueryStoreReadOnly
data: Database QueryStoreMaxSizeMB
data: Database QueryStoreFlushPeriodSeconds
data: Database QueryStoreIntervalLengthMinutes
data: Database QueryStoreClearAll
data: Database QueryStoreStaleQueryThresholdDays
info: sql db show command OK
sql db list [options] <serverName> <administratorPassword>
List the databases.
~$ azure sql db list fr8aelne00 test
info: Executing command sql db list
Administrator password: ********
+ Getting SQL server databases
data: Name Edition Collation MaxSizeInGB
data: ------ ------- ---------------------------- -----------
data: master Web SQL_Latin1_General_CP1_CI_AS 5
info: sql db list command OK
sql db delete [options] <serverName> <databaseName> <administratorPassword>
Deletes a database.
~$ azure sql db delete fr8aelne00 newdb test
info: Executing command sql db delete
Administrator password: ********
Delete database newdb? [y/n] y
+ Getting SQL server databases
+ Removing database
info: sql db delete command OK
Additional Resources
The following URL contains a number of example of using CLI to create manage and distribute your cloud services
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-command-line-tools/
Comments
- Anonymous
September 06, 2016
Thanks Lee! Very useful resource!