Skip to content
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

While using "begin_create_or_update" getting error related to location property #35532

Closed
mehulrjangale opened this issue May 8, 2024 · 10 comments
Assignees
Labels
Compute customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@mehulrjangale
Copy link

Type of issue

Code doesn't work

Description

[Enter feedback here]
I'm using azure-mgmt-compute==30.4.0 and above version. I'm facing the following issue. I tried to add the location parameter manually, but that doesn't work either. The document doesn't call it out clearly.

_Failed
Traceback (most recent call last):
File "/usr/src/tmp/acbbf3f2-fbdc-4ecf-b209-00c26e01e385/runbooks/rotateVm.py", line 42, in
compute_client.virtual_machines.begin_create_or_update(resource_group_name, vm_name, update_vm)
File "C:\userenv\lib\site-packages\azure\core\tracing\decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "C:\userenv\lib\site-packages\azure\mgmt\compute\v2024_03_01\operations_operations.py", line 15291, in begin_create_or_update
raw_result = self._create_or_update_initial(
File "C:\userenv\lib\site-packages\azure\mgmt\compute\v2024_03_01\operations_operations.py", line 15158, in create_or_update_initial
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (LocationRequired) The location property is required for this definition.
Code: LocationRequired
Message: The location property is required for this definition.

Page URL

https://learn.microsoft.com/en-us/python/api/overview/azure/mgmt-compute-readme?view=azure-python

Content source URL

https://github.com/MicrosoftDocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-compute-readme.md

Document Version Independent Id

c377eb24-55a2-545b-6b53-ba4d375c4134

Article author

@azure-sdk

Metadata

  • ID: c21ea709-4437-2046-f254-acaba8943cb4
  • Service: compute
@github-actions github-actions bot added Compute customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. labels May 8, 2024
Copy link

github-actions bot commented May 8, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @amjads1 @avirishuv @Drewm3 @Vaibhav-Agar.

@swathipil
Copy link
Member

swathipil commented May 8, 2024

Hi @mehulrjangale - It looks like the parameters parameter of begin_create_or_update takes either an IO[bytes] or VirtualMachine.

VirtualMachine takes location as a required keyword argument.

The argument update_vm passed in to parameters should include location. Example.

Thanks!

@swathipil swathipil added needs-author-feedback More information is needed from author to address the issue. and removed needs-team-attention This issue needs attention from Azure service team or SDK team labels May 8, 2024
Copy link

github-actions bot commented May 8, 2024

Hi @mehulrjangale. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@mehulrjangale
Copy link
Author

Hi @swathipil,

I've the following code:

vm.os_profile.admin_password = new_password
**update_vm** = **VirtualMachineUpdate**(os_profile=vm.os_profile)
compute_client.virtual_machines.begin_create_or_update(resource_group_name, vm_name, update_vm)

The problem is I think VirtualMachineUpdate does not have location parameter.
[https://learn.microsoft.com/en-us/python/api/azure-mgmt-compute/azure.mgmt.compute.v2024_03_01.models.virtualmachineupdate?view=azure-python]

@github-actions github-actions bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels May 9, 2024
@TravisCragg-MSFT TravisCragg-MSFT removed the Service Attention This issue is responsible by Azure service team. label May 9, 2024
@ChenxiJiang333
Copy link
Member

Hi @swathipil,

I've the following code:

vm.os_profile.admin_password = new_password
**update_vm** = **VirtualMachineUpdate**(os_profile=vm.os_profile)
compute_client.virtual_machines.begin_create_or_update(resource_group_name, vm_name, update_vm)

The problem is I think VirtualMachineUpdate does not have location parameter. [https://learn.microsoft.com/en-us/python/api/azure-mgmt-compute/azure.mgmt.compute.v2024_03_01.models.virtualmachineupdate?view=azure-python]

Hi, please use the model VirtualMachine instead of VirtualMachineUpdate

from azure.mgmt.compute.models import VirtualMachine
update_vm = VirtualMachine(location="eastus", tags={'1':'2'})

@mehulrjangale
Copy link
Author

@ChenxiJiang333 @swathipil Will it work if I want to update the VM ?

@ChenxiJiang333
Copy link
Member

@ChenxiJiang333 @swathipil Will it work if I want to update the VM ?

It works for both to create or update the VM.

@mehulrjangale
Copy link
Author

It worked, thanks!

@swathipil swathipil added issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. and removed needs-team-attention This issue needs attention from Azure service team or SDK team labels May 11, 2024
Copy link

Hi @mehulrjangale. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

Copy link

Hi @mehulrjangale, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compute customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

5 participants