Skip to content

login action for azurestack - #41

Merged
Ashish Ranjan (asranja) merged 5 commits into
Azure:AzureStackSupport-Betafrom
rakku-ms:azslogin
Aug 28, 2020
Merged

login action for azurestack#41
Ashish Ranjan (asranja) merged 5 commits into
Azure:AzureStackSupport-Betafrom
rakku-ms:azslogin

Conversation

@rakku-ms

Copy link
Copy Markdown
Contributor

No description provided.

@N-Usha Usha N (N-Usha) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@rakku-ms

Copy link
Copy Markdown
Contributor Author

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?

Yes, they are optional. not needed in the JSON object for non-Azure stack scenarios

  • What is the attribute of profileVersion? Are there any acceptable values for it?

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'

  • What are the acceptable values for "customEnvironmentName" ? Does the user need to specify in any specific format?

Can be any unique name (such as AzureStack) other than known clouds ('AzureCloud', 'AzureUSGovernment', etc)

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?

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.

@N-Usha

Usha N (N-Usha) commented Jul 29, 2020

Copy link
Copy Markdown
Contributor

Thanks Rakesh Rakesh Kumar (@rakku-ms) . Few additional comments on below

"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."

  • If the additional attributes are to be provided manually by the user, we believe that these should be inputs in action.yml than fudging the details into the JSON object. Let the JSON be what the output of Az CLI command is. This will also give us an advantage of providing guidance for each input as field "description" in the action.yml - which also shows up when the action is selected in the marketplace search in the right pane experience while editing an action workflow.
  • For "customEnvironmentName", we believe there should be a standard list of allowed values which should include one for "AzureStack" which should be validatable in the code and hence its not recommended to accommodate "Can be any unique name other than known clouds "
  • IMO seeking "profileVersion" from the customers is not an optimal experience as they may have a dependency on referring to documentation each time for a supported notation and latest version detail. Could we instead avoid this input, hardcode the value and keep bumping it up whenever there is a new API version update? Could you please confirm the release cycle for these versions? How often are they updated? And would there be backward compatibility issues if the version is not updated?

@bganapa

bganapa commented Jul 30, 2020

Copy link
Copy Markdown
Member
  • Agree. instead of placing the details in the json object, it makes sense for them to be part of action.yml, Can you pleas confirm that the values in the action.yml could be overrriden in the individual workflow yml? if the customer want to run a work flow against azure and azurestack, allowing the override would be helpful.

  • customEnvironmentName can be anything, it is not restricted to a known set. For example the customer may have multiple azurestack environments and name them in any way they want. We do not restrict the name to a set in CLI or powershell (az could register -n / Add-AzEnvironment -Name )

  • profiles point to a set of RP api versions and allow customers to stick to them without consuming any breaking changes inadvertently. AzureStack is a boxed product and we support last three versions. These three versions may be on a different profile. There is no ARM call to get to know the supported API profile from the stack environment at the moment. So it is essential to provide the option of specifying the profile as a parameter. We can have the default value as the latest supported API profile .

Usha N (@N-Usha) , cc: Rakesh Kumar (@rakku-ms)

Comment thread src/main.ts Outdated
@rakku-ms

Copy link
Copy Markdown
Contributor Author
  • Moved profileVersion and customEnvironmentName parameters from secret json object to workflow yml
  • Added keyvault and storage endpoints suffixes during cloud registration

FYI: Usha N (@N-Usha) bganapa

@asranja

Copy link
Copy Markdown
Contributor

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.

Rakesh Kumar (@rakku-ms) Will the az ad sp create-for-rbac command populate appropriate value for resourceManagerEndpointUrl when run against Azure Stack environment or do users need to specify it manually ?

Comment thread src/main.ts Outdated
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 != "") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we fix the customEnvironmentName to be AzureStack and check for that condition here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bganapa

  • 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.

89559574-7836a400-d833-11ea-9d64-8bcdafcdbfa1

  • The az cloud register persists 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.

Capture

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@N-Usha Usha N (N-Usha) Aug 10, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread src/main.ts Outdated
let tenantId = secrets.getSecret("$.tenantId", false);
let subscriptionId = secrets.getSecret("$.subscriptionId", false);
let resourceManagerEndpointUrl = secrets.getSecret("$.resourceManagerEndpointUrl", false);
let profileVersion = core.getInput("profileVersion");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inputs have to be added in action.yml file as well

@rakku-ms Rakesh Kumar (rakku-ms) Aug 5, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added environmentName and profileVersion in action.yml

Comment thread src/main.ts Outdated
let subscriptionId = secrets.getSecret("$.subscriptionId", false);
let resourceManagerEndpointUrl = secrets.getSecret("$.resourceManagerEndpointUrl", false);
let profileVersion = core.getInput("profileVersion");
let customEnvironmentName = core.getInput("customEnvironmentName");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call it just environment instead of customEnvironmentName?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

environmentName sounds good to me

@rakku-ms Rakesh Kumar (rakku-ms) Aug 5, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to environmentName

Comment thread src/main.ts Outdated
@rakku-ms

Copy link
Copy Markdown
Contributor Author

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.

Rakesh Kumar (@rakku-ms) Will the az ad sp create-for-rbac command populate appropriate value for resourceManagerEndpointUrl when run against Azure Stack environment or do users need to specify it manually ?

Yes, sp Azure CLI cmd will populate the correct value for resourceManagerEndpointUrl when run against AAD based Azure Stack. We don't support this cmd for ADFS based Azure Stack. We plan to write a json generator script to do this job for ADFS based Azure Stack.

@rakku-ms
Rakesh Kumar (rakku-ms) force-pushed the azslogin branch 2 times, most recently from 2afa2e1 to 359d40b Compare August 17, 2020 21:15
Comment thread src/PowerShell/Utilities/ScriptBuilder.ts
Comment thread src/main.ts
@rakku-ms
Rakesh Kumar (rakku-ms) force-pushed the azslogin branch 2 times, most recently from 6a1dfa1 to 5c8c57a Compare August 19, 2020 06:08
@rakku-ms

Copy link
Copy Markdown
Contributor Author

Ashish Ranjan (@asranja) let us know if you have any other concerns regarding this PR. If not, can we please publish this?
FYI, bganapa

Comment thread action.yml Outdated
required: false
default: false
environment:
description: 'Name of the environment (Set this to AzureStack for AzureStack environment)'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usha N (@N-Usha) for the description.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usha N (@N-Usha) I have updated the description. Also made modification to make this parameter case insensitive.

Comment thread action.yml Outdated
required: false
default: false
environment:
description: 'Name of the environment (Set this to AzureStack for AzureStack environment)'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@N-Usha

Copy link
Copy Markdown
Contributor

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.

@nadesu

Copy link
Copy Markdown

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

@rakku-ms

Copy link
Copy Markdown
Contributor Author

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

@N-Usha

Copy link
Copy Markdown
Contributor

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.

@asranja
Ashish Ranjan (asranja) changed the base branch from master to AzureStackSupport-Beta August 27, 2020 14:31
@rakku-ms

Copy link
Copy Markdown
Contributor Author

@asranja
Ashish Ranjan (asranja) merged commit 513cdfa into Azure:AzureStackSupport-Beta Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants