Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for deployment in Azure Government Cloud (Workbench-Libs) #1713

Merged
merged 7 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class AzureApplicationInsightsServiceInterp[F[_]](clientSecretCredential: Client

private def buildApplicationInsightsManager(cloudContext: AzureCloudContext): F[ApplicationInsightsManager] = {
val azureProfile =
new AzureProfile(cloudContext.tenantId.value, cloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(cloudContext.tenantId.value,
cloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()
)
F.blocking(ApplicationInsightsManager.authenticate(clientSecretCredential, azureProfile))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class AzureBatchServiceInterp[F[_]](clientSecretCredential: ClientSecretCredenti

private def buildBatchManager(cloudContext: AzureCloudContext): F[BatchManager] = {
val azureProfile =
new AzureProfile(cloudContext.tenantId.value, cloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(cloudContext.tenantId.value,
cloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()
)
F.blocking(BatchManager.authenticate(clientSecretCredential, azureProfile))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ class AzureContainerServiceInterp[F[_]](clientSecretCredential: ClientSecretCred

private def buildContainerServiceManager(cloudContext: AzureCloudContext): F[ContainerServiceManager] = {
val azureProfile =
new AzureProfile(cloudContext.tenantId.value, cloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(cloudContext.tenantId.value,
cloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()
)
F.blocking(ContainerServiceManager.authenticate(clientSecretCredential, azureProfile))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.broadinstitute.dsde.workbench.azure

import com.azure.core.management.AzureEnvironment

object AzureEnvironmentConfig {
val AZURE_ENVIRONMENT_CONFIG = "AZURE_ENVIRONMENT"

private val Azure: String = "AzureCloud"
private val AzureGov: String = "AzureUSGovernmentCloud"

def fromString(s: String): AzureEnvironment = s match {
case AzureGov => AzureEnvironment.AZURE_US_GOVERNMENT
case Azure => AzureEnvironment.AZURE
case _ => throw new IllegalArgumentException(s"Unknown Azure environment: $s")
}

def fromCurrentHostingEnv(): AzureEnvironment =
fromString(scala.util.Properties.envOrElse(AZURE_ENVIRONMENT_CONFIG, Azure))
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ class AzureRelayInterp[F[_]](clientSecretCredential: ClientSecretCredential)(imp

private def buildRelayManager(azureCloudContext: AzureCloudContext): F[RelayManager] = {
val azureProfile =
new AzureProfile(azureCloudContext.tenantId.value, azureCloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(azureCloudContext.tenantId.value,
azureCloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()
)

F.blocking(RelayManager.authenticate(clientSecretCredential, azureProfile))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ class AzureVmServiceInterp[F[_]](clientSecretCredential: ClientSecretCredential)

private def buildComputeManager(azureCloudContext: AzureCloudContext): F[ComputeManager] = {
val azureProfile =
new AzureProfile(azureCloudContext.tenantId.value, azureCloudContext.subscriptionId.value, AzureEnvironment.AZURE)
new AzureProfile(azureCloudContext.tenantId.value,
azureCloudContext.subscriptionId.value,
AzureEnvironmentConfig.fromCurrentHostingEnv()
)
F.blocking(ComputeManager.authenticate(clientSecretCredential, azureProfile))
}

Expand Down
2 changes: 1 addition & 1 deletion project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ object Settings {
val azureSettings = commonSettings ++ List(
name := "workbench-azure",
libraryDependencies ++= azureDependencies,
version := createVersion("0.9")
version := createVersion("0.10")
) ++ publishSettings

val openTelemetrySettings = commonSettings ++ List(
Expand Down
Loading