Skip to content

Commit

Permalink
Merge pull request #1 from Azure/master
Browse files Browse the repository at this point in the history
Merge from master
  • Loading branch information
MatanShabtay authored Apr 19, 2020
2 parents 014414e + ffb3545 commit 1fd9ebb
Show file tree
Hide file tree
Showing 3,723 changed files with 816,088 additions and 247,695 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
40 changes: 20 additions & 20 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,46 @@
###########

# Catch all
/sdk/ @AlexGhiondea
/sdk/ @AlexGhiondea

# Core
/sdk/core/ @pakrym @KrzysztofCwalina
/sdk/core/ @pakrym @KrzysztofCwalina

# Extensions
/sdk/extensions/ @parkym
/sdk/extensions/ @parkym

# Service teams
/sdk/appconfiguration/ @annelo-msft @AlexanderSher
/sdk/appconfiguration/ @annelo-msft @AlexanderSher

/sdk/batch/ @matthchr
/sdk/batch/ @matthchr

/sdk/cognitiveservices/language.textanalytics/ @assafi
/sdk/cognitiveservices/vision.computervision/ @toothache
/sdk/cognitiveservices/vision.face/ @TFR258
/sdk/cognitiveservices/language.textanalytics/ @assafi
/sdk/cognitiveservices/vision.computervision/ @toothache
/sdk/cognitiveservices/vision.face/ @TFR258

/sdk/eventgrid/ @kalyanaj
/sdk/eventgrid/ @Kishp01 @ahamad-MS

/sdk/eventhub/ @serkantkaraca @jsquire @kinelski
/sdk/eventhub/azure.messaging.eventhubs/ @jsquire @kinelski
/sdk/eventhub/ @serkantkaraca @jsquire @kinelski
/sdk/eventhub/azure.messaging.eventhubs/ @jsquire @kinelski

/sdk/identity/ @schaabs
/sdk/identity/ @schaabs

/sdk/keyvault/ @schaabs @heaths
/sdk/keyvault/ @schaabs @heaths

/sdk/search/ @brjohnstmsft @arv100kri @bleroy @tg-msft @heaths
/sdk/search/Microsoft.*/ @brjohnstmsft @arv100kri @bleroy
/sdk/search/ @brjohnstmsft @arv100kri @bleroy @tg-msft @heaths
/sdk/search/Microsoft.*/ @brjohnstmsft @arv100kri @bleroy

/sdk/servicebus/ @nemakam @jsquire
/sdk/servicebus/ @nemakam @JoshLove-msft @ShivangiReja @jsquire

/sdk/storage/ @seanmcc-msft @amnguye @tg-msft @JoshLove-msft
/sdk/storage/ @amishra-dev @seanmcc-msft @amnguye @kasobol-msft @tg-msft @JoshLove-msft

/sdk/textanalytics/ @annelo-msft @maririos
/sdk/textanalytics/ @annelo-msft @maririos

# Management Plane
/**/*Management*/ @isra-fel @erich-wang
/**/*Management*/ @isra-fel @erich-wang

# Reviewers to double check any API changes
/sdk/**/api/ @KrzysztofCwalina @pakrym @tg-msft
/sdk/**/api/ @KrzysztofCwalina @pakrym @tg-msft

