krypted.com

Tiny Deathstars of Foulness

Previously we looked at using wildcards in conjunction with the SQL LIKE operator. Wildcards allow you to search for data in a defined table. Think of them as text globbing for SQL. The wildcards available include the following:

  1. [list]: Define a ranges of characters for pattern matching
  2. [!charlist]: Matches only a character NOT specified within the brackets
  3. %: Require a single character/object in a pattern
  4. _: Allow any single character in a pattern

In this article, we’ll use the same “Customers” table from our first articles:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55410 US

The following SQL statement selects all customers with a City starting with “Minne”:

SELECT * FROM Customers
WHERE City LIKE 'Minne%';

The above SELECT would not locate an object that was just called Minne because the % indicates that something must be there. We could also look for something with nn but with something before and after the pattern:

SELECT * FROM Customers
WHERE City LIKE '%nn%';

Or to look for something that would contain Minneapoli:

SELECT * FROM Customers
WHERE City LIKE 'Minneapoli_';

Not that the _ is looking for a single character and that the % is looking for any string in that space. We could also look for a set of objects or omit a set of objects using brackets to define multiple items or a range. For example, let’s say we wanted to look for zip codes 55418 and 55410

SELECT * FROM Customers
WHERE Zip LIKE '[55418 55410]%';

Or 55410 through 55419, use a dash to separate the two (in ascending order):

SELECT * FROM Customers
WHERE Zip LIKE '[55410-55418]%';

Or the ones that don’t match that pattern:

SELECT * FROM Customers
WHERE Zip LIKE '[!55410-55418]%';

Overall, the globbing/pattern matching options are very basic (think DOS-like syntax) unless you use more complicated functions. But, it’s amazing what kind of stuff you can string together with simple commands, joins, and other tricks, without having to get into functions.

February 8th, 2016

Posted In: SQL

Tags: , , , , , , , ,

Leave a Comment

Sometimes you have data in a MySQL database that you just don’t need. You can delete tables and records pretty easily. In fact, it’s almost too easy. And there’s no undo. So be careful. And backup. And then backup again. And then snapshot again, before tinkerating with anything in this article.

In this article we’ll look at using the SQL DELETE statement to delete rows in a table. To do so, we’ll follow this basic syntax, which includes a WHERE clause to narrow the scope of the DELETE by specifying which records will be removed:

DELETE FROM table
WHERE column=value;

In this article, we’ll use the same “Customers” table from our first articles:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

Let’s not run this next command, but note that you can omit the WHERE statement to remove all data from a database. To do so, you would simply delete all rows in a table without deleting the table itself. I do this a lot with test databases. It leaves the schema/table structure, attributes, and indexes will be intact:

When I’m doing this, I usually specify the wildcard (*):

DELETE * FROM table;

In the following, we’re going to go ahead and remove the Microsoft record. To do so, we’ll run the DELETE and specify the table to delete data from. Then, we’ll use the WHERE to specify that we want to remove the record where the Site is Microsoft AND the Contact is Satya Nadella:

DELETE FROM Customers
WHERE Site='Microsoft' AND Contact='Satya Nadella';

The “Customers” table then looks like this:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

February 6th, 2016

Posted In: Mac OS X, SQL

Tags: , , , , ,

Leave a Comment

Previously we looked at finding data in a SQL database and The UPDATE statement is used to update records in a table. You can also use the UPDATE statement to update existing records in a table. When using the SQL UPDATE statement, we’ll also use the WHERE clause, as we used previously to constrain output of a SELECT statement. The WHERE locates the record(s) to be updated with syntax as follows:

UPDATE table
SET column=value,column=value,...
WHERE column=value;

The WHERE clause indicates the record(s) to update. I’ve forgotten to put it in in the past and updated every record of a database. That’s bad (unless you mean to do it). So let’s run a SELECT on our sample database from earlier, so we can see the “Customers” table from our first article:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

Now, let’s update the Address of the Apple record. To update the Address “spaceship” with the contents of “1 Infinite Loop” we’ll UPDATE the Customers table and SET the Address to equal

UPDATE Customers
SET Address='1 Infinite Loop'
WHERE Site='Apple';

The selection from the “Customers” table will now look like this:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook 1 Infinite Loop Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

You can also update multiple records by separating each item with a comma. For example, let’s say we wanted to update the Microsoft record to get the address correct:

