-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AzureBlobStorage: Add interactive and MI auth (#80)
- Loading branch information
Showing
7 changed files
with
133 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
||
namespace Microsoft.MSBuildCache.AzureBlobStorage; | ||
|
||
public class AzureBlobStoragePluginSettings : PluginSettings | ||
{ | ||
public AzureStorageCredentialsType CredentialsType { get; init; } = AzureStorageCredentialsType.Interactive; | ||
|
||
public Uri? BlobUri { get; init; } | ||
|
||
public string? ManagedIdentityClientId { get; init; } | ||
|
||
public string InteractiveAuthTokenDirectory { get; init; } = Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\MSBuildCache\AuthTokenCache"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.MSBuildCache.AzureBlobStorage; | ||
|
||
/// <summary> | ||
/// Determines how to authenticate to Azure Storage. | ||
/// </summary> | ||
public enum AzureStorageCredentialsType | ||
{ | ||
/// <summary> | ||
/// Use interactive authentication. | ||
/// </summary> | ||
Interactive, | ||
|
||
/// <summary> | ||
/// Use a connection string to authenticate. | ||
/// </summary> | ||
/// <remarks> | ||
/// The "MSBUILDCACHE_CONNECTIONSTRING" environment variable must contain the connection string to use. | ||
/// </remarks> | ||
ConnectionString, | ||
|
||
/// <summary> | ||
/// Use a managed identity to authenticate. | ||
/// </summary> | ||
ManagedIdentity, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/AzureBlobStorage/build/Microsoft.MSBuildCache.AzureBlobStorage.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
<Project> | ||
<PropertyGroup Condition="'$(MSBuildCacheEnabled)' != 'false'"> | ||
<MSBuildCacheGlobalPropertiesToIgnore>$(MSBuildCacheGlobalPropertiesToIgnore);MSBuildCacheCredentialsType</MSBuildCacheGlobalPropertiesToIgnore> | ||
<MSBuildCacheGlobalPropertiesToIgnore>$(MSBuildCacheGlobalPropertiesToIgnore);MSBuildCacheBlobUri</MSBuildCacheGlobalPropertiesToIgnore> | ||
<MSBuildCacheGlobalPropertiesToIgnore>$(MSBuildCacheGlobalPropertiesToIgnore);MSBuildCacheManagedIdentityClientId</MSBuildCacheGlobalPropertiesToIgnore> | ||
<MSBuildCacheGlobalPropertiesToIgnore>$(MSBuildCacheGlobalPropertiesToIgnore);MSBuildCacheInteractiveAuthTokenDirectory</MSBuildCacheGlobalPropertiesToIgnore> | ||
</PropertyGroup> | ||
|
||
<Import Project="Microsoft.MSBuildCache.Common.targets" /> | ||
|
||
<ItemGroup Condition="'$(MSBuildCacheEnabled)' != 'false'"> | ||
<ProjectCachePlugin Update="$(MSBuildCacheAssembly)"> | ||
<CredentialsType>$(MSBuildCacheCredentialsType)</CredentialsType> | ||
<BlobUri>$(MSBuildCacheBlobUri)</BlobUri> | ||
<ManagedIdentityClientId>$(MSBuildCacheManagedIdentityClientId)</ManagedIdentityClientId> | ||
<InteractiveAuthTokenDirectory>$(MSBuildCacheInteractiveAuthTokenDirectory)</InteractiveAuthTokenDirectory> | ||
</ProjectCachePlugin> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters