login action for azurestack - #41
Conversation
e98e7f4 to
99a7777
Compare
99a7777 to
c8d5cdd
Compare
Usha N (N-Usha)
left a comment
There was a problem hiding this comment.
These changes look good to me. I would let Akshaya or some engineering folks to review as well. Few comments/queries from my side -
- The new attributes expected in the SPN are optional rt? I mean for non-Azure stack scenarios, user would not need to supply these in the JSON object. Is that rt?
- What is the attribute of profileVersion? Are there any acceptable values for it?
- What are the acceptable values for "customEnvironmentName" ? Does the user need to specify in any specific format? I assume these additional attributes will be returned when user runs the Az CLI command "az ad sp create-for-rbac --sdk-auth". In case user manually tries to construct the JSOn object, we may need to provide the required guidance for this. Also should we have any additional checks in the code to validate that the values we get for this string follow the required notation?
Yes, they are optional. not needed in the JSON object for non-Azure stack scenarios
Can be one of these {2017-03-09-profile, 2018-03-01-hybrid, 2019-03-01-hybrid, latest}. Azure Stack currently supports '2019-03-01-hybrid'
Can be any unique name (such as AzureStack) other than known clouds ('AzureCloud', 'AzureUSGovernment', etc)
No, these 2 additional attributes (profileVersion and customEnvironmentName) will not be generated by the above Azure CLI cmd. User will need to manually add these to the existing JSON object. We will provide the required guidance in the doc. We can add the validation for profileVersion parameter but the list of acceptable values will change in future. Hence, we will need to update the code whenever new profileVersion is released. I prefer documenting this instead of adding validation. But based on the review suggestions, I can add validation. |
|
Thanks Rakesh Rakesh Kumar (@rakku-ms) . Few additional comments on below
|
|
FYI: Usha N (@N-Usha) bganapa |
Rakesh Kumar (@rakku-ms) Will the |
| throw new Error("Not all values are present in the creds object. Ensure clientId, clientSecret, tenantId and subscriptionId are supplied."); | ||
| } | ||
| // Attempting Az cli login | ||
| if (customEnvironmentName != "") { |
There was a problem hiding this comment.
Can we fix the customEnvironmentName to be AzureStack and check for that condition here?
There was a problem hiding this comment.
Rakesh Kumar (@rakku-ms) - Could you please confirm if there is a strong requirement for knowing the Environment "name"? Or could we just seek Environment "type" which can just be an allowed list of keywords like "AzureStack" ?
There was a problem hiding this comment.
yes, A customer can have several instances of AzureStack and the name cannot be limited to a particular set. You can see that when we do 'az cloud register' , the name is a parameter for customer to name it whatever they want.
There was a problem hiding this comment.
- In our Azure DevOps world, we use a list of pre-defined values for the different cloud types. Users targeting Azure Stack, only needs to select AzureStack as the environment and provide the Azure Stack server URL.
- The
az cloud registerpersists for only one session and cannot be reused in a new session. Also, a user cannot login into multiple environments in a single workflow job. I am not sure if we are gaining anything by letting a user name the environment whatever they want. If the user wants to differentiate between the instances, he can specify it in the job name, something like :
name: Run on Azure Stack
jobs:
run-on-instance-1:
- uses: azure/login@v1
with:
environment: AzureStack
creds: ${{ secrets.AZURE_CREDENTIALS_FOR_INSTANCE_1 }}
run-on-instance-2:
- uses: azure/login@v1
with:
environment: AzureStack
creds: ${{ secrets.AZURE_CREDENTIALS_FOR_INSTANCE_2 }}
- We also do not ask for profile version in Azure DevOps, just the Server Url. Can this value be fixed in the action instead of taking input from user.
There was a problem hiding this comment.
Ashish Ranjan (@asranja) I am using self-hosted runner as Azure Stack env is not publicly accessible from internet. For me registered cloud is getting persisted on my desktop. So, I am unable to run workflow on 2 different Azure Stack environment with same environmentName AzureStack. The second run also happens against the first since the cloud with the name AzureStack already exists. The register cmd doesn't overwrite the previous environment and just try to login to the existing one. One workaround would be to first remove the already existing AzureStack environment and then try to register. If this is what your team prefers, I will make this change. FYI: bganapa
PS login> az cloud list --output table
IsActive Name Profile
---------- -------------------- -----------------
False AzureCloud latest
False AzureChinaCloud latest
False AzureUSGovernment latest
False AzureGermanCloud latest
False AzureStackRedmond001 2019-03-01-hybrid
False AzureStackTest01 2019-03-01-hybrid
False AzureStackTest02 2019-03-01-hybrid
False AzureStackLH01 2019-03-01-hybrid
False AzureStackRedmond 2019-03-01-hybrid
There was a problem hiding this comment.
Rakesh Kumar (@rakku-ms) Thanks for giving more details regarding the environment name. We will discuss this internally and get back.
Regarding the profile version: As per my understanding, most Azure resources will have different api-version depending on the profile version. Currently, we have hard-coded all the api-versions in our REST Apis, for example. I am not sure how are we planning on updating the rest api-versions depending on the profile version.
There was a problem hiding this comment.
Rakesh Kumar (@rakku-ms) - Can you please help understand how many customers usually need to access two or more different Azure stack environments? Coz am still wondering if this is a real issue, why isn't that any of the Azure DevOps customers ever flag this as a blocker?
| let tenantId = secrets.getSecret("$.tenantId", false); | ||
| let subscriptionId = secrets.getSecret("$.subscriptionId", false); | ||
| let resourceManagerEndpointUrl = secrets.getSecret("$.resourceManagerEndpointUrl", false); | ||
| let profileVersion = core.getInput("profileVersion"); |
There was a problem hiding this comment.
inputs have to be added in action.yml file as well
There was a problem hiding this comment.
added environmentName and profileVersion in action.yml
| let subscriptionId = secrets.getSecret("$.subscriptionId", false); | ||
| let resourceManagerEndpointUrl = secrets.getSecret("$.resourceManagerEndpointUrl", false); | ||
| let profileVersion = core.getInput("profileVersion"); | ||
| let customEnvironmentName = core.getInput("customEnvironmentName"); |
There was a problem hiding this comment.
call it just environment instead of customEnvironmentName?
There was a problem hiding this comment.
environmentName sounds good to me
There was a problem hiding this comment.
updated to environmentName
Yes, sp Azure CLI cmd will populate the correct value for |
2afa2e1 to
359d40b
Compare
6a1dfa1 to
5c8c57a
Compare
|
Ashish Ranjan (@asranja) let us know if you have any other concerns regarding this PR. If not, can we please publish this? |
| required: false | ||
| default: false | ||
| environment: | ||
| description: 'Name of the environment (Set this to AzureStack for AzureStack environment)' |
There was a problem hiding this comment.
We also need to mention a default value for this parameter with value: public. Description can be "Name of the environment. Supported values are AzureStack, public. Default being public". And is the value expected to be case sensitive?
There was a problem hiding this comment.
Usha N (@N-Usha) I have updated the description. Also made modification to make this parameter case insensitive.
| required: false | ||
| default: false | ||
| environment: | ||
| description: 'Name of the environment (Set this to AzureStack for AzureStack environment)' |
There was a problem hiding this comment.
We also need to mention a default value for this parameter with value: public. Description can be "Name of the environment. Supported values are AzureStack, public. Default being public". And is the value expected to be case sensitive?
5c8c57a to
9e18a8d
Compare
|
IMO we should NOT be merging the changes into master but rather into a new branch exclusively for AzureStackSupport-Beta... Naveen Desu (@nadesu) to reconfirm. I or one of our team members can create the new branch if you want us to.. Rakesh Kumar (@rakku-ms) - Please confirm. |
I agree with the above proposal |
Usha N (@N-Usha) Naveen Desu (@nadesu) yes, please create a new branch for AzureStackSupport. FYI, bganapa sarathys |
https://github.com/Azure/login/tree/AzureStackSupport-Beta - Please use this branch. |
thanks Usha N (@N-Usha)! |

No description provided.