UPDATE Customers
SET Address='One Microsoft Way',Zip="98052-7329"
WHERE Site='Microsoft';

Note that in the above example, I quoted Zip as I didn’t use an actual integer.

The selection from the “Customers” table will now look like this:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook 1 Infinite Loop Cupertino 95014 US
3 Microsoft Satya Nadella One Microsoft Way Redmond 98052-7329 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

February 4th, 2016

Posted In: SQL

Tags: , , , , ,

Leave a Comment

Sometimes you need to write a record into a table in a SQL database. The INSERT INTO statement creates new records in a table and can work in one of two ways. The first form does not specify the column names where the data will be inserted, only their values. When doing so, each value needs to be inserted in the columned order they appear, here the table being the name of the table you’re adding a record into and each value would be replaced with the contents of your value (don’t insert the string ‘value’ into each!):

INSERT INTO table
VALUES (value,value,value,...);

If you don’t have every value to insert, you can also list the columns to insert data in and then include the values in the same order that the columns are listed in. The second form specifies both the column names and the values to insert:

INSERT INTO table (column,column,column,...)
VALUES (value,value,value,...);

Below is a selection from the “Customers” table that I put in the first article. We will use it to run some SQL statements using the INSERT keyword so that we can add data to our little database:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

To insert a new row in the “Customers” table, we’ll add a row for Huffington Post with Arianna Huffington as the owner, her address as “The Library, with a city of Los Angeles, a zip of 90077, and a country of the US.

INSERT INTO Customers (Site, Contact, Address, City, Zip, Country)
VALUES ('Huffington Post','Arianna Huffington','The Library','Los Angeles','90077','US');

The selection from the “Customers” table will now look like this, after the ID record incremented on its own, taking the next available integer:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US
6 Huffington Post Arianna Huffington The Library Los Angeles 90077 US

As mentioned, you can also Insert Data Only in Specified Columns
It is also possible to only insert data in specific columns.

The following SQL statement will insert a new row, but only insert data in the Site, Contact, and Country columns:

INSERT INTO Customers (Site, Contact, Country)
VALUES ('Spotify', 'Daniel Elk', 'SE');

The selection from the “Customers” table will now look like this:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US
6 Huffington Post Arianna Huffington The Library Los Angeles 90077 US
7 Spotify Daniel Elk SE

Overall, adding rows to SQL tables is really straight forward. I mean, you’re not replacing anything… Yet…

February 3rd, 2016

Posted In: SQL

Tags: , , , , , , , ,

Leave a Comment

Previously, we looked at the SQL SELECT and WHERE options to obtain output and then constrain what would be displayed in a query. The AND & OR operators are used to add additional logic so you can filter records based on more than one condition. Which is to say to search based on the contents of multiple columns within a single table. AND is used to show information if two different conditions are true and OR is used to show information if either condition is true.

Below is a selection from the “Customers” table that showed in our first article an we will use it to run some SQL sorting statements using the ORDER BY keyword:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

The following example SQL statement outputs customers from the country “US” AND the city “55418”, in the “Customers” table from above:

SELECT * FROM Customers
WHERE Country='US'
AND Zip='55418';

The following SQL statement selects all customers from the city “Minneapolis” OR the city “Cupertino”, in the “Customers” table:

SELECT * FROM Customers
WHERE City='Cupertino'
OR City='Minneapolis';

As the logic of your searches expands, you can combine AND and OR by nesting logic within parenthesis (who said pre-algebra would be useless?!?!). For example, the following SQL statement selects all customers from the country “US” AND the city must be equal to “Minneapolis” OR “Cupertino”, in the “Customers” table:

SELECT * FROM Customers
WHERE Country='US'
AND (City='Minneapolis' OR City='Cupertino');

February 2nd, 2016

Posted In: SQL

Tags: , , , , , , , ,

Leave a Comment

Previously, we covered the SQL SELECT Statement, to pull data from a SQL database. Here, we’ll constrain our search for items that match a given string, or pattern using the WHERE clause to filter search results, rather than getting all of the records and parsing the output.

The WHERE clause extracts records that fulfill a specified string and follows the general syntax as follows, replacing the word column with the name of the column in one of your tables and the word table with the name of a table that you’d like to search within:

SQL WHERE Syntax
SELECT column,column
FROM table
WHERE column operator value;

