diff --git a/containers/Dockerfile b/containers/Dockerfile index 994ded82..e53848ac 100644 --- a/containers/Dockerfile +++ b/containers/Dockerfile @@ -32,9 +32,6 @@ RUN dnf update && dnf install -y --setopt=install_weak_deps=False \ git python39 jq yq gettext wget which &&\ dnf clean all -# Install azure cli -RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc && dnf install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm && dnf install -y azure-cli - # copy oc client binary from oc-build image COPY --from=oc-build /tmp/oc/oc /usr/bin/oc diff --git a/containers/Dockerfile-ppc64le b/containers/Dockerfile-ppc64le index 92fcf22d..875e5deb 100644 --- a/containers/Dockerfile-ppc64le +++ b/containers/Dockerfile-ppc64le @@ -2,15 +2,10 @@ FROM ppc64le/centos:8 -FROM mcr.microsoft.com/azure-cli:latest as azure-cli - LABEL org.opencontainers.image.authors="Red Hat OpenShift Chaos Engineering" ENV KUBECONFIG /root/.kube/config -# Copy azure client binary from azure-cli image -COPY --from=azure-cli /usr/local/bin/az /usr/bin/az - # Install dependencies RUN yum install -y git python39 python3-pip jq gettext wget && \ python3.9 -m pip install -U pip && \ diff --git a/docs/cloud_setup.md b/docs/cloud_setup.md index 3b9cf13e..278560d5 100644 --- a/docs/cloud_setup.md +++ b/docs/cloud_setup.md @@ -27,14 +27,12 @@ After creating the service account you will need to enable the account using the ## Azure -**NOTE**: For Azure node killing scenarios, make sure [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) is installed. - -You will also need to create a service principal and give it the correct access, see [here](https://docs.openshift.com/container-platform/4.5/installing/installing_azure/installing-azure-account.html) for creating the service principal and setting the proper permissions. +**NOTE**: You will need to create a service principal and give it the correct access, see [here](https://docs.openshift.com/container-platform/4.5/installing/installing_azure/installing-azure-account.html) for creating the service principal and setting the proper permissions. To properly run the service principal requires “Azure Active Directory Graph/Application.ReadWrite.OwnedBy” api permission granted and “User Access Administrator”. Before running you will need to set the following: -1. Login using ```az login``` +1. ```export AZURE_SUBSCRIPTION_ID=``` 2. ```export AZURE_TENANT_ID=``` diff --git a/kraken/node_actions/az_node_scenarios.py b/kraken/node_actions/az_node_scenarios.py index bcec871a..43e973af 100644 --- a/kraken/node_actions/az_node_scenarios.py +++ b/kraken/node_actions/az_node_scenarios.py @@ -1,6 +1,6 @@ import time -import yaml +import os import kraken.invoke.command as runcommand import logging import kraken.node_actions.common_node_functions as nodeaction @@ -17,9 +17,9 @@ def __init__(self): # Acquire a credential object using CLI-based authentication. credentials = DefaultAzureCredential() logging.info("credential " + str(credentials)) - az_account = runcommand.invoke("az account list -o yaml") - az_account_yaml = yaml.safe_load(az_account, Loader=yaml.FullLoader) - subscription_id = az_account_yaml[0]["id"] + # az_account = runcommand.invoke("az account list -o yaml") + # az_account_yaml = yaml.safe_load(az_account, Loader=yaml.FullLoader) + subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID") self.compute_client = ComputeManagementClient(credentials, subscription_id) # Get the instance ID of the node