Controller Support. Left Axis. How to code in C#?

I’ve programmed jumping and shooting into my game using Joystick button 0 and Joystick button 2. But I can’t figure out how to make the player move left and right. Its a 2d game so all I need is the left analog stick to work for moving left and right. I know how to put it into unitys project inputs but not how to actually code it.

This is what my code looks like right now.

if(Input.GetKey("a") || Input.GetKey("left") ||Input.GetAxis("Xbox_Joystick_X-Axis")){
	if(rigidbody.velocity.x > 0){
		rigidbody.velocity.x = 0;
	}
	if(rigidbody.velocity.x > -walkSpeed){
		rigidbody.velocity.x -= 48*Time.deltaTime;
	}
}
if(Input.GetKey("d")|| Input.GetKey("right") || Input.GetAxis("Xbox_Joystick_X-Axis")){
	if(rigidbody.velocity.x < 0){
		rigidbody.velocity.x = 0;
	}
	if(rigidbody.velocity.x < walkSpeed){
		rigidbody.velocity.x += 48*Time.deltaTime;
	}
}

Obviously this is pretty wrong, I’m just really not sure how to do it.

https://unity3d.com/learn/tutorials/modules/beginner/scripting/get-axis