I know more about the intelligence relationship (I was actually writing about it in another AH thread just the other day), so I'll stick to that and let someone else field the military question. To paraphrase/expand on what I wrote in that linked comment:
The Stasi-KGB relationship was close, to say the very least. The Soviet occupation forces were heavily involved in the creation of the DDR's state institutions, but they were particularly influential in the development of the MfS — the Ministry for State Security, which we know as the Stasi.
The KGB (and its predecessor agencies, NKVD and MGB) exercised significant control over the Stasi from its founding in 1950 — staffed by German communists with Soviet 'instructors' — and throughout the Cold War. From 1957, the Stasi was nominally operationally independent — but the Lubyanka retainedsignificant strategic and operational influence over the ministry for decades to come.
Many of the Stasi's most prominent figures had long-standing ties to Soviet intelligence dating back prior to the Second World War: the first Minister of State Security, Wilhelm Zaisser, had been an agent of the Soviet military intelligence agency GRU; his successors, Ernst Wollweber and the notorious Erich Mielke, had both been NKVD operatives; Markus Wolf, the Stasi's renowned foreign intelligence chief, was an agent of the Comintern.
The Stasi did operate autonomously, and its primary purpose was to be a weapon of its political masters in the ruling SED, but essentially all of the Warsaw Pact intelligence services operated to one degree or another under the aegis of the KGB.
Most frequently, they functioned as client agencies feeding intelligence to Moscow or acting as KGB adjuncts for large-scale or complex intelligence operations, especially those spanning multiple countries. Other times, they were used as proxies or deniable weapons of the KGB; the Bulgarian CSS was a particular favourite for 'active measures' operations, for example.
But even in that context, the relationship between KGB and Stasi was unusually close: the KGB stationed liaison officers in each Stasi directorate, and had effective carte blanche to carry out espionage operations in the DDR. More to the point, it was a highly productive source of intelligence for the KGB: in The Sword and the Shield, Christopher Andrew refers to documents from the Mitrokhin Archive which suggest that "in 1975 65 percent of all reports from Soviet Bloc security services received by the [Moscow] Centre came from the Stasi."
In 1978, the two agencies signed a cooperation agreement codifying this relationship, but that document can essentially be read as a reaffirmation of Soviet intelligence's far-reaching influence and effective operational impunity in East Germany.
The Wilson Center's Cold War International History Project has some fascinating documents on intelligence collaboration between the two agencies. Alongside that, and the Andrew history of the KGB I linked to above, I'd also look at The Firm: The Inside Story of the Stasi by Gary Bruce. The office of the Federal Commissioner for the Records of the State Security Service of the former GDR, which administers the Stasi archives, also has a lot of information about the agency on their website.