Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug: StorageAccount is not storing credentials as a secret #913

Closed
cnadolny opened this issue Apr 9, 2020 · 7 comments · Fixed by #1004
Closed

Bug: StorageAccount is not storing credentials as a secret #913

cnadolny opened this issue Apr 9, 2020 · 7 comments · Fixed by #1004
Assignees
Labels
bug 🪲 Something isn't working

Comments

@cnadolny
Copy link
Contributor

cnadolny commented Apr 9, 2020

Describe the bug
We currently do not store credentials for the storage account. We should store those in a secret, and remove the StorageOutput struct, which is not being used either.

type StorageOutput struct {
	StorageAccountName string `json:"storageAccountName,omitempty"`
	Key1               string `json:"key1,omitempty"`
	Key2               string `json:"key2,omitempty"`
	ConnectionString1  string `json:"connectionString1,omitempty"`
	ConnectionString2  string `json:"connectionString2,omitempty"`
}

To Reproduce
Steps to reproduce the behavior:
Create SA, no secret is created

Expected behavior
When creating a storage account, a secret should be created with credentials for connecting to the storage account, with the following fields:

	StorageAccountName string `json:"storageAccountName,omitempty"`
	Key1               string `json:"key1,omitempty"`
	Key2               string `json:"key2,omitempty"`
	ConnectionString1  string `json:"connectionString1,omitempty"`
	ConnectionString2  string `json:"connectionString2,omitempty"`

Completion Criteria

  • Secret is created with credentials
  • StorageOutput struct is removed from types.go
  • Docs are updated with secret information
@cnadolny cnadolny added the bug 🪲 Something isn't working label Apr 9, 2020
@jananivMS jananivMS added the S label Apr 10, 2020
@WilliamMortlMicrosoft WilliamMortlMicrosoft self-assigned this Apr 13, 2020
@WilliamMortlMicrosoft
Copy link
Contributor

@frodopwns Blocked until Mel's PR goes through - as per @jananivMS 's instructions

@WilliamMortlMicrosoft
Copy link
Contributor

Will likely get back to work on this on Tuesday 4/14

@WilliamMortlMicrosoft
Copy link
Contributor

remove structs from storageaccount_types.go

@WilliamMortlMicrosoft
Copy link
Contributor

line 169 on hub.go... Upsert

@WilliamMortlMicrosoft
Copy link
Contributor

@cnadolny quick question... I haven't work in this area of code yet... can you tell me what function / struct that:

	StorageAccountName string `json:"storageAccountName,omitempty"`
	Key1               string `json:"key1,omitempty"`
	Key2               string `json:"key2,omitempty"`
	ConnectionString1  string `json:"connectionString1,omitempty"`
	ConnectionString2  string `json:"connectionString2,omitempty"`

are obtained from? Thanks! :-)

@jananivMS
Copy link
Contributor

@WilliamMortlMicrosoft You'll need to call the ListKeys method on the storage account for the keys
https://godoc.org/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage#AccountsClient.ListKeys

And you will need to construct the connection string using the below format
DefaultEndpointsProtocol=https;AccountName=;AccountKey===;EndpointSuffix=<ENVIRONMENT_SPECIFIC_SUFFIX>

ENVIRONMENT_SPECIFIC_SUFFIX can be gotten in the code using resourcemanagerconfig.Environment().StorageEndpointSuffix

@WilliamMortlMicrosoft
Copy link
Contributor

Thanks so much @jananivMS !!!!! Where did you find that? :-)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants