Skip to content

Commit 1da55ac

Browse files
authored
Merge pull request #8163 from NuGet/dev
Merge branch dev into master Related to NuGet/Engineering#3328
2 parents b3c174e + e92834a commit 1da55ac

52 files changed

Lines changed: 4002 additions & 2747 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NuGetGallery.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHubVulnerabilities2Db",
5050
EndProject
5151
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHubVulnerabilities2Db.Facts", "tests\GitHubVulnerabilities2Db.Facts\GitHubVulnerabilities2Db.Facts.csproj", "{E50953CB-209A-484E-951D-A68F5CF3C546}"
5252
EndProject
53+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VerifyGitHubVulnerabilities", "src\VerifyGitHubVulnerabilities\VerifyGitHubVulnerabilities.csproj", "{C0B764D2-D376-439E-A5C4-1AC41B11E9DE}"
54+
EndProject
5355
Global
5456
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5557
Debug|Any CPU = Debug|Any CPU
@@ -124,6 +126,10 @@ Global
124126
{E50953CB-209A-484E-951D-A68F5CF3C546}.Debug|Any CPU.Build.0 = Debug|Any CPU
125127
{E50953CB-209A-484E-951D-A68F5CF3C546}.Release|Any CPU.ActiveCfg = Release|Any CPU
126128
{E50953CB-209A-484E-951D-A68F5CF3C546}.Release|Any CPU.Build.0 = Release|Any CPU
129+
{C0B764D2-D376-439E-A5C4-1AC41B11E9DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
130+
{C0B764D2-D376-439E-A5C4-1AC41B11E9DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
131+
{C0B764D2-D376-439E-A5C4-1AC41B11E9DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
132+
{C0B764D2-D376-439E-A5C4-1AC41B11E9DE}.Release|Any CPU.Build.0 = Release|Any CPU
127133
EndGlobalSection
128134
GlobalSection(SolutionProperties) = preSolution
129135
HideSolutionNode = FALSE
@@ -146,6 +152,7 @@ Global
146152
{98765110-844D-41BE-8083-22E064136E05} = {39E54EC3-CBAA-453A-BE64-748FE1559A58}
147153
{26BB718A-E1C1-4E70-9008-FB8EE7A7F7E5} = {2204C510-A559-4ED7-9590-FDC09093575B}
148154
{E50953CB-209A-484E-951D-A68F5CF3C546} = {39E54EC3-CBAA-453A-BE64-748FE1559A58}
155+
{C0B764D2-D376-439E-A5C4-1AC41B11E9DE} = {2204C510-A559-4ED7-9590-FDC09093575B}
149156
EndGlobalSection
150157
GlobalSection(ExtensibilityGlobals) = postSolution
151158
SolutionGuid = {064A3BDE-5203-4AD6-A6C9-5CF08301EC8F}

build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Invoke-BuildStep 'Creating artifacts' { `
116116
New-Package (Join-Path $PSScriptRoot "src\AccountDeleter\Gallery.AccountDeleter.nuspec") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch -MSBuildVersion "15"
117117
New-Package (Join-Path $PSScriptRoot "src\GitHubVulnerabilities2Db\GitHubVulnerabilities2Db.nuspec") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch -MSBuildVersion "15"
118118
New-Package (Join-Path $PSScriptRoot "src\GalleryTools\Gallery.GalleryTools.nuspec") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch -MSBuildVersion "15"
119+
New-Package (Join-Path $PSScriptRoot "src\VerifyGitHubVulnerabilities\VerifyGitHubVulnerabilities.nuspec") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch -MSBuildVersion "15"
119120

120121
if (!$VerifyMicrosoftPackageVersion) { $VerifyMicrosoftPackageVersion = $SemanticVersion }
121122
New-Package (Join-Path $PSScriptRoot "src\VerifyMicrosoftPackage\VerifyMicrosoftPackage.nuspec") -Configuration $Configuration -BuildNumber $BuildNumber -Version $VerifyMicrosoftPackageVersion -Branch $Branch -MSBuildVersion "15"

docs/Deploying/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To run the NuGet Gallery in Azure you need to provision the following resources:
88

99
## Deploying to Azure
1010

11-
We suggest using Windows Azure for hosting the gallery, as that is the environment used by http://www.nuget.org itself. When doing so, we suggest using Azure SQL Databases for the database and Azure Storage Accounts to store package files.
11+
We suggest using Azure to host the gallery, as that is the environment used by https://www.nuget.org itself. When doing so, we suggest using Azure SQL Databases for the database and Azure Storage to store packages.
1212

1313
This guide will instruct you on hosting the Gallery to an Azure App Service. We will start with provisiong the supporting resources (Database, Storage, etc.).
1414

@@ -18,13 +18,22 @@ This guide will instruct you on hosting the Gallery to an Azure App Service. We
1818

1919
We recommend provisioning a dedicated Azure SQL Databases Server for the Gallery.
2020

21-
Follow the instrctions [here](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-get-started-portal) to create an Azure SQL DB.
21+
Follow the instructions [here](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-get-started-portal) to create an Azure SQL Database.
22+
23+
After you create your Azure SQL Database, update the server's firewall settings to allow access from other Azure resources:
24+
25+
1. Navigate to the "SQL Servers" blade.
26+
2. Select your SQL Server.
27+
3. Under the "Security" section, select "Firewall and and virtual networks".
28+
4. Make sure that "Allow Azure services and resources to access this server" is set to "Yes".
29+
2230
Copy the connection string from the portal. It should look something like:
31+
2332
```
2433
Server=[servername].database.windows.net;Database=NuGetGallery;User ID=[username];Password=[password];Trusted_Connection=False;Encrypt=True
2534
```
2635

27-
Now, it's time to update your new DB with the Gallery SQL schema.
36+
Now, let's update your new DB with the Gallery SQL schema.
2837

2938
1. Open the NuGetGallery solution in Visual Studio.
3039

@@ -44,18 +53,22 @@ Update-Database -ConfigurationTypeName MigrationsConfiguration
4453

4554
Follow the instruction [here](https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=portal) to create an Azure storage account.
4655
Copy the connection string from the portal. It should like something like:
56+
4757
```
4858
DefaultEndpointsProtocol=https;AccountName=[account name];AccountKey=[primary key];
4959
```
60+
5061
To configure Gallery to use your new storage account:
62+
5163
1. Open the [web.config](https://github.com/NuGet/NuGetGallery/blob/master/src/NuGetGallery/Web.config#L27)
5264
2. Set Gallery.StorageType to 'AzureStorage'
5365
3. Replace all settings starting with 'Gallery.AzureStorage.' with your connection string.
5466

5567
## Deploying the Frontend/Backend
5668

5769
You are almost done! Here are additional configurations in web.config:
70+
5871
1. Gallery.SiteRoot - set with the URL of your Gallery website. For example: _https://mygallery.azurewebsites.net_
59-
2. Gallery.SmtpUri (optional)- set SMTP credentials if you would like to receive e-mails from the service.
72+
1. Gallery.AppInsightsInstrumentationKey - set to the [Application Insights](https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview) instrumentation key to capture telemetry. Useful for debugging!
6073

61-
Now you are ready to publish the Gallery to your own Azure app service. To do this through Visual Studio follow the instructions [here](https://docs.microsoft.com/en-us/visualstudio/deployment/quickstart-deploy-to-azure).
74+
You are now ready to publish the Gallery to your own Azure App Service. To do this through Visual Studio follow the instructions [here](https://docs.microsoft.com/en-us/visualstudio/deployment/quickstart-deploy-to-azure).

docs/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Documentation
2-
Documentation for building, deploying, and managing a NuGet Gallery instance
2+
3+
You can find documentation for:
4+
5+
1. [Building, deploying, and managing a NuGet Gallery instance](Deploying/README.md)
6+
1. [Using Azure Active Directory authentication](Using-AAD.md)

docs/Using-AAD.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Using Azure Active Directory authentication
2+
3+
You can configure the NuGetGallery to use Azure Active Directory to manage your accounts.
4+
5+
## Create an Azure Active Directory application registration
6+
7+
1. On the portal, open the ["App registrations" blade](https://ms.portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade).
8+
1. Select "New registration".
9+
1. For "Supported account types", select "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)".
10+
11+
> **NOTE**: This allows any Azure Active Directory or personal account to create an account and publish packages to your on-prem gallery. If you'd like to authenticate with a specific directory (the "Single tenant" option), you will need to make a code change later.
12+
13+
1. For "Redirect URI", select "Web" with the value `https://<Your domain>/users/account/authenticate/return`.
14+
1. Press "Register" to create the application.
15+
16+
You will need to configure the Azure Active Directory application before it can be used by the NuGetGallery:
17+
18+
1. On the "Overview" pane, note down the "Application (client) ID".
19+
1. Navigate to the "Authentication" pane. Under the "Implicit grant" section, enable "ID tokens" and press "Save".
20+
1. Navigate to "Certificates & secrets" pane and create a new client secret. Note the value of your client secret.
21+
22+
## Configure the Gallery
23+
24+
Now that the Azure Active Directory application is ready, let's configure the NuGetGallery to use your new app:
25+
26+
1. Open the NuGetGallery solution using Visual Studio.
27+
1. Modify the "Web.config" file in the NuGetGallery project.
28+
1. Modify the `Auth.AzureActiveDirectoryV2.Enabled` setting to `true`.
29+
1. Modify the `Auth.AzureActiveDirectoryV2.ClientId` setting to the application ID you copied earlier.
30+
1. Modify the `Auth.AzureActiveDirectoryV2.ClientSecret` setting to the client secret you copied earlier.
31+
32+
If you selected the "Single tenant" option when you created your Azure Active Directory app registration, update [`AzureActiveDirectoryV2AuthenticatorConfiguration`](https://github.com/NuGet/NuGetGallery/blob/0659deed143f0b58868fa691ec22f46f1d57cba6/src/NuGetGallery.Services/Authentication/Providers/AzureActiveDirectoryV2/AzureActiveDirectoryV2AuthenticatorConfiguration.cs#L53) to set the authority tenant ID to your AAD Tenant ID:
33+
34+
```csharp
35+
openIdOptions.Authority = String.Format(CultureInfo.InvariantCulture, AzureActiveDirectoryV2Authenticator.Authority, "<Your AAD Tenant ID>");
36+
```

0 commit comments

Comments
 (0)