Below is a selection from the “Customers” table that showed in our first article an we will use it to run some SQL sorting statements using the ORDER BY keyword:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

The following SQL statement selects all the customers with the zip code (Zip column) matching “55418”, in the “Customers” table:

SELECT * FROM Customers
WHERE Zip=55418;

In the above search, I didn’t have to quote what I was looking for. The reason is that an integer doesn’t require quoting; however, if we were searching for a name, or any other text record, we should use quotes. So to repeat the search for Site, looking for Krypted, we would use the following:

SELECT * FROM Customers
WHERE Site=Krypted;

We used an = operator, but it’s worth noting that there are a number of others that can be super-helpful. The following operators are available when using a WHERE clause:

    • = Equal
    • <>  or != Not equal to
    • > Greater than
    • IN Indicates multiple potential values for a column
    • < Less than
    • >= Greater than or equal
    • <= Less than or equal
    • BETWEEN Between an inclusive range
    • LIKE Looks for a provided pattern

So using another operator from above, we can also search for all sites that do not contain Krypted, using the following:

SELECT * FROM Customers
WHERE Site!=Krypted;

So far, we’ve looked at searching for exact matches. We can also fuzzy our logic up by looking for items that contain a pattern AND something else, using the LIKE operator in a WHERE clause to search for items that contain part of a pattern in a search. The syntax for a SQL LIKE is similar, it begins with the SELECT statement that we’ve used throughout these articles so far, and then continues with the WHERE and then a LIKE to define the pattern, as follows, replacing column with the name of one of your columns, table with the name of the table that column is in and pattern with the actual search you’re looking to run:

SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern;

The following SQL statement selects all customers with a City starting with the letter “M” with the % inside a single quote to show where the wildcard data is (in this case, anything that appears after the letter M in a city name):

SELECT * FROM Customers
WHERE City LIKE 'M%';

The following SQL statement selects all customers with a City containing the pattern “Park (e.g. “Menlo Park”):

SELECT * FROM Customers
WHERE Country LIKE '%Park%';

You can also add NOT in front of Like to search for records that do not match a pattern (note that you don’t have all the same operators available, so this helps to get a little more logic in searches when needed).

The following SQL statement selects all customers with Country NOT containing the pattern “US” (of which there are none in our sample data set):

SELECT * FROM Customers
WHERE Country NOT LIKE '%US%';

Or if we weren’t sure that we wanted to work in a spaceship, we could search for all addresses that weren’t spaceship:

SELECT * FROM Customers
WHERE Address NOT LIKE '%spaceship%';

Overall, the SELECT statement has some pretty basic logic and operations, because searching for data within a given table is a pretty straight forward task, you have a pattern, you look for items that match that pattern. As these articles continue, we’ll get into slightly more complex operations, but much of the work that we do with SQL is done after a query with another tool in order to get our data to display or be manipulated in ways that SQL doesn’t do on its own. One of the beauties of SQL, and why it can be so fast, is that it’s simple.

February 1st, 2016

Posted In: SQL

Tags: , , , , , , , , , ,

Leave a Comment

The ORDER BY keyword in a SQL SELECT statement is used to sort a given result-set based on the contents of one or more columns of data. By default, results are in ascending order, but you can use either ASC or DESC to indicate that you’d like results sorted in ascending or descending order, respectively.

Below is a selection from the “Customers” table that we will use to run some SQL sorting statements using the ORDER BY keyword:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

The syntax we’ll use for these commands is:

SELECT column_name, column_name
FROM table
ORDER BY column ASC|DESC, column ASC|DESC;

Here is a basic SQL statement that selects all of the customers from the “Customers” table and sorts the results in ascending order (as it’s the default operation) based on the contents of the “Country” column:

SELECT * FROM Customers
ORDER BY Country;

Now we’ll flip that into descending order:

SELECT * FROM Customers
ORDER BY Country DESC;

Then ascending based on first the country, then the Site:

SELECT * FROM Customers
ORDER BY Country, Site;

Finally, you can do ascending for the country and descending for the site:

SELECT * FROM Customers
ORDER BY Country ASC, Site DESC;

January 31st, 2016

Posted In: SQL

Tags: , , , , , , ,

Leave a Comment

Most tasks you will execute against a database are done with SQL statements. Think of statements as a query, an insert, a change, or a delete operating. For example, to see all of your data, you would select all of the records from a database using the SELECT statement. Then we’ll ask for all, or *, and tell the command to show us where the data is coming from, which is the Customers table. Finally, we’ll be nice and tidy and put a semi-colon at the end; although if you forget, you can always do so after you hit return:

