Revert "Removing environment argument"

This reverts commit 59b0222627.
This commit is contained in:
Paulo 2023-04-20 20:37:18 +00:00
Родитель 6eb4118242
Коммит 8987236793
3 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -36,6 +36,7 @@ Finally, if the certificate from is new, it then extracts the certificate and pr
* **certulr** - This is the KeyVault URL followed by the certificate name. E.g. https://pmc-anf-release-kv.vault.azure.net/vm-cert
* **outputfolder** - Folder where the PEM file with the Certificate and its Private Key will be saved, it must exist beforehand, the tool will not create it and will also not manage permissions on the files
* **environment** - Valid azure cloud environments: [AZUREPUBLICCLOUD AZUREUSGOVERNMENTCLOUD AZUREGERMANCLOUD AZURECHINACLOUD] (default "AZUREPUBLICCLOUD")
* **version** - shows current tool version
* **managed-identity-id** - Uses user managed identities (accepts resource id or client id)
* **use-system-managed-identity** - Uses system managed identity

Просмотреть файл

@ -44,13 +44,15 @@ const (
)
var (
validEnvironments = []string{"AZUREPUBLICCLOUD", "AZUREUSGOVERNMENTCLOUD", "AZUREGERMANCLOUD", "AZURECHINACLOUD"}
certURL = flag.String("certurl", "", "certificate URL, e.g. \"https://mykeyvault.vault.azure.net/mycertificate\"")
outputFolder = flag.String("outputfolder", "", "folder where PEM file with certificate and private key will be saved")
environment = flag.String("environment", "AZUREPUBLICCLOUD", fmt.Sprintf("valid azure cloud environments: %v", validEnvironments))
cmdlineversion = flag.Bool("version", false, "shows current tool version")
managedIdentityId = flag.String("managed-identity-id", "", "uses user managed identities (accepts resource id or client id)")
useSystemManagedIdentity = flag.Bool("use-system-managed-identity", false, "uses system managed identity")
exitCode = 0
version = "1.1.3"
version = "1.1.1"
stdout = log.New(os.Stdout, "", log.LstdFlags)
stderr = log.New(os.Stderr, "", log.LstdFlags)
)
@ -83,6 +85,14 @@ func main() {
return
}
// Checks if valid cloud environment was passed
_, found := utils.FindInSlice(validEnvironments, strings.ToUpper(*environment))
if !found {
utils.ConsoleOutput(fmt.Sprintf("<error> invalid azure environment (%v), valid environments are: %v", *environment, validEnvironments), stderr)
exitCode = ERR_INVALID_AZURE_ENVIRONMENT
return
}
// Checks if both user managed identity and system managed identities were set
if *managedIdentityId != "" && *useSystemManagedIdentity {
utils.ConsoleOutput("<error> invalid authentication options, user and system assigned managed identities arguments cannot be used at the same time", stderr)
@ -103,6 +113,7 @@ func main() {
utils.ConsoleOutput(fmt.Sprintf("Output Folder: %v", *outputFolder), stdout)
utils.ConsoleOutput(fmt.Sprintf("Using Certificate URL: %v", *certURL), stdout)
utils.ConsoleOutput(fmt.Sprintf("Environment: %v", *environment), stdout)
utils.ConsoleOutput("Checking if this session needs to rely on AD Workload Identity webhook", stdout)
var cred azcore.TokenCredential

Двоичные данные
media/screenshot.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 92 KiB

После

Ширина:  |  Высота:  |  Размер: 213 KiB