The role of rules...

Practically speaking- rules are often the centerpiece of religious life... many people think the Ten Commandments are rules that make a relationship with God possible...in other words- if you follow the rules God will be happy- if you don't- He won't... but what if a relationship with God doesn't depend on our rule keeping? So when it comes to our relationship with God- what is the role of rules?