###########
# Eng Sys
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ tools/*.dll

# Sensitive files
*.keys
!Azure.AspNetCore.DataProtection.Keys
!Azure.Extensions.AspNetCore.DataProtection.Keys
!Azure.Security.KeyVault.Keys
*.pfx
TestConfigurations.xml
Expand Down
87 changes: 72 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,13 @@ If for any reason there is an update to the build tools, you will then need to f

### Live testing

Live tests assume a live resource has been created and appropriate environment
variables have been set for the test process. To automate setting up live
resources we use created a script called `New-TestResources.ps1` that deploys
resources for a given service.
Before running or recording live tests you need to create
[live test resources](https://github.com/Azure/azure-sdk-for-net/blob/master/eng/common/TestResources/README.md).
If recording tests, secrets will be sanitized from saved recordings.
If you will be working on contributions over time, you should consider
persisting these variables.

To see what resources will be deployed for a live service, check the
`test-resources.json` ARM template files in the service you wish to deploy for
testing, for example `sdk\keyvault\test-resources.json`.

To deploy live resources for testing use the steps documented in [`Example 1 of New-TestResources.ps1`](eng/common/TestResources/New-TestResources.ps1.md#example-1)
to set up a service principal and deploy live testing resources.

To run live tests after deploying live resources:
To run live tests after creating live resources:

1. Open Developer Command Prompt
2. Navigate to service directory e.g. _"sdk\keyvault"_
Expand All @@ -143,7 +137,7 @@ In some cases, you might want to test against the latest versions of the client

## Public API additions

If you make a public API addition, the `eng\Export-API.ps1` script has to be run to update public API listings.
If you make a public API addition, the `eng\scripts\Export-API.ps1` script has to be run to update public API listings.

## API Compatibility Verification

Expand All @@ -168,7 +162,7 @@ Follow instructions provided [here](https://docs.microsoft.com/en-us/nuget/consu

You can also achieve this from the command line.

```nuget.exe sources add -Name Azure SDK for Net Dev Feed -Source https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-net/index.json```
```nuget.exe sources add -Name "Azure SDK for Net Dev Feed" -Source "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-net/index.json"```

You can then consume packages from this package source, remember to check the [Include prerelease](https://docs.microsoft.com/en-us/nuget/create-packages/prerelease-packages#installing-and-updating-pre-release-packages) box in Visual Studio when searching for the packages.

Expand Down Expand Up @@ -196,7 +190,7 @@ In `sdk\< Service Name >`, you will find projects for services that have already
5. Create a branch in your fork of Azure SDK for .NET and add your newly generated code to your project. If you don't have a project in the SDK yet, look at some of the existing projects and build one like the others.
6. **MANDATORY**: Add or update tests for the newly generated code.
7. Once added to the Azure SDK for .NET, build your local package using [client](#client-libraries) or [management](#management-libraries) library instructions shown in the above sections.
8. For management libraries run `eng\Update-Mgmt-Yml.ps1` to update PR include paths in `eng\pipelines\mgmt.yml`
8. For management libraries run `eng\scripts\Update-Mgmt-Yml.ps1` to update PR include paths in `eng\pipelines\mgmt.yml`
9. A Pull request of your Azure SDK for .NET changes against **master** branch of the [Azure SDK for .NET](https://github.com/azure/azure-sdk-for-net)
10. The pull requests will be reviewed and merged by the Azure SDK team

Expand Down Expand Up @@ -245,6 +239,69 @@ If you are adding a new service directory, ensure that it is mapped to a friendl
8. Copy existing generate.ps1 file from another service and update the `ResourceProvider` name that is applicable to your SDK. Resource provider refers to the relative path of your REST spec directory in Azure-Rest-Api-Specs repository
During SDK generation, this path helps to locate the REST API spec from the `https://github.com/Azure/azure-rest-api-specs`

# On-boarding New generated code library

1. Make a copy of `/sdk/template/Azure.Template` in you appropriate service directory and rename projects to `Azure.Management.*` for management libraries or `Azure.*` (e.g. `sdk/storage/Azure.Management.Storage` or `sdk/storage/Azure.Storage.Blobs`)
2. Modify `autorest.md` to point to you Swagger file or central README.md file. E.g.

``` yaml
input-file:
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/file.json
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json
```
``` yaml
require: https://github.com/Azure/azure-rest-api-specs/blob/49fc16354df7211f8392c56884a3437138317d1f/specification/azsadmin/resource-manager/storage/readme.md
```
3. Run `dotnet msbuild /t:GenerateCode` in src directory of the project (e.g. `net\sdk\storage\Azure.Management.Storage\src`). This would run Autorest and generate the code. (NOTE: this step requires Node 13).
4. For management plan libraries add `azure-arm: true` setting to `autorest.md` client constructors and options would be auto-generated. For data-plane libraries follow the next two steps.
4. Add a `*ClientOptions` type that inherits from `ClientOptions` and has a service version enum:

``` C#
namespace Azure.Management.Storage
{
public class StorageManagementClientOptions: ClientOptions
{
private const ServiceVersion Latest = ServiceVersion.V2019_06_01;
internal static StorageManagementClientOptions Default { get; } = new StorageManagementClientOptions();
public StorageManagementClientOptions(ServiceVersion serviceVersion = Latest)
{
VersionString = serviceVersion switch
{
ServiceVersion.V2019_06_01 => "2019-06-01",
_ => throw new ArgumentOutOfRangeException(nameof(serviceVersion))
};
}
internal string VersionString { get; }
public enum ServiceVersion
{
#pragma warning disable CA1707
V2019_06_01 = 1
#pragma warning restore CA1707
}
}
}
```
5. Add public constructors to all the clients using a partial class.
``` C#
public partial class FileSharesClient
{
public FileSharesClient(string subscriptionId, TokenCredential tokenCredential): this(subscriptionId, tokenCredential, StorageManagementClientOptions.Default)
{
}
public FileSharesClient(string subscriptionId, TokenCredential tokenCredential, StorageManagementClientOptions options):
this(new ClientDiagnostics(options), ManagementClientPipeline.Build(options, tokenCredential), subscriptionId, apiVersion: options.VersionString)
{
}
}
```

### Code Review Process

Before a pull request will be considered by the Azure SDK team, the following requirements must be met:
Expand Down
30 changes: 21 additions & 9 deletions common/SmokeTests/SmokeTest/KeyVaultTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace SmokeTest
{
class KeyVaultTest
{
private const string defaultAuthorityHost = "https://login.microsoftonline.com";
private static Dictionary<string, Uri> authorityHostMap = new Dictionary<string, Uri>
{
{ "AzureCloud", KnownAuthorityHosts.AzureCloud },
{ "AzureChinaCloud", KnownAuthorityHosts.AzureChinaCloud },
{ "AzureGermanCloud", KnownAuthorityHosts.AzureGermanCloud },
{ "AzureUSGovernment", KnownAuthorityHosts.AzureUSGovernment },
};

private static string SecretName = $"SmokeTestSecret-{Guid.NewGuid()}";
private const string SecretValue = "smokeTestValue";
Expand All @@ -30,17 +37,12 @@ public static async Task RunTests()
Console.WriteLine("2.- Get that Secret");
Console.WriteLine("3.- Delete that Secret (Clean up)\n");

string tenantID = Environment.GetEnvironmentVariable("DIR_TENANT_ID");
string clientID = Environment.GetEnvironmentVariable("APP_CLIENT_ID");
string clientSecret = Environment.GetEnvironmentVariable("CLIENT_SECRET");
string keyVaultUri = Environment.GetEnvironmentVariable("KEY_VAULT_URI");

var authorityHost = Environment.GetEnvironmentVariable("AZURE_AUTHORITY_HOST")
?? defaultAuthorityHost;
var authorityHost = GetAuthorityHost(Environment.GetEnvironmentVariable("AZURE_CLOUD"), KnownAuthorityHosts.AzureCloud);

var defaultAzureCredentialOptions = new DefaultAzureCredentialOptions
{
AuthorityHost = new Uri(authorityHost)
{
AuthorityHost = authorityHost
};


Expand Down Expand Up @@ -82,5 +84,15 @@ private static async Task CleanUp()
await secretDeletePoller.WaitForCompletionAsync();
Console.WriteLine("\tdone");
}

private static Uri GetAuthorityHost(string cloudName, Uri defaultAuthorityHost)
{
Uri output;
if (authorityHostMap.TryGetValue(cloudName, out output))
{
return output;
}
return defaultAuthorityHost;
}
}
}
7 changes: 5 additions & 2 deletions common/SmokeTests/SmokeTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ namespace SmokeTest
class Program
{
static async Task<int> Main(string[] args)
{
{
Console.WriteLine("SMOKE TEST FOR TRACK 2 LIBRARIES");

await KeyVaultTest.RunTests();
await BlobStorageTest.RunTests();
await EventHubsTest.RunTests();
await CosmosDBTest.RunTests();
// Temporarily disable Cosmos DB smoke tests
// Issue to re-enable:
// https://github.com/Azure/azure-sdk-for-net/issues/11297
// await CosmosDBTest.RunTests();

return 0;
}
Expand Down
Loading

0 comments on commit 1fd9ebb

Please sign in to comment.