Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 370a94a

Browse files
committedJun 15, 2016
Work in Progress - rolling system back
1 parent ee096fa commit 370a94a

File tree

10 files changed

+147
-55
lines changed

10 files changed

+147
-55
lines changed
 

‎articles/cdn/cdn-app-dev-net.md

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -24,61 +24,7 @@ You will need Visual Studio 2015 to complete this tutorial. [Visual Studio Comm
2424

2525
A completed example of this tutorial can be found [here](https://code.msdn.microsoft.com/Azure-CDN-Management-1f2fba2c).
2626

27-
## Preparation
28-
29-
Before we can write CDN management code, we need to do some preparation. The first thing we're going to do is create a resource group to contain the CDN profile we create in this tutorial. We will then setup Azure Active Directory to provide authentication for our application. After that's done, we'll apply permissions to the resource group so that only authorized users from our Azure AD tenant can interact with our CDN profile.
30-
31-
### Creating the resource group
32-
33-
1. Log into the [Azure Portal](https://portal.azure.com).
34-
35-
2. Click the **New** button in the upper left, and then **Management**, and **Resource Group**.
36-
37-
![Creating a new resource group](./media/cdn-app-dev-net/cdn-new-rg-1.png)
38-
39-
3. Call your resource group *CdnConsoleTutorial*. Select your subscription and choose a location near you. If you wish, you may click the **Pin to dashboard** checkbox to pin the resource group to the dashboard in the portal. This will make it easier to find later. After you've made your selections, click **Create**.
40-
41-
![Naming the resource group](./media/cdn-app-dev-net/cdn-new-rg-2.png)
42-
43-
4. After the resource group is created, if you didn't pin it to your dashboard, you can find it by clicking **Browse**, then **Resource Groups**. Click the resource group to open it. Make a note of your **Subscription ID**. We'll need it later.
44-
45-
![Naming the resource group](./media/cdn-app-dev-net/cdn-subscription-id.png)
46-
47-
### Creating the Azure AD application
48-
49-
There are two approaches to app authentication with Azure Active Directory: Individual users or a service principal. A service principal is similar to a service account in Windows. Instead of granting a particular user permissions to interact with the CDN profiles, we instead grant the permissions to the service principal. Service principals are generally used for automated, non-interactive processes. Even though this tutorial is writing an interactive console app, we'll focus on the service principal approach.
50-
51-
Creating a service principal consists of several steps, including creating an Azure Active Directory application. To do this, we're going to [follow this tutorial](../resource-group-create-service-principal-portal.md).
52-
53-
> [AZURE.IMPORTANT] Be sure to follow all the steps in the [linked tutorial](../resource-group-create-service-principal-portal.md). It is *extremely important* that you complete it exactly as described. Make sure to note your **tenant ID**, **tenant domain name** (commonly a *.onmicrosoft.com* domain unless you've specified a custom domain), **client ID**, and **client authentication key**, as we will need these later. Be very careful to guard your **client ID** and **client authentication key**, as these credentials can be used by anyone to execute operations as the service principal.
54-
>
55-
> When you get to the step named [Configure multi-tenant application](../resource-group-create-service-principal-portal.md#configure-multi-tenant-application), select **No**.
56-
>
57-
> When you get to the step [Assign application to role](../resource-group-create-service-principal-portal.md#assign-application-to-role), use the resource group we created earlier, *CdnConsoleTutorial*, but instead of the **Reader** role, assign the **CDN Profile Contributor** role. After you assign the application the **CDN Profile Contributor** role on your resource group, return to this tutorial.
58-
59-
Once you've created your service principal and assigned the **CDN Profile Contributor** role, the **Users** blade for your resource group should look similar to this.
60-
61-
![Users blade](./media/cdn-app-dev-net/cdn-service-principal.png)
62-
63-
64-
### Interactive user authentication
65-
66-
If, instead of a service principal, you'd rather have interactive individual user authentication, the process is very similar to that for a service principal. In fact, you will need to follow the same procedure, but make a few minor changes.
67-
68-
>[AZURE.IMPORTANT] Only follow these next steps if you are choosing to use individual user authentication instead of a service principal.
69-
70-
1. When creating your application, instead of **Web App**, choose **Native application**.
71-
72-
![Native application](./media/cdn-app-dev-net/cdn-native-application.png)
73-
74-
2. On the next page, you will be prompted for a **redirect URI**. The URI won't be validated, but remember what you entered. You'll need it later.
75-
76-
3. There is no need to create a **client authentication key**.
77-
78-
4. Instead of assigning a service principal to the **CDN Profile Contributor** role, we're going to assign individual users or groups. In this example, you can see that I've assigned *CDN Demo User* to the **CDN Profile Contributor** role.
79-
80-
![Individual user access](./media/cdn-app-dev-net/cdn-aad-user.png)
81-
27+
[AZURE.INCLUDE [cdn-app-dev-prep](../../includes/cdn-app-dev-prep.md)]
8228

8329
## Create your project and add Nuget packages
8430

‎articles/cdn/cdn-app-dev-node.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<properties
2+
pageTitle="Get started with the Azure CDN SDK for Node.js | Microsoft Azure"
3+
description="Learn how to write Node.js applications to manage Azure CDN."
4+
services="cdn"
5+
documentationCenter=".net"
6+
authors="camsoper"
7+
manager="erikre"
8+
editor=""/>
9+
10+
<tags
11+
ms.service="cdn"
12+
ms.workload="tbd"
13+
ms.tgt_pltfrm="na"
14+
ms.devlang="na"
15+
ms.topic="article"
16+
ms.date="06/16/2016"
17+
ms.author="casoper"/>
18+
19+
# Get started with the Azure CDN SDK for Node.js
20+
21+
You can use the [Azure CDN SDK for Node.js](https://www.npmjs.com/package/azure-arm-cdn) to automate creation and management of CDN profiles and endpoints. This tutorial will walk through the creation of a simple Node.js console application that demonstrates several of the available operations. This tutorial is not intended to describe all aspects of the Azure CDN SDK for Node.js in detail.
22+
23+
To complete this tutorial, you should already have [Node.js](http://www.nodejs.org) **4.x.x** or higher installed and configured. You can use any text editor you want to create your Node.js application. To write this tutorial, I used [Visual Studio Code](https://code.visualstudio.com).
24+
25+
A completed example of this tutorial can be found [here]().
26+
27+
[AZURE.INCLUDE [cdn-app-dev-prep](../../includes/cdn-app-dev-prep.md)]
28+
29+
## Create your project and add NPM dependencies
30+
31+
Now that we've created a resource group for our CDN profiles and given our Azure AD application permission to manage CDN profiles and endpoints within that group, we can start creating our application.
32+
33+
Create a folder to store your application. From a console with the Node.js tools in your current path, set your current location to this new folder and initialize your project by executing:
34+
```
35+
npm init
36+
```
37+
You will then be presented a series of questions to initialize your project. For **entry point**, this tutorial will use *app.js*. You can see my other choices in the example below.
38+
39+
![NPM init output](./media/cdn-app-dev-node/cdn-npm-init.png)
40+
41+
Our project is now initialized with a *packages.json* file. Our project is going to use some Azure libraries contained in NPM packages. Let's add those to the project as dependencies.
42+
```
43+
npm install --save ms-rest-azure
44+
npm install --save azure-arm-cdn
45+
```
46+
47+
Assuming the packages installed with no errors, if we view the *package.json* file, it should look similar to this (version numbers may differ):
48+
49+
```
50+
{
51+
"name": "cdn_node",
52+
"version": "1.0.0",
53+
"description": "Azure CDN Node.js tutorial project",
54+
"main": "app.js",
55+
"scripts": {
56+
"test": "echo \"Error: no test specified\" && exit 1"
57+
},
58+
"author": "Cam Soper",
59+
"license": "MIT",
60+
"dependencies": {
61+
"azure-arm-cdn": "^0.2.1",
62+
"ms-rest-azure": "^1.14.4"
63+
}
64+
}
65+
```
66+
67+
Finally, using your text editor, create a blank text file and save it in the root of our project folder as *app.js*. We're now ready to begin writing code.
68+
69+
##
70+
71+
## Running the program
72+
73+
We can now compile and run the program by clicking the **Start** button in Visual Studio.
74+
75+
![Program running](./media/cdn-app-dev-net/cdn-program-running-1.png)
76+
77+
When the program reaches the above prompt, you should be able to return to your resource group in the Azure Portal and see that the profile has been created.
78+
79+
![Success!](./media/cdn-app-dev-net/cdn-success.png)
80+
81+
We can then confirm the prompts to run the rest of the program.
82+
83+
![Program completing](./media/cdn-app-dev-net/cdn-program-running-2.png)
84+
85+
## Next Steps
86+
87+
To see the completed project from this walkthrough, [download the sample](https://code.msdn.microsoft.com/Azure-CDN-Management-1f2fba2c).
88+
89+
To find additional documentation on the Azure CDN Management Library for .NET, view the [reference on MSDN](https://msdn.microsoft.com/library/mt657769.aspx).
90+
91+
Loading

‎includes/cdn-app-dev-prep.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
## Preparation
2+
3+
Before we can write CDN management code, we need to do some preparation. The first thing we're going to do is create a resource group to contain the CDN profile we create in this tutorial. We will then setup Azure Active Directory to provide authentication for our application. After that's done, we'll apply permissions to the resource group so that only authorized users from our Azure AD tenant can interact with our CDN profile.
4+
5+
### Creating the resource group
6+
7+
1. Log into the [Azure Portal](https://portal.azure.com).
8+
9+
2. Click the **New** button in the upper left, and then **Management**, and **Resource Group**.
10+
11+
![Creating a new resource group](./media/cdn-app-dev-prep/cdn-new-rg-1.png)
12+
13+
3. Call your resource group *CdnConsoleTutorial*. Select your subscription and choose a location near you. If you wish, you may click the **Pin to dashboard** checkbox to pin the resource group to the dashboard in the portal. This will make it easier to find later. After you've made your selections, click **Create**.
14+
15+
![Naming the resource group](./media/cdn-app-dev-prep/cdn-new-rg-2.png)
16+
17+
4. After the resource group is created, if you didn't pin it to your dashboard, you can find it by clicking **Browse**, then **Resource Groups**. Click the resource group to open it. Make a note of your **Subscription ID**. We'll need it later.
18+
19+
![Naming the resource group](./media/cdn-app-dev-prep/cdn-subscription-id.png)
20+
21+
### Creating the Azure AD application
22+
23+
There are two approaches to app authentication with Azure Active Directory: Individual users or a service principal. A service principal is similar to a service account in Windows. Instead of granting a particular user permissions to interact with the CDN profiles, we instead grant the permissions to the service principal. Service principals are generally used for automated, non-interactive processes. Even though this tutorial is writing an interactive console app, we'll focus on the service principal approach.
24+
25+
Creating a service principal consists of several steps, including creating an Azure Active Directory application. To do this, we're going to [follow this tutorial](../resource-group-create-service-principal-portal.md).
26+
27+
> [AZURE.IMPORTANT] Be sure to follow all the steps in the [linked tutorial](../resource-group-create-service-principal-portal.md). It is *extremely important* that you complete it exactly as described. Make sure to note your **tenant ID**, **tenant domain name** (commonly a *.onmicrosoft.com* domain unless you've specified a custom domain), **client ID**, and **client authentication key**, as we will need these later. Be very careful to guard your **client ID** and **client authentication key**, as these credentials can be used by anyone to execute operations as the service principal.
28+
>
29+
> When you get to the step named [Configure multi-tenant application](../resource-group-create-service-principal-portal.md#configure-multi-tenant-application), select **No**.
30+
>
31+
> When you get to the step [Assign application to role](../resource-group-create-service-principal-portal.md#assign-application-to-role), use the resource group we created earlier, *CdnConsoleTutorial*, but instead of the **Reader** role, assign the **CDN Profile Contributor** role. After you assign the application the **CDN Profile Contributor** role on your resource group, return to this tutorial.
32+
33+
Once you've created your service principal and assigned the **CDN Profile Contributor** role, the **Users** blade for your resource group should look similar to this.
34+
35+
![Users blade](./media/cdn-app-dev-prep/cdn-service-principal.png)
36+
37+
38+
### Interactive user authentication
39+
40+
If, instead of a service principal, you'd rather have interactive individual user authentication, the process is very similar to that for a service principal. In fact, you will need to follow the same procedure, but make a few minor changes.
41+
42+
>[AZURE.IMPORTANT] Only follow these next steps if you are choosing to use individual user authentication instead of a service principal.
43+
44+
1. When creating your application, instead of **Web App**, choose **Native application**.
45+
46+
![Native application](./media/cdn-app-dev-prep/cdn-native-application.png)
47+
48+
2. On the next page, you will be prompted for a **redirect URI**. The URI won't be validated, but remember what you entered. You'll need it later.
49+
50+
3. There is no need to create a **client authentication key**.
51+
52+
4. Instead of assigning a service principal to the **CDN Profile Contributor** role, we're going to assign individual users or groups. In this example, you can see that I've assigned *CDN Demo User* to the **CDN Profile Contributor** role.
53+
54+
![Individual user access](./media/cdn-app-dev-prep/cdn-aad-user.png)
55+

0 commit comments

Comments
 (0)
Please sign in to comment.