SELECT * FROM Customers;

As can be seen above, the SELECT statement is used to select data from a database. Results are stored in a result table that is simply called the result-set. The syntax to run a select is to run SELECT followed by a list of columns separated by commas and then a FROM statement to indicate which table of a database you’ll query followed by the name of the table and then a semi-colon (;).

SELECT column name,column name
FROM table name;

The initial SELECT that we ran used an * instead of any column names. This worked because the * is a wild card that pulls all data. As indicated in the above syntax though, we can constrain our output to only the columns we care about. Below is the “Customers” table from our first article:

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

This SQL statement selects the “ID” and “Site” columns from the “Customers” table:

SELECT ID,Site FROM Customers;

The result would be as follows:

ID Site
1 Krypted
2 Apple
3 Microsoft
4 Facebook
5 JAMF

In a table, each column can contain duplicate values (for example, multiple parties could be in the same city or multiple items for sale can have the same price. The DISTINCT keyword can be used to return only unique values, similar to the uniq command in bash. The syntax for the DISTINCT statement is as follows:

SELECT DISTINCT column,column
FROM table;

The following SQL statement selects only the distinct values from the “City” columns from the “Customers” table in our example database:

SELECT DISTINCT City FROM Customers;

You can also search for data
The WHERE clause is used to extract only those records that fulfill a specified criterion.

SQL WHERE Syntax
SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;

SELECT * FROM Customers
WHERE Country=’US’;

As you can see in the above, we used single quotes around text. We could have also used double-quotes. You do not need to quote numbers, as seen below:

SELECT * FROM Customers
WHERE ID=1;

We used an = operator, but it’s worth noting that there are a number of others that can be super-helpful. The following operators are available when using a WHERE clause:

  • = Equal
  • <>  or != Not equal to
  • > Greater than
  • IN Indicates multiple potential values for a column
  • < Less than
  • >= Greater than or equal
  • <= Less than or equal
  • BETWEEN Between an inclusive range
  • LIKE Looks for a provided pattern

January 30th, 2016

Posted In: SQL

Tags: , , , , ,

Leave a Comment

Databases and Tables

A SQL database is an organized collection of data. Or at least that’s what they taught me in college. In real life, it’s only as organized as the people putting data into the database. Databases contain schemas, tables, stored procedures, reports, views and other objects. Most databases will contain multiple tables. Tables contain rows that have data in them. I like to think of a database kinda’ like an Excel spreadsheet. Each tab on a spreadsheet is similar to a table; each row is similar to a row in a database and each column in the spreadsheet is somewhat similar to a column, or attribute. The headers are kinda’ like the schema.

These are overly simplistic explanations. And whenever you oversimplify something, you run the risk of miscommunication, but it helps as a starting place. This page is meant to be a short and easy guide to get started writing SQL queries. More links will appear throughout the page that point to other posts on my site, so stay tuned. Throughout my exercises in this page, I will use the following sample database, which has five records (one for each ID) and seven columns (ID,Site,Contact,Address,City,Zip, and Country).

Below is a selection from the “Customers” table (note that when querying data, SQL commands are NOT case sensitive)

ID Site Contact Address City Zip Country
1 Krypted Charles Edge my house Minneapolis 55418 US
2 Apple Tim Cook spaceship Cupertino 95014 US
3 Microsoft Satya Nadella campus Redmond 98053 US
4 Facebook Mark Zuckerberg foodhall Menlo Park 94025 US
5 JAMF Dean Hager Grain Exchange Minneapolis 55418 US

SQL Statements

Most tasks you will execute against a database are done with SQL statements. Think of this as a query, an insert, a change, or a delete operating. For example, to see all of your data, you would select all of the records from a database using the SELECT statement. Then we’ll ask for all, or *, and tell the command to show us where the data is coming from, which is the Customers table. Finally, we’ll be nice and tidy and put a semi-colon at the end; although if you forget, you can always do so after you hit return:

SELECT * FROM Customers;

The SELECT statement is the most common command I run in SQL. This is how you query data, build reports, derive the layout of a database and so, so much more.

Other Important SQL Commands covered in this series (if there is no link, I haven’t written that article yet):

  • SELECT – Query and pull information from a database
  • CREATE TABLE – Create tables in specified databases
  • DELETE – Delete data
  • UPDATE – Update data in a database
  • DROP TABLE – Delete tables
  • INSERT INTO – Inserts new data into a specified database
  • CREATE DATABASE – Create databases
  • ALTER DATABASE – Modify databases
  • ALTER TABLE – Modify tables
  • CREATE INDEX – Create indexes
  • DROP INDEX – Deletes indexes
  • INNER JOIN – Merge rows in a database

January 26th, 2016

Posted In: SQL

Tags: , , , , , , , , ,

Leave a Comment

Microsoft Azure is Microsoft’s cloud services. Azure can host virtual machines and act as a location to store files. However, Azure can do much more as well, providing an Active Directory instance, provide SQL database access, work with hosted Visual Studio, host web sites or provide BizTalk services. All of these can be managed at https://manage.windowsazure.com.

windows_azure_logo6

You can also manage Windows Azure from the command line on Linux, Windows or Mac. To download command line tools, visit http://www.windowsazure.com/en-us/downloads/#cmd-line-tools. Once downloaded, run the package installer.

Screen Shot 2013-11-29 at 10.51.01 PMWhen the package is finished installing, visit /usr/local/bin where you’ll find the azure binary. Once installed, you’ll need to configure your account from the windowsazure.com site to work with your computer. To do so, log into the windowsazure.com portal.

Screen Shot 2013-12-01 at 8.25.57 PM

Once logged in, open Terminal and then use the azure command along with the account option and the download verb:

azure account download

This account downloads the .publishsettings file for the account you’re logged in as in your browser. Once downloaded, run azure with the account option and the import verb, dragging the path to your .publishsettings file from https://manage.windowsazure.com/publishsettings/index?client=xplat:

azure account import /Users/krypted/Downloads/WindowsAzure-credentials.publishsettings

The account import then completes and your user is imported into azure. Once imported, run azure with the account option and then storage list:

azure account storage list

You might not have any storage configured yet, but at this point you should see the following to indicate that the account is working:

info: No storage accounts defined
info: account storage list command OK

You can also run the azure command by itself to see some neat ascii-art (although the azure logo doesn’t really come through in this spiffy cut and paste job):

info: _ _____ _ ___ ___________________
info:        /_\  |__ / | | | _ \ __|
info: _ ___ / _ \__/ /| |_| |   / _|___ _ _
info: (___ /_/ \_\/___|\___/|_|_\___| _____)
info: (_______ _ _) _ ______ _)_ _
info: (______________ _ ) (___ _ _)
info:
info: Windows Azure: Microsoft's Cloud Platform
info:
info: Tool version 0.7.4
help:
help: Display help for a given command
help: help [options] [command]
help:
help: Open the portal in a browser
help: portal [options]
help:
help: Commands:
help: account to manage your account information and publish settings
help: config Commands to manage your local settings
help: hdinsight Commands to manage your HDInsight accounts
help: mobile Commands to manage your Mobile Services
help: network Commands to manage your Networks
help: sb Commands to manage your Service Bus configuration
help: service Commands to manage your Cloud Services
help: site Commands to manage your Web Sites
help: sql Commands to manage your SQL Server accounts
help: storage Commands to manage your Storage objects
help: vm Commands to manage your Virtual Machines
help:
help: Options:
help: -h, --help output usage information
help: -v, --version output the application version

Provided the account is working, you can then use the account, config, hdinsight, mobile, network, sb, service, site, sql, storage or vm options. Each of these can be invoked along with a -h option to show a help page. For example, to see a help page for service:

azure service -h

You can spin up resources including sites, storage containers and even virtual machines (although you might need to create templates for VMs first). As an example, let’s create a new site using the git template:

azure site create --git

Overall, there are a lot of options available in the azure command line interface. The web interface is very simple, with options in the command line interface mirroring the options in the web interface. Running and therefore scripting around these commands is straight forward. I wrote up some Amazon stuff previously at http://krypted.com/commands/amazon-s3cmd-commands, but the azure controls are really full featured and I’m really becoming a huge fan of the service itself the more I use it (which likely means I’ll post more articles on it soon).

December 2nd, 2013

Posted In: cloud, Network Infrastructure, SQL, Ubuntu, Unix, VMware, Windows Server

Tags: , , , , , , , , , , ,

Next Page »