noelbundick / azssh Goto Github PK
View Code? Open in Web Editor NEWConnect to Azure Cloud Shell from a terminal
License: MIT License
Connect to Azure Cloud Shell from a terminal
License: MIT License
The REST APIs are undocumented and are restricted to specific clientId's (ex: VS Code extension can use them, but azure-cli can't)
I'd like to use my own instead of stealing VS Code's, but that's blocked until those issues are resolved
Need to run the following and restart the Console window, otherwise garbage color codes get spewed to the screen
Set-ItemProperty HKCU:\Console VirtualTerminalLevel -Type DWORD 1
Launch a local webserver on port N, let the redirect flow send you back to localhost to get the token instead of copy/pasting codes
It hangs if you leave it open for a while - ctrl+c doesn't work since I'm intercepting SIGINT
Maybe two things:
~.
) - or something unlikely to be used ctrl+q, ctrl+c
or whateverCode goes here
% ./azssh
Requesting a Cloud Shell.
Connecting terminal...
stephane@Azure:~$ exit
exit
panic: repeated read on failed websocket connection
goroutine 31 [running]:
github.com/gorilla/websocket.(*Conn).NextReader(0xc0003d8f20, 0x0, 0xc000078000, 0x0, 0x0, 0x0)
/home/stephane/go/src/github.com/gorilla/websocket/conn.go:968 +0x356
github.com/gorilla/websocket.(*Conn).ReadMessage(0xc0003d8f20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/stephane/go/src/github.com/gorilla/websocket/conn.go:1029 +0x2f
github.com/noelbundick/azssh/pkg/azssh.pumpOutput(0xc0003d8f20, 0xa5bc40, 0xc00000c018)
/home/stephane/go/src/github.com/noelbundick/azssh/pkg/azssh/terminal.go:26 +0x6c
created by github.com/noelbundick/azssh/pkg/azssh.ConnectToWebsocket
/home/stephane/go/src/github.com/noelbundick/azssh/pkg/azssh/terminal.go:79 +0x1c2
Right now every launch generates/consumes a new code, which is a total pain
When tokens + refresh tokens are expired, azssh blows up with a terrible wrong error message:
Requesting a Cloud Shell.
map[error:map[code:AuthenticationFailed message:Authentication failed.]]panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 1 [running]:
github.com/noelbundick/azssh/pkg/azssh.createConsole(0xc42031c000, 0x2d54, 0xc420299bf8, 0x83cd18)
/mnt/c/code/go/src/github.com/noelbundick/azssh/pkg/azssh/cloudshell.go:43 +0x1ef
github.com/noelbundick/azssh/pkg/azssh.ProvisionCloudShell(0xc42031c000, 0x2d54, 0x9c3975, 0x4, 0x78, 0x84, 0xc4200d41e0, 0x870b80, 0xc4202c9c88)
/mnt/c/code/go/src/github.com/noelbundick/azssh/pkg/azssh/cloudshell.go:65 +0x4d
github.com/noelbundick/azssh/cmd.glob..func1(0xcf3000, 0xd1bc48, 0x0, 0x0)
/mnt/c/code/go/src/github.com/noelbundick/azssh/cmd/root.go:20 +0xae
github.com/spf13/cobra.(*Command).execute(0xcf3000, 0xc42001e1b0, 0x0, 0x0, 0xcf3000, 0xc42001e1b0)
/mnt/c/code/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xcf3000, 0x9edc70, 0xc4202c9f40, 0xc4202c9f30)
/mnt/c/code/go/src/github.com/spf13/cobra/command.go:850 +0x306
github.com/spf13/cobra.(*Command).Execute(0xcf3000, 0xc4200ea0f0, 0xc4202c9f40)
/mnt/c/code/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/noelbundick/azssh/cmd.Execute()
/mnt/c/code/go/src/github.com/noelbundick/azssh/cmd/root.go:32 +0x2d
main.main()
/mnt/c/code/go/src/github.com/noelbundick/azssh/main.go:14 +0x4b
exit status 2
I want ctrl+c to be passed to cloud shell, and then have some other keystroke to exit azssh
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.