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

Bastion Host creation returns InvalidRequestFormat #5233

Closed
DanielMabbett opened this issue Jul 12, 2019 · 7 comments
Closed

Bastion Host creation returns InvalidRequestFormat #5233

DanielMabbett opened this issue Jul 12, 2019 · 7 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. Network - Bastion Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@DanielMabbett
Copy link

Bug Report

Bastion Host creation returns InvalidRequestFormat

  • import path of package in question, e.g. .../services/compute/mgmt/2019-04-01/network

  • SDK version e.g. latest

  • output of go version

  • What happened?
    When using the bastionHostsClient.CreateOrUpdate() function, you see an error:

Network.BastionHostsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidRequestFormat" Message="Cannot parse the request." Details=[]

When I marshalled the JSON, it was noticeable that the "Name" property for the BastionHostIPConfiguration was not being returned.

IPConfigurations: &[]network.BastionHostIPConfiguration{
	{
		Name: to.StringPtr("ipconf"),
		BastionHostIPConfigurationPropertiesFormat: &network.BastionHostIPConfigurationPropertiesFormat{
			Subnet: &network.SubResource{
				ID: to.StringPtr("/subscriptions/4b89b857-a820-4f5e-b02a-da6d5e180752/resourceGroups/rg-testing-bastion-02/providers/Microsoft.Network/virtualNetworks/myvnettests01/subnets/AzureBastionSubnet"),
			},
			PublicIPAddress: &network.SubResource{ID: to.StringPtr("/subscriptions/4b89b857-a820-4f5e-b02a-da6d5e180752/resourceGroups/rg-testing-bastion-02/providers/Microsoft.Network/publicIPAddresses/asfwgegr")},
		},
	},
},

Looking into this further, it seems the Azure Management API is looking for this Name value. So it needs to NOT BE "READ ONLY" like the code suggests, and it needs to marshalled in.

  • What did you expect or want to happen?
  • The "Name" property to be marshalled into the json for the API request
  • This API request to then cause a successful creation for a Bastion Host.
  • How can we reproduce it?
  • You can install the SDK's latest version, create you own bastionHost and marshal it to JSON to see the cause of the issue.
  • You can also then use:
bastionHostsClient.CreateOrUpdate() to see the entire failure due to this issue
  • Anything we should know about your environment.
    None.
@kurtzeborn kurtzeborn added customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. Network Service Attention Workflow: This issue is responsible by Azure service team. and removed triage labels Jul 15, 2019
@kurtzeborn
Copy link
Member

Thank you for opening this issue. I've routed it to the appropriate team that I think can help investigate it for you.

@ashjain
Copy link

ashjain commented Aug 5, 2019

Hi Daniel, I am a PM from the Azure Bastion team. Thank you for reporting the issue. We will take a look and circle back.

@DanielMabbett
Copy link
Author

Thanks for looking guys. I tried to raise a PR about it with the fix. This may help your team:
1f064ee

@msabansal
Copy link

@DanielMabbett I would have to look into this but these files should be auto-generated from our swagger specs. The swagger specs have these correct https://github.com/Azure/azure-rest-api-specs/blob/master/specification/network/resource-manager/Microsoft.Network/stable/2019-06-01/bastionHost.json

@ArcturusZhang
Copy link
Member

@DanielMabbett Is this issue resolved? Since the Name property in IPConfigurations is not read-only now, it should be unmarshalled properly.

@DanielMabbett
Copy link
Author

DanielMabbett commented Aug 8, 2019

Forgive this post. I just needed to run go get github.com/Azure/go-autorest/autorest.

I will check and get back to you.

@DanielMabbett
Copy link
Author

This is working now! Many thanks everyone for your help on this. Please close

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. Network - Bastion Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

6 participants