-
Notifications
You must be signed in to change notification settings - Fork 316
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
Automate VM MSI testing #815
Comments
@jianghaolu, it looks like you've got most of this figured out, what assistance do you need from the engineering system team? |
For Golang VM testing the set up is the same up to step 3. The steps for installing Go on the VM and then running the tests are as follows: Install Golang on each VM
Clone Go SDK repo
Run tests
Expected result (it should say PASS in the message)
Please NoteIf step 6 returns an error saying that GoCache variable or HOME variables aren't set, then assign the path of the user's home directory as follows: |
Python instructions are here. |
Hi @chlowell , I am following above steps to do python E2E test. My suggestion as below. Please correct me if I miss anything. 1.Since the test needs to delete secret after setting.
So we need to create a non-soft-delete KV in this step.
If not, the test command will fail with below error. 2.We also need add admin name when creating vm.
|
Hi @jianghaolu, I am following above steps to do Java E2E test. My suggestion as below. Please correct me if I miss anything. 1.In step of creating vm command, we need specify the admin name using below command or error will occur.
|
@XuGuang-Yao Which version of Azure CLI are you using? I'm using 2.0.78 on Mac and the username is automatically using my local user account's name. When I run
But I agree with you we probably should be more specific on the username. Some environments may not be able to populate a default value. |
@jianghaolu ,Thanks for your quick reply. I am using 2.2.0 on windows. There is something wrong with my default account name, my fault. |
@jianghaolu, I tried to repeat the test steps today and found the last command doesn't work as expected. In the lastest verison of repo. I can't find the pom.client.xml any more. I noticed this file highly like the removed pom.client.xml. I tried to use it instead of the pom.client.xml, but it doesn't work either. Could you please help to do a further investigation and correct the command? |
Ahh yes - they changed the pom file structure in the repo. Breaking a lot of people apparently. Let me fix the instructions. |
For JavaScript: prerequisite tools
Azure resourcesThis test requires instances of these Azure resources:
The rest of this section is a walkthrough of deploying these resources. Set environment variables to simplify copy-pasting
Run inside of PowerShellThese instructions assume you're running inside of PowerShell. resource groupaz group create -n $RESOURCE_GROUP --location westus2 Managed identityCreate the identity: az identity create -n $MANAGED_IDENTITY_NAME -g $RESOURCE_GROUP -l westus2 Virtual machinesWith system-assigned identity: az vm create -n $VM_NAME_SYSTEM_ASSIGNED -g $RESOURCE_GROUP --image UbuntuLTS --assign-identity --size Standard_DS1_v2 -l westus2 --generate-ssh-keys With user-assigned identity: az vm create -n $VM_NAME_USER_ASSIGNED -g $RESOURCE_GROUP --image UbuntuLTS --assign-identity $(az identity show -g $RESOURCE_GROUP -n $MANAGED_IDENTITY_NAME -o tsv --query id) --size Standard_DS1_v2 -l westus2 --generate-ssh-keys Key Vault:az keyvault create -g $RESOURCE_GROUP -n $KEY_VAULT_NAME --sku standard Allow the VM with system-assigned identity to access the Key Vault's secrets: az keyvault set-policy -n $KEY_VAULT_NAME --object-id $(az vm show -n $VM_NAME_SYSTEM_ASSIGNED -g $RESOURCE_GROUP --query identity.principalId -o tsv) --secret-permissions set delete Do the same for the user-assigned identity: az keyvault set-policy -n $KEY_VAULT_NAME --object-id $(az identity show -g $RESOURCE_GROUP -n $MANAGED_IDENTITY_NAME --query principalId -o tsv) --secret-permissions set delete Install dependenciesget user-assigned client id$VM_ID_USER_ASSIGNED = az vm show -g $RESOURCE_GROUP -n $VM_NAME_USER_ASSIGNED -o tsv --query "identity.userAssignedIdentities.*.{clientId: clientId}" Build the webapp
Install the requirements:
Build the job:
Build and run the tests az vm run-command invoke -g $RESOURCE_GROUP -n $VM_NAME_USER_ASSIGNED --command-id RunShellScript --parameters "KEY_VAULT_NAME=$($KEY_VAULT_NAME) VM_ID_USER_ASSIGNED=$($VM_ID_USER_ASSIGNED)"--scripts '"sudo apt update && (yes | sudo apt install npm) && npm install -g typescript && git clone https://github.com/azure/azure-sdk-for-js --single-branch --branch master --depth 1 && cd azure-sdk-for-js/sdk/identity/identity/test/manual-integration/AzureVM && npm install && tsc -p ."' az vm run-command invoke -g $RESOURCE_GROUP -n $VM_NAME_SYSTEM_ASSIGNED --command-id RunShellScript --parameters "KEY_VAULT_NAME=$($KEY_VAULT_NAME)" --scripts '"sudo apt update && (yes | sudo apt install npm) && sudo npm install -g typescript && git clone https://github.com/azure/azure-sdk-for-js --single-branch --branch master --depth 1 && cd azure-sdk-for-js/sdk/identity/identity/test/manual-integration/AzureVM && npm install && tsc -p . && node index"' Note, if you see a message like "Could not get lock /var/lib/apt/lists/lock - open", you may need to re-run the command. Verify success
Delete Azure resourcesaz group delete -n $RESOURCE_GROUP -y --no-wait |
Hi @jonathandturner, I am following above steps to do JS E2E test. My suggestion as below. Please correct me if I miss anything. Same keytar issue here. I tried to add
I also tried to update the command in other tests (such as Cloud Shell and Pod),but they failed with below error.
|
@XuGuang-Yao - can you describe these to help us understand what is happening?
You shouldn't need to use commands like |
@jonathandturner - I am using PowerShell on windows 10 to test. Since this test needs create a linux VM, so I think the As for the 'sudo' is not recognized error in other test scenarios(such as CloudShell and Pod), I just tried to fix test steps in the same way as this one. (add ( |
@XuGuang-Yao - the steps above invoke the VM from Windows rather than ssh'ing into the VM. Were there steps above that needed you to log into the VM and run commands directly? I may need to rewrite some of the instructions to be more clear. |
@jonathandturner - Let forget the BTW, I do use |
@XuGuang-Yao - we may need to add a step where you log into the VM and run:
And then do the build steps from the VM. I was able to run the above, |
@jonathandturner -Thanks for your updating. BTW, I do run Pod test against Docker lunix container environment. |
@jianghaolu Did I use the wrong pom file? Could you please take a look and correct the test steps? |
@jonathandturner - Hope you are doing well. The |
@jianghaolu - Hi, I noticed that the instructions are still using the |
Hi @catalinaperalta, @chlowell follow the above steps to test for go. When we reached step 6:
Add command Through investigation, after clone the code, switch to For Azure VM MSI testing for go, can we refer to Azure Arc testing to update testing instructions? |
Hi @jianghaolu, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support. |
@joshfree This issue has been closed. Do we need to continue testing this |
We need to automate the way we run tests. The steps to run MSI tests in VM for the identity component are as follows:
prerequisite tools
Azure resources
This test requires instances of these Azure resources:
Initial Setup:
PLEASE NOTE: This setup is Java specific since it installs the Java & Maven environments. Other languages will have a different set up.
Set environment variables to simplify copy-pasting
Create resources
to create a VM with system assigned identity.
2. Create a user identity for the second VM:
Get the identity resource id
and then create a VM with this identity assigned:
Get the principal ID for the VM with system assigned identity:
Allow the VM with system assigned identity to access the key vault secrets:
Get the principal ID for the VM with user assigned identity:
Allow the VM with user assigned identity to access the key vault secrets:
Add a secret called "secret":
Install Java & Maven on VMs
Run on both VMs:
Run tests
Run on both VMs:
On the VM with system assigned identity:
On the VM with user assigned identity:
To find the identity's client id
Boths result should be printed showing
The text was updated successfully, but these errors were encountered: