diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 32066b7b8500..395b69c37137 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -1,6597 +1,6629 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Common/Commands.Common.Authentication/Authentication/AadAuthenticationException.cs b/src/Common/Commands.Common.Authentication/Authentication/AadAuthenticationException.cs new file mode 100644 index 000000000000..7fc5cf31504f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/AadAuthenticationException.cs @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// Base class representing an exception that occurs when + /// authenticating against Azure Active Directory + /// + [Serializable] + public abstract class AadAuthenticationException : Exception + { + protected AadAuthenticationException() + { + } + + protected AadAuthenticationException(string message) : base(message) + { + } + + protected AadAuthenticationException(string message, Exception innerException) : base(message, innerException) + { + } + } + + /// + /// Exception that gets thrown when the user explicitly + /// cancels an authentication operation. + /// + [Serializable] + public class AadAuthenticationCanceledException : AadAuthenticationException + { + public AadAuthenticationCanceledException(string message, Exception innerException) : base(message, innerException) + { + } + } + + /// + /// Exception that gets thrown when the ADAL library + /// is unable to authenticate without a popup dialog. + /// + [Serializable] + public class AadAuthenticationFailedWithoutPopupException : AadAuthenticationException + { + public AadAuthenticationFailedWithoutPopupException(string message, Exception innerException) + : base(message, innerException) + { + } + } + + /// + /// Exception that gets thrown if an authentication operation + /// fails on the server. + /// + [Serializable] + public class AadAuthenticationFailedException : AadAuthenticationException + { + public AadAuthenticationFailedException(string message, Exception innerException) : base(message, innerException) + { + } + } + + /// + /// Exception thrown if a refresh token has expired. + /// + [Serializable] + public class AadAuthenticationCantRenewException : AadAuthenticationException + { + public AadAuthenticationCantRenewException() + { + } + + public AadAuthenticationCantRenewException(string message) : base(message) + { + } + + public AadAuthenticationCantRenewException(string message, Exception innerException) : base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Authentication/AccessTokenCredential.cs b/src/Common/Commands.Common.Authentication/Authentication/AccessTokenCredential.cs new file mode 100644 index 000000000000..8d4b20a3eb1c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/AccessTokenCredential.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public class AccessTokenCredential : SubscriptionCloudCredentials + { + private readonly Guid subscriptionId; + private readonly IAccessToken token; + + public AccessTokenCredential(Guid subscriptionId, IAccessToken token) + { + this.subscriptionId = subscriptionId; + this.token = token; + this.TenantID = token.TenantId; + } + + public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + token.AuthorizeRequest((tokenType, tokenValue) => { + request.Headers.Authorization = new AuthenticationHeaderValue(tokenType, tokenValue); + }); + return base.ProcessHttpRequestAsync(request, cancellationToken); + } + + public override string SubscriptionId + { + get { return subscriptionId.ToString(); } + } + + public string TenantID { get; set; } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Authentication/AdalConfiguration.cs b/src/Common/Commands.Common.Authentication/Authentication/AdalConfiguration.cs new file mode 100644 index 000000000000..fab3702cd45c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/AdalConfiguration.cs @@ -0,0 +1,63 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// Class storing the configuration information needed + /// for ADAL to request token from the right AD tenant + /// depending on environment. + /// + public class AdalConfiguration + { + // + // These constants define the default values to use for AD authentication + // against RDFE + // + public const string PowerShellClientId = "1950a258-227b-4e31-a9cf-717495945fc2"; + + public static readonly Uri PowerShellRedirectUri = new Uri("urn:ietf:wg:oauth:2.0:oob"); + + // ID for site to pass to enable EBD (email-based differentiation) + // This gets passed in the call to get the azure branding on the + // login window. Also adding popup flag to handle overly large login windows. + public const string EnableEbdMagicCookie = "site_id=501358&display=popup"; + + public string AdEndpoint { get;set; } + + public bool ValidateAuthority { get; set; } + + public string AdDomain { get; set; } + + public string ClientId { get; set; } + + public Uri ClientRedirectUri { get; set; } + + public string ResourceClientUri { get; set; } + + public TokenCache TokenCache { get; set; } + + public AdalConfiguration() + { + ClientId = PowerShellClientId; + ClientRedirectUri = PowerShellRedirectUri; + ValidateAuthority = true; + AdEndpoint = string.Empty; + ResourceClientUri = "https://management.core.windows.net/"; + } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Authentication/AdalTokenProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/AdalTokenProvider.cs new file mode 100644 index 000000000000..b8bb95f780f7 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/AdalTokenProvider.cs @@ -0,0 +1,68 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using System; +using System.Security; +using System.Windows.Forms; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// A token provider that uses ADAL to retrieve + /// tokens from Azure Active Directory + /// + public class AdalTokenProvider : ITokenProvider + { + private readonly ITokenProvider userTokenProvider; + private readonly ITokenProvider servicePrincipalTokenProvider; + + public AdalTokenProvider() + : this(new ConsoleParentWindow()) + { + } + + public AdalTokenProvider(IWin32Window parentWindow) + { + this.userTokenProvider = new UserTokenProvider(parentWindow); + servicePrincipalTokenProvider = new ServicePrincipalTokenProvider(); + } + + public IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, SecureString password, + AzureAccount.AccountType credentialType) + { + switch (credentialType) + { + case AzureAccount.AccountType.User: + return userTokenProvider.GetAccessToken(config, promptBehavior, userId, password, credentialType); + case AzureAccount.AccountType.ServicePrincipal: + return servicePrincipalTokenProvider.GetAccessToken(config, promptBehavior, userId, password, credentialType); + default: + throw new ArgumentException(Resources.UnknownCredentialType, "credentialType"); + } + } + + public IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string clientId, string certificate, AzureAccount.AccountType credentialType) + { + switch (credentialType) + { + case AzureAccount.AccountType.ServicePrincipal: + return servicePrincipalTokenProvider.GetAccessTokenWithCertificate(config, clientId, certificate, credentialType); + default: + throw new ArgumentException(string.Format(Resources.UnsupportedCredentialType, credentialType), "credentialType"); + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/CertificateApplicationCredentialProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/CertificateApplicationCredentialProvider.cs new file mode 100644 index 000000000000..0de1ad9d82e2 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/CertificateApplicationCredentialProvider.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest.Azure.Authentication; +using System.Security; +using System.Security.Cryptography.X509Certificates; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// Interface to the certificate store for authentication + /// + internal sealed class CertificateApplicationCredentialProvider : IApplicationAuthenticationProvider + { + private string _certificateThumbprint; + + /// + /// Create a certificate provider + /// + /// + public CertificateApplicationCredentialProvider(string certificateThumbprint) + { + this._certificateThumbprint = certificateThumbprint; + } + + /// + /// Authenticate using certificate thumbprint from the datastore + /// + /// The active directory client id for the application. + /// The intended audience for authentication + /// The AD AuthenticationContext to use + /// + public async Task AuthenticateAsync(string clientId, string audience, AuthenticationContext context) + { + var task = new Task(() => + { + return AzureSession.DataStore.GetCertificate(this._certificateThumbprint); + }); + task.Start(); + var certificate = await task.ConfigureAwait(false); + + return await context.AcquireTokenAsync( + audience, + new ClientAssertionCertificate(clientId, certificate)); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/ConsoleParentWindow.cs b/src/Common/Commands.Common.Authentication/Authentication/ConsoleParentWindow.cs new file mode 100644 index 000000000000..6ee81dca2270 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/ConsoleParentWindow.cs @@ -0,0 +1,35 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// An implementation of that gives the + /// windows handle for the current console window. + /// + public class ConsoleParentWindow : IWin32Window + { + public IntPtr Handle { get { return NativeMethods.GetConsoleWindow(); } } + + static class NativeMethods + { + [DllImport("kernel32.dll")] + public static extern IntPtr GetConsoleWindow(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/CredStore.cs b/src/Common/Commands.Common.Authentication/Authentication/CredStore.cs new file mode 100644 index 000000000000..ca23ed3e6a2e --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/CredStore.cs @@ -0,0 +1,114 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Runtime.ConstrainedExecution; +using System.Runtime.InteropServices; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// Class wrapping PInvoke signatures for Windows Credential store + /// + internal static class CredStore + { + internal enum CredentialType + { + Generic = 1, + } + + internal static class NativeMethods + { + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredRead( + string targetName, + CredentialType type, + int flags, + [Out] out IntPtr pCredential + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredEnumerate( + string targetName, + int flags, + [Out] out int count, + [Out] out IntPtr pCredential + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredDelete( + string targetName, + CredentialType type, + int flags + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredWrite( + IntPtr pCredential, + int flags + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredFree( + IntPtr pCredential + ); + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable", Justification = "Wrapper for native struct")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct Credential + { + public Credential(string userName, string key, string value) + { + this.flags = 0; + this.type = CredentialType.Generic; + + // set the key in the targetName + this.targetName = key; + + this.targetAlias = null; + this.comment = null; + this.lastWritten.dwHighDateTime = 0; + this.lastWritten.dwLowDateTime = 0; + + // set the value in credentialBlob. + this.credentialBlob = Marshal.StringToHGlobalUni(value); + this.credentialBlobSize = (uint)((value.Length + 1) * 2); + + this.persist = 1; + this.attibuteCount = 0; + this.attributes = IntPtr.Zero; + this.userName = userName; + } + + internal uint flags; + internal CredentialType type; + internal string targetName; + internal string comment; + internal System.Runtime.InteropServices.ComTypes.FILETIME lastWritten; + internal uint credentialBlobSize; + internal IntPtr credentialBlob; + internal uint persist; + internal uint attibuteCount; + internal IntPtr attributes; + internal string targetAlias; + internal string userName; + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/IAccessToken.cs b/src/Common/Commands.Common.Authentication/Authentication/IAccessToken.cs new file mode 100644 index 000000000000..c295a151a318 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/IAccessToken.cs @@ -0,0 +1,31 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public interface IAccessToken + { + void AuthorizeRequest(Action authTokenSetter); + + string AccessToken { get; } + + string UserId { get; } + + string TenantId { get; } + + LoginType LoginType { get; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/ITokenProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/ITokenProvider.cs new file mode 100644 index 000000000000..5819708309a1 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/ITokenProvider.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; +using System.Security; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// This interface represents objects that can be used + /// to obtain and manage access tokens. + /// + public interface ITokenProvider + { + /// + /// Get a new login token for the given environment, user credential, + /// and credential type. + /// + /// Configuration. + /// Prompt behavior. + /// User ID/Service principal to get the token for. + /// Secure strings with password/service principal key. + /// Credential type. + /// An access token. + IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, + SecureString password, AzureAccount.AccountType credentialType); + + /// + /// Get a new authentication token for the given environment + /// + /// The ADAL Configuration + /// The id for the given principal + /// The certificate thumbprint for this user + /// The account type + /// An access token, which can be renewed + IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string principalId, string certificateThumbprint, + AzureAccount.AccountType credentialType); + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/KeyStoreApplicationCredentialProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/KeyStoreApplicationCredentialProvider.cs new file mode 100644 index 000000000000..bf9a55c6e3a4 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/KeyStoreApplicationCredentialProvider.cs @@ -0,0 +1,57 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest.Azure.Authentication; +using System.Security; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// Interface to the keystore for authentication + /// + internal sealed class KeyStoreApplicationCredentialProvider : IApplicationAuthenticationProvider + { + private string _tenantId; + + /// + /// Create a credential provider + /// + /// + public KeyStoreApplicationCredentialProvider(string tenant) + { + this._tenantId = tenant; + } + + /// + /// Authenticate using the secret for the specified client from the key store + /// + /// The active directory client id for the application. + /// The intended audience for authentication + /// The AD AuthenticationContext to use + /// + public async Task AuthenticateAsync(string clientId, string audience, AuthenticationContext context) + { + var task = new Task(() => + { + return ServicePrincipalKeyStore.GetKey(clientId, _tenantId); + }); + task.Start(); + var key = await task.ConfigureAwait(false); + + return await context.AcquireTokenAsync(audience, new ClientCredential(clientId, key)); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/LoginType.cs b/src/Common/Commands.Common.Authentication/Authentication/LoginType.cs new file mode 100644 index 000000000000..16c96a77657f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/LoginType.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public enum LoginType + { + /// + /// User is logging in with orgid credentials + /// + OrgId, + + /// + /// User is logging in with liveid credentials + /// + LiveId + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/ProtectedFileTokenCache.cs b/src/Common/Commands.Common.Authentication/Authentication/ProtectedFileTokenCache.cs new file mode 100644 index 000000000000..5846aa750614 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/ProtectedFileTokenCache.cs @@ -0,0 +1,121 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.IO; +using System.Security.Cryptography; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// An implementation of the Adal token cache that stores the cache items + /// in the DPAPI-protected file. + /// + public class ProtectedFileTokenCache : TokenCache + { + private static readonly string CacheFileName = Path.Combine(AzureSession.ProfileDirectory, AzureSession.TokenCacheFile); + + private static readonly object fileLock = new object(); + + private static readonly Lazy instance = new Lazy(() => new ProtectedFileTokenCache()); + + // Initializes the cache against a local file. + // If the file is already present, it loads its content in the ADAL cache + private ProtectedFileTokenCache() + { + Initialize(CacheFileName); + } + + private void Initialize(string fileName) + { + AfterAccess = AfterAccessNotification; + BeforeAccess = BeforeAccessNotification; + lock (fileLock) + { + if (AzureSession.DataStore.FileExists(fileName)) + { + var existingData = AzureSession.DataStore.ReadFileAsBytes(fileName); + if (existingData != null) + { + try + { + Deserialize(ProtectedData.Unprotect(existingData, null, DataProtectionScope.CurrentUser)); + } + catch (CryptographicException) + { + AzureSession.DataStore.DeleteFile(fileName); + } + } + } + } + } + + public ProtectedFileTokenCache(string cacheFile) + { + Initialize(cacheFile); + } + + // Empties the persistent store. + public override void Clear() + { + base.Clear(); + if (AzureSession.DataStore.FileExists(CacheFileName)) + { + AzureSession.DataStore.DeleteFile(CacheFileName); + } + } + + // Triggered right before ADAL needs to access the cache. + // Reload the cache from the persistent store in case it changed since the last access. + void BeforeAccessNotification(TokenCacheNotificationArgs args) + { + lock (fileLock) + { + if (AzureSession.DataStore.FileExists(CacheFileName)) + { + var existingData = AzureSession.DataStore.ReadFileAsBytes(CacheFileName); + if (existingData != null) + { + try + { + Deserialize(ProtectedData.Unprotect(existingData, null, DataProtectionScope.CurrentUser)); + } + catch (CryptographicException) + { + AzureSession.DataStore.DeleteFile(CacheFileName); + } + } + } + } + } + + // Triggered right after ADAL accessed the cache. + void AfterAccessNotification(TokenCacheNotificationArgs args) + { + // if the access operation resulted in a cache update + if (HasStateChanged) + { + lock (fileLock) + { + // reflect changes in the persistent store + AzureSession.DataStore.WriteFile(CacheFileName, + ProtectedData.Protect(Serialize(), null, DataProtectionScope.CurrentUser)); + // once the write operation took place, restore the HasStateChanged bit to false + HasStateChanged = false; + } + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalKeyStore.cs b/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalKeyStore.cs new file mode 100644 index 000000000000..4229221d763c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalKeyStore.cs @@ -0,0 +1,117 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Runtime.InteropServices; +using System.Security; +using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// Helper class to store service principal keys and retrieve them + /// from the Windows Credential Store. + /// + public static class ServicePrincipalKeyStore + { + private const string keyStoreUserName = "PowerShellServicePrincipalKey"; + private const string targetNamePrefix = "AzureSession:target="; + + public static void SaveKey(string appId, string tenantId, SecureString serviceKey) + { + var credential = new CredStore.NativeMethods.Credential + { + flags = 0, + type = CredStore.CredentialType.Generic, + targetName = CreateKey(appId, tenantId), + targetAlias = null, + comment = null, + lastWritten = new FILETIME {dwHighDateTime = 0, dwLowDateTime = 0}, + persist = 2, // persist on local machine + attibuteCount = 0, + attributes = IntPtr.Zero, + userName = keyStoreUserName + }; + + // Pull bits out of SecureString to put in credential + IntPtr credPtr = IntPtr.Zero; + try + { + credential.credentialBlob = Marshal.SecureStringToGlobalAllocUnicode(serviceKey); + credential.credentialBlobSize = (uint)(serviceKey.Length * Marshal.SystemDefaultCharSize); + + int size = Marshal.SizeOf(credential); + credPtr = Marshal.AllocHGlobal(size); + + Marshal.StructureToPtr(credential, credPtr, false); + CredStore.NativeMethods.CredWrite(credPtr, 0); + } + finally + { + if (credPtr != IntPtr.Zero) + { + Marshal.FreeHGlobal(credPtr); + } + + Marshal.ZeroFreeGlobalAllocUnicode(credential.credentialBlob); + } + } + + public static SecureString GetKey(string appId, string tenantId) + { + IntPtr pCredential = IntPtr.Zero; + try + { + if (CredStore.NativeMethods.CredRead( + CreateKey(appId, tenantId), + CredStore.CredentialType.Generic, 0, + out pCredential)) + { + var credential = (CredStore.NativeMethods.Credential) + Marshal.PtrToStructure(pCredential, typeof (CredStore.NativeMethods.Credential)); + unsafe + { + return new SecureString((char*) (credential.credentialBlob), + (int)(credential.credentialBlobSize/Marshal.SystemDefaultCharSize)); + } + } + return null; + } + catch + { + // we could be running in an environment that does not have credentials store + } + finally + { + if (pCredential != IntPtr.Zero) + { + CredStore.NativeMethods.CredFree(pCredential); + } + } + + return null; + } + + + public static void DeleteKey(string appId, string tenantId) + { + CredStore.NativeMethods.CredDelete(CreateKey(appId, tenantId), CredStore.CredentialType.Generic, 0); + } + + private static string CreateKey(string appId, string tenantId) + { + return string.Format("{0}AppId={1};Tenant={2}", targetNamePrefix, appId, tenantId); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalTokenProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalTokenProvider.cs new file mode 100644 index 000000000000..bd1a6c8c6e01 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalTokenProvider.cs @@ -0,0 +1,166 @@ +// ---------------------------------------------------------------------------------- +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.Collections.Generic; +using System.Security; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + internal class ServicePrincipalTokenProvider : ITokenProvider + { + private static readonly TimeSpan expirationThreshold = TimeSpan.FromMinutes(5); + + public IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, SecureString password, + AzureAccount.AccountType credentialType) + { + if (credentialType == AzureAccount.AccountType.User) + { + throw new ArgumentException(string.Format(Resources.InvalidCredentialType, "User"), "credentialType"); + } + return new ServicePrincipalAccessToken(config, AcquireTokenWithSecret(config, userId, password), this.RenewWithSecret, userId); + } + + public IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string clientId, string certificateThumbprint, AzureAccount.AccountType credentialType) + { + if (credentialType == AzureAccount.AccountType.User) + { + throw new ArgumentException(string.Format(Resources.InvalidCredentialType, "User"), "credentialType"); + } + return new ServicePrincipalAccessToken(config, AcquireTokenWithCertificate(config, clientId, certificateThumbprint), + (adalConfig, appId) => this.RenewWithCertificate(adalConfig, appId, certificateThumbprint), clientId); + } + + private AuthenticationContext GetContext(AdalConfiguration config) + { + string authority = config.AdEndpoint + config.AdDomain; + return new AuthenticationContext(authority, config.ValidateAuthority, config.TokenCache); + } + + private AuthenticationResult AcquireTokenWithSecret(AdalConfiguration config, string appId, SecureString appKey) + { + if (appKey == null) + { + return RenewWithSecret(config, appId); + } + + StoreAppKey(appId, config.AdDomain, appKey); + var credential = new ClientCredential(appId, appKey); + var context = GetContext(config); + return context.AcquireToken(config.ResourceClientUri, credential); + } + + private AuthenticationResult AcquireTokenWithCertificate(AdalConfiguration config, string appId, + string thumbprint) + { + var certificate = AzureSession.DataStore.GetCertificate(thumbprint); + if (certificate == null) + { + throw new ArgumentException(string.Format(Resources.CertificateNotFoundInStore, thumbprint)); + } + + var context = GetContext(config); + return context.AcquireToken(config.ResourceClientUri, new ClientAssertionCertificate(appId, certificate)); + } + + private AuthenticationResult RenewWithSecret(AdalConfiguration config, string appId) + { + TracingAdapter.Information(Resources.SPNRenewTokenTrace, appId, config.AdDomain, config.AdEndpoint, + config.ClientId, config.ClientRedirectUri); + using (SecureString appKey = LoadAppKey(appId, config.AdDomain)) + { + if (appKey == null) + { + throw new KeyNotFoundException(string.Format(Resources.ServiceKeyNotFound, appId)); + } + return AcquireTokenWithSecret(config, appId, appKey); + } + } + + private AuthenticationResult RenewWithCertificate(AdalConfiguration config, string appId, + string thumbprint) + { + TracingAdapter.Information(Resources.SPNRenewTokenTrace, appId, config.AdDomain, config.AdEndpoint, + config.ClientId, config.ClientRedirectUri); + return AcquireTokenWithCertificate(config, appId, thumbprint); + } + + private SecureString LoadAppKey(string appId, string tenantId) + { + return ServicePrincipalKeyStore.GetKey(appId, tenantId); + } + + private void StoreAppKey(string appId, string tenantId, SecureString appKey) + { + ServicePrincipalKeyStore.SaveKey(appId, tenantId, appKey); + } + + + private class ServicePrincipalAccessToken : IAccessToken + { + internal readonly AdalConfiguration Configuration; + internal AuthenticationResult AuthResult; + private readonly Func tokenRenewer; + private readonly string appId; + + public ServicePrincipalAccessToken(AdalConfiguration configuration, AuthenticationResult authResult, Func tokenRenewer, string appId) + { + Configuration = configuration; + AuthResult = authResult; + this.tokenRenewer = tokenRenewer; + this.appId = appId; + } + + public void AuthorizeRequest(Action authTokenSetter) + { + if (IsExpired) + { + AuthResult = tokenRenewer(Configuration, appId); + } + + authTokenSetter(AuthResult.AccessTokenType, AuthResult.AccessToken); + } + + public string UserId { get { return appId; } } + public string AccessToken { get { return AuthResult.AccessToken; } } + public LoginType LoginType { get { return LoginType.OrgId; } } + public string TenantId { get { return this.Configuration.AdDomain; } } + + private bool IsExpired + { + get + { +#if DEBUG + if (Environment.GetEnvironmentVariable("FORCE_EXPIRED_ACCESS_TOKEN") != null) + { + return true; + } +#endif + + var expiration = AuthResult.ExpiresOn; + var currentTime = DateTimeOffset.UtcNow; + var timeUntilExpiration = expiration - currentTime; + TracingAdapter.Information(Resources.SPNTokenExpirationCheckTrace, expiration, currentTime, + expirationThreshold, timeUntilExpiration); + return timeUntilExpiration < expirationThreshold; + } + } + } + } +} + diff --git a/src/Common/Commands.Common.Authentication/Authentication/ShowDialog.cs b/src/Common/Commands.Common.Authentication/Authentication/ShowDialog.cs new file mode 100644 index 000000000000..3ca6ac512309 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/ShowDialog.cs @@ -0,0 +1,23 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public enum ShowDialog + { + Auto, + Always, + Never + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Authentication/UserTokenProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/UserTokenProvider.cs new file mode 100644 index 000000000000..54aa45bc5564 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Authentication/UserTokenProvider.cs @@ -0,0 +1,301 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Authentication; +using System.Threading; +using System.Windows.Forms; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// A token provider that uses ADAL to retrieve + /// tokens from Azure Active Directory for user + /// credentials. + /// + internal class UserTokenProvider : ITokenProvider + { + private readonly IWin32Window parentWindow; + + public UserTokenProvider(IWin32Window parentWindow) + { + this.parentWindow = parentWindow; + } + + public IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, SecureString password, + AzureAccount.AccountType credentialType) + { + if (credentialType != AzureAccount.AccountType.User) + { + throw new ArgumentException(string.Format(Resources.InvalidCredentialType, "User"), "credentialType"); + } + + return new AdalAccessToken(AcquireToken(config, promptBehavior, userId, password), this, config); + } + + private readonly static TimeSpan expirationThreshold = TimeSpan.FromMinutes(5); + + private bool IsExpired(AdalAccessToken token) + { +#if DEBUG + if (Environment.GetEnvironmentVariable("FORCE_EXPIRED_ACCESS_TOKEN") != null) + { + return true; + } +#endif + var expiration = token.AuthResult.ExpiresOn; + var currentTime = DateTimeOffset.UtcNow; + var timeUntilExpiration = expiration - currentTime; + TracingAdapter.Information(Resources.UPNTokenExpirationCheckTrace, expiration, currentTime, expirationThreshold, + timeUntilExpiration); + return timeUntilExpiration < expirationThreshold; + } + + private void Renew(AdalAccessToken token) + { + TracingAdapter.Information(Resources.UPNRenewTokenTrace, token.AuthResult.AccessTokenType, token.AuthResult.ExpiresOn, + token.AuthResult.IsMultipleResourceRefreshToken, token.AuthResult.TenantId, token.UserId); + var user = token.AuthResult.UserInfo; + if (user != null) + { + TracingAdapter.Information(Resources.UPNRenewTokenUserInfoTrace, user.DisplayableId, user.FamilyName, + user.GivenName, user.IdentityProvider, user.UniqueId); + } + if (IsExpired(token)) + { + TracingAdapter.Information(Resources.UPNExpiredTokenTrace); + AuthenticationResult result = AcquireToken(token.Configuration, ShowDialog.Never, token.UserId, null); + + if (result == null) + { + throw new AuthenticationException(Resources.ExpiredRefreshToken); + } + else + { + token.AuthResult = result; + } + } + } + + private AuthenticationContext CreateContext(AdalConfiguration config) + { + return new AuthenticationContext(config.AdEndpoint + config.AdDomain, config.ValidateAuthority, config.TokenCache) + { + OwnerWindow = parentWindow + }; + } + + // We have to run this in a separate thread to guarantee that it's STA. This method + // handles the threading details. + private AuthenticationResult AcquireToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, + SecureString password) + { + AuthenticationResult result = null; + Exception ex = null; + if (promptBehavior == ShowDialog.Never) + { + result = SafeAquireToken(config, promptBehavior, userId, password, out ex); + } + else + { + var thread = new Thread(() => + { + result = SafeAquireToken(config, promptBehavior, userId, password, out ex); + }); + + thread.SetApartmentState(ApartmentState.STA); + thread.Name = "AcquireTokenThread"; + thread.Start(); + thread.Join(); + } + + if (ex != null) + { + var adex = ex as AdalException; + if (adex != null) + { + if (adex.ErrorCode == AdalError.AuthenticationCanceled) + { + throw new AadAuthenticationCanceledException(adex.Message, adex); + } + } + if (ex is AadAuthenticationException) + { + throw ex; + } + throw new AadAuthenticationFailedException(GetExceptionMessage(ex), ex); + } + + return result; + } + + private AuthenticationResult SafeAquireToken( + AdalConfiguration config, + ShowDialog showDialog, + string userId, + SecureString password, + out Exception ex) + { + try + { + ex = null; + var promptBehavior = (PromptBehavior)Enum.Parse(typeof(PromptBehavior), showDialog.ToString()); + + return DoAcquireToken(config, promptBehavior, userId, password); + } + catch (AdalException adalEx) + { + if (adalEx.ErrorCode == AdalError.UserInteractionRequired || + adalEx.ErrorCode == AdalError.MultipleTokensMatched) + { + string message = Resources.AdalUserInteractionRequired; + if (adalEx.ErrorCode == AdalError.MultipleTokensMatched) + { + message = Resources.AdalMultipleTokens; + } + + ex = new AadAuthenticationFailedWithoutPopupException(message, adalEx); + } + else if (adalEx.ErrorCode == AdalError.MissingFederationMetadataUrl) + { + ex = new AadAuthenticationFailedException(Resources.CredentialOrganizationIdMessage, adalEx); + } + else + { + ex = adalEx; + } + } + catch (Exception threadEx) + { + ex = threadEx; + } + return null; + } + + private AuthenticationResult DoAcquireToken(AdalConfiguration config, PromptBehavior promptBehavior, string userId, + SecureString password) + { + AuthenticationResult result; + var context = CreateContext(config); + + TracingAdapter.Information(Resources.UPNAcquireTokenContextTrace, context.Authority, context.CorrelationId, + context.ValidateAuthority); + TracingAdapter.Information(Resources.UPNAcquireTokenConfigTrace, config.AdDomain, config.AdEndpoint, + config.ClientId, config.ClientRedirectUri); + if (string.IsNullOrEmpty(userId)) + { + if (promptBehavior != PromptBehavior.Never) + { + ClearCookies(); + } + + result = context.AcquireToken(config.ResourceClientUri, config.ClientId, + config.ClientRedirectUri, promptBehavior, + UserIdentifier.AnyUser, AdalConfiguration.EnableEbdMagicCookie); + } + else + { + if (password == null) + { + result = context.AcquireToken(config.ResourceClientUri, config.ClientId, + config.ClientRedirectUri, promptBehavior, + new UserIdentifier(userId, UserIdentifierType.RequiredDisplayableId), + AdalConfiguration.EnableEbdMagicCookie); + } + else + { + UserCredential credential = new UserCredential(userId, password); + result = context.AcquireToken(config.ResourceClientUri, config.ClientId, credential); + } + } + return result; + } + + private string GetExceptionMessage(Exception ex) + { + string message = ex.Message; + if (ex.InnerException != null) + { + message += ": " + ex.InnerException.Message; + } + return message; + } + /// + /// Implementation of using data from ADAL + /// + private class AdalAccessToken : IAccessToken + { + internal readonly AdalConfiguration Configuration; + internal AuthenticationResult AuthResult; + private readonly UserTokenProvider tokenProvider; + + public AdalAccessToken(AuthenticationResult authResult, UserTokenProvider tokenProvider, AdalConfiguration configuration) + { + AuthResult = authResult; + this.tokenProvider = tokenProvider; + Configuration = configuration; + } + + public void AuthorizeRequest(Action authTokenSetter) + { + tokenProvider.Renew(this); + authTokenSetter(AuthResult.AccessTokenType, AuthResult.AccessToken); + } + + public string AccessToken { get { return AuthResult.AccessToken; } } + public string UserId { get { return AuthResult.UserInfo.DisplayableId; } } + + public string TenantId { get { return AuthResult.TenantId; } } + + public LoginType LoginType + { + get + { + if (AuthResult.UserInfo.IdentityProvider != null) + { + return LoginType.LiveId; + } + return LoginType.OrgId; + } + } + } + + + private void ClearCookies() + { + NativeMethods.InternetSetOption(IntPtr.Zero, NativeMethods.INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0); + } + + private static class NativeMethods + { + internal const int INTERNET_OPTION_END_BROWSER_SESSION = 42; + + [DllImport("wininet.dll", SetLastError = true)] + internal static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, + int lpdwBufferLength); + } + + public IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string clientId, string certificate, AzureAccount.AccountType credentialType) + { + throw new NotImplementedException(); + } + } +} + diff --git a/src/Common/Commands.Common.Authentication/AzureSession.cs b/src/Common/Commands.Common.Authentication/AzureSession.cs new file mode 100644 index 000000000000..51108e9c628c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/AzureSession.cs @@ -0,0 +1,89 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.IO; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// Represents current Azure session. + /// + public static class AzureSession + { + /// + /// Gets or sets Azure client factory. + /// + public static IClientFactory ClientFactory { get; set; } + + /// + /// Gets or sets Azure authentication factory. + /// + public static IAuthenticationFactory AuthenticationFactory { get; set; } + + /// + /// Gets or sets data persistence store. + /// + public static IDataStore DataStore { get; set; } + + /// + /// Gets or sets the token cache store. + /// + public static TokenCache TokenCache { get; set; } + + /// + /// Gets or sets profile directory. + /// + public static string ProfileDirectory { get; set; } + + /// + /// Gets or sets token cache file path. + /// + public static string TokenCacheFile { get; set; } + + /// + /// Gets or sets profile file name. + /// + public static string ProfileFile { get; set; } + + /// + /// Gets or sets file name for the migration backup. + /// + public static string OldProfileFileBackup { get; set; } + + /// + /// Gets or sets old profile file name. + /// + public static string OldProfileFile { get; set; } + + static AzureSession() + { + ClientFactory = new ClientFactory(); + AuthenticationFactory = new AuthenticationFactory(); + DataStore = new MemoryDataStore(); + TokenCache = new TokenCache(); + OldProfileFile = "WindowsAzureProfile.xml"; + OldProfileFileBackup = "WindowsAzureProfile.xml.bak"; + ProfileDirectory = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + Resources.AzureDirectoryName); ; + ProfileFile = "AzureProfile.json"; + TokenCacheFile = "TokenCache.dat"; + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj b/src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj new file mode 100644 index 000000000000..6d0cd4c93d78 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj @@ -0,0 +1,182 @@ + + + + + Debug + AnyCPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E} + Library + Properties + Microsoft.Azure.Commands.Common.Authentication + Commands.Common.Authentication + v4.5 + 512 + ..\..\ + true + /assemblyCompareMode:StrongNameIgnoringVersion + 06e19c11 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + true + false + true + + + pdbonly + true + bin\Release\ + TRACE;SIGN + AnyCPU + bin\Release\Management.Utilities.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + MinimumRecommendedRules.ruleset + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Rules + true + MSSharedLibKey.snk + true + true + false + true + + + + ..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll + True + + + ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + True + + + ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + True + + + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + True + + + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + True + + + ..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + True + + + ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + + + ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + True + + + + + + + ..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll + True + + + ..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Common/AzureModule.cs b/src/Common/Commands.Common.Authentication/Common/AzureModule.cs new file mode 100644 index 000000000000..a5df2c70f95d --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Common/AzureModule.cs @@ -0,0 +1,23 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public enum AzureModule + { + AzureServiceManagement, + AzureResourceManager, + AzureProfile + } +} diff --git a/src/Common/Commands.Common.Authentication/Common/ProfileData.cs b/src/Common/Commands.Common.Authentication/Common/ProfileData.cs new file mode 100644 index 000000000000..25aa6d2b8acc --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Common/ProfileData.cs @@ -0,0 +1,272 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + /// + /// This class provides the representation of + /// data loaded and saved into data files + /// for AzureSMProfile. + /// + [DataContract] + public class ProfileData + { + [DataMember] + public string DefaultEnvironmentName { get; set; } + + [DataMember] + public IEnumerable Environments { get; set; } + + [DataMember] + public IEnumerable Subscriptions { get; set; } + } + + /// + /// This class provides the representation of + /// data loaded and saved into data files for + /// an individual Azure environment + /// + [DataContract] + public class AzureEnvironmentData + { + public AzureEnvironment ToAzureEnvironment() + { + return new AzureEnvironment + { + Name = this.Name, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, this.ActiveDirectoryServiceEndpointResourceId }, + { AzureEnvironment.Endpoint.AdTenant, this.AdTenantUrl }, + { AzureEnvironment.Endpoint.Gallery, this.GalleryEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, this.ManagementPortalUrl }, + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, this.PublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ResourceManager, this.ResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ServiceManagement, this.ServiceEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, this.SqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, this.StorageEndpointSuffix }, + { AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, this.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix }, + { AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, this.AzureDataLakeStoreFileSystemEndpointSuffix }, + } + }; + } + + [DataMember] + public string Name { get; set; } + + [DataMember] + public string PublishSettingsFileUrl { get; set; } + + [DataMember] + public string ServiceEndpoint { get; set; } + + [DataMember] + public string ResourceManagerEndpoint { get; set; } + + [DataMember] + public string ManagementPortalUrl { get; set; } + + [DataMember] + public string StorageEndpointSuffix { get; set; } + + [DataMember] + public string AdTenantUrl { get; set; } + + [DataMember] + public string CommonTenantId { get; set; } + + [DataMember] + public string GalleryEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryServiceEndpointResourceId { get; set; } + + [DataMember] + public string SqlDatabaseDnsSuffix { get; set; } + + [DataMember] + public string TrafficManagerEndpointSuffix { get; set; } + + [DataMember] + public string AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix { get; set; } + + [DataMember] + public string AzureDataLakeStoreFileSystemEndpointSuffix { get; set; } + } + + /// + /// This class provides the representation of data loaded + /// and saved into data file for an individual Azure subscription. + /// + [DataContract] + public class AzureSubscriptionData + { + /// + /// Constructor used by DataContractSerializer + /// + public AzureSubscriptionData() + { + } + + public AzureSubscription ToAzureSubscription(List envs) + { + AzureSubscription subscription = new AzureSubscription(); + try + { + subscription.Id = new Guid(this.SubscriptionId); + } + catch (Exception ex) + { + throw new ArgumentException("Subscription ID is not a valid GUID.", ex); + } + subscription.Name = Name; + + // Logic to detect what is the subscription environment relies on having ManagementEndpoint (i.e. RDFE endpoint) set already on the subscription + List allEnvs = envs.Union(AzureEnvironment.PublicEnvironments.Values).ToList(); + AzureEnvironment env = allEnvs.FirstOrDefault(e => e.IsEndpointSetToValue(AzureEnvironment.Endpoint.ServiceManagement, this.ManagementEndpoint)); + + if (env != null) + { + subscription.Environment = env.Name; + } + else + { + subscription.Environment = EnvironmentName.AzureCloud; + } + + if (!string.IsNullOrEmpty(this.ManagementCertificate)) + { + subscription.Account = this.ManagementCertificate; + } + + if (!string.IsNullOrEmpty(this.ActiveDirectoryUserId)) + { + subscription.Account = this.ActiveDirectoryUserId; + } + + if (!string.IsNullOrEmpty(this.ActiveDirectoryTenantId)) + { + subscription.SetProperty(AzureSubscription.Property.Tenants, ActiveDirectoryTenantId); + } + + if (this.IsDefault) + { + subscription.SetProperty(AzureSubscription.Property.Default, "True"); + } + + if (!string.IsNullOrEmpty(this.CloudStorageAccount)) + { + subscription.Properties.Add(AzureSubscription.Property.StorageAccount, this.CloudStorageAccount); + } + + if (this.RegisteredResourceProviders.Count() > 0) + { + StringBuilder providers = new StringBuilder(); + subscription.Properties.Add(AzureSubscription.Property.RegisteredResourceProviders, + string.Join(",", RegisteredResourceProviders)); + } + + return subscription; + } + + public IEnumerable ToAzureAccounts() + { + if (!string.IsNullOrEmpty(ActiveDirectoryUserId)) + { + AzureAccount userAccount = new AzureAccount + { + Id = ActiveDirectoryUserId, + Type = AzureAccount.AccountType.User + }; + + userAccount.SetProperty(AzureAccount.Property.Subscriptions, new Guid(this.SubscriptionId).ToString()); + + if (!string.IsNullOrEmpty(ActiveDirectoryTenantId)) + { + userAccount.SetProperty(AzureAccount.Property.Tenants, ActiveDirectoryTenantId); + } + + yield return userAccount; + } + + if (!string.IsNullOrEmpty(ManagementCertificate)) + { + AzureAccount certificateAccount = new AzureAccount + { + Id = ManagementCertificate, + Type = AzureAccount.AccountType.Certificate + }; + + certificateAccount.SetProperty(AzureAccount.Property.Subscriptions, new Guid(this.SubscriptionId).ToString()); + + yield return certificateAccount; + } + } + + [DataMember] + public string Name { get; set; } + + [DataMember] + public string SubscriptionId { get; set; } + + [DataMember] + public string ManagementEndpoint { get; set; } + + [DataMember] + public string ResourceManagerEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryTenantId { get; set; } + + [DataMember] + public string ActiveDirectoryUserId { get; set; } + + [DataMember] + public string LoginType { get; set; } + + [DataMember] + public bool IsDefault { get; set; } + + [DataMember] + public string ManagementCertificate { get; set; } + + [DataMember] + public string CloudStorageAccount { get; set; } + + [DataMember] + public IEnumerable RegisteredResourceProviders { get; set; } + + [DataMember] + public string GalleryEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryServiceEndpointResourceId { get; set; } + + [DataMember] + public string SqlDatabaseDnsSuffix { get; set; } + + [DataMember] + public string TrafficManagerEndpointSuffix { get; set; } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Common/Validate.cs b/src/Common/Commands.Common.Authentication/Common/Validate.cs new file mode 100644 index 000000000000..b1f555fa9a9f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Common/Validate.cs @@ -0,0 +1,218 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using System; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Runtime.InteropServices; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public static class Validate + { + [Flags] + enum InternetConnectionState : int + { + INTERNET_CONNECTION_MODEM = 0x1, + INTERNET_CONNECTION_LAN = 0x2, + INTERNET_CONNECTION_PROXY = 0x4, + INTERNET_RAS_INSTALLED = 0x10, + INTERNET_CONNECTION_OFFLINE = 0x20, + INTERNET_CONNECTION_CONFIGURED = 0x40 + } + + [SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass", Justification = "Not necessary for a single p-invoke")] + [DllImport("WININET", CharSet = CharSet.Auto)] + static extern bool InternetGetConnectedState(ref InternetConnectionState lpdwFlags, int dwReserved); + + /// + /// Validates against given string if null or empty. + /// + /// string variable to validate + /// This parameter is used when the validation fails. It can contain actual message to display + /// or parameter name to display with default message + /// Indicates either to use messageData as actual message or parameter name + public static void ValidateStringIsNullOrEmpty(string data, string messageData, bool useDefaultMessage = true) + { + if (string.IsNullOrEmpty(data)) + { + // In this case use messageData parameter as name for null/empty string. + if (useDefaultMessage) + { + throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, messageData)); + } + else + { + // Use the message provided by the user + throw new ArgumentException(messageData); + } + } + } + + public static void ValidatePathName(string element, string exceptionMessage) + { + if (element.IndexOfAny(Path.GetInvalidPathChars()) != -1) + { + throw new ArgumentException(exceptionMessage); + } + } + + public static void ValidateFileName(string element, string exceptionMessage = null) + { + try + { + string fileName = Path.GetFileName(element); + + if (fileName.IndexOfAny(Path.GetInvalidFileNameChars()) != -1) + { + throw new ArgumentException(exceptionMessage ?? string.Empty); + } + } + catch + { + throw new ArgumentException(exceptionMessage ?? string.Empty); + } + } + + public static void ValidateFileExists(string filePath, string exceptionMessage) + { + if (!FileUtilities.DataStore.FileExists(filePath)) + { + throw new FileNotFoundException(exceptionMessage); + } + } + + public static void ValidateDirectoryExists(string directory, string exceptionMessage = null) + { + string msg = string.Format(Resources.PathDoesNotExist, directory); + + if (!FileUtilities.DataStore.DirectoryExists(directory)) + { + if (!string.IsNullOrEmpty(exceptionMessage)) + { + msg = exceptionMessage; + } + + throw new FileNotFoundException(msg); + } + } + + public static void ValidateNullArgument(object item, string exceptionMessage) + { + if (item == null) + { + throw new ArgumentException(exceptionMessage); + } + } + + public static void ValidateFileExtention(string filePath, string desiredExtention) + { + bool invalidExtension = Convert.ToBoolean(string.Compare(Path.GetExtension(filePath), desiredExtention, true)); + + if (invalidExtension) + { + throw new ArgumentException(string.Format(Resources.InvalidFileExtension, filePath, desiredExtention)); + } + } + + public static void ValidateDnsName(string dnsName, string parameterName) + { + if (Uri.CheckHostName(dnsName) != UriHostNameType.Dns || dnsName.EndsWith("-")) + { + throw new ArgumentException(string.Format(Resources.InvalidDnsName, dnsName, parameterName)); + } + } + + public static void ValidateDnsDoesNotExist(string dnsName) + { + try + { + Dns.GetHostEntry(dnsName); + // Dns does exist throw exception + // + throw new ArgumentException(string.Format(Resources.ServiceNameExists, dnsName)); + } + catch (SocketException) + { + // Dns doesn't exist + } + } + + public static void ValidateInternetConnection() + { + InternetConnectionState flags = 0; + + if (!InternetGetConnectedState(ref flags, 0)) + { + throw new Exception(Resources.NoInternetConnection); + } + } + + public static void HasWhiteCharacter(string text, string exceptionMessage = null) + { + if (text.Any(char.IsWhiteSpace)) + { + throw new ArgumentException(exceptionMessage ?? string.Empty); + } + } + + /// + /// Make validation for given path. + /// + /// Path to validate + /// message to display if this validation failed + public static void ValidatePath(string path, string exceptionMessage) + { + ValidateStringIsNullOrEmpty(path, exceptionMessage, false); + ValidatePathName(path, exceptionMessage); + } + + /// + /// Validates against given directory + /// + /// Directory name + /// Name which you use to identify that directory to user (i.e. AzureSdkDirectory) + public static void ValidateDirectoryFull(string directoryNameOnDisk, string directoryName) + { + BasicFileAndDirectoryValidation(directoryNameOnDisk, directoryName); + ValidateDirectoryExists(directoryNameOnDisk, string.Format(Resources.PathDoesNotExistForElement, directoryName, directoryNameOnDisk)); + } + + private static void BasicFileAndDirectoryValidation(string fullPath, string name) + { + ValidateStringIsNullOrEmpty(fullPath, name); + ValidateFileName(fullPath, Resources.IllegalPath); + string directoryPath = Path.GetDirectoryName(fullPath); + if (!string.IsNullOrEmpty(directoryPath)) + { + ValidatePath(fullPath, Resources.IllegalPath); + } + } + + /// + /// Validates against given file + /// + /// File name + /// Name which you use to identify that directory to user (i.e. Service Settings) + public static void ValidateFileFull(string fileNameOnDisk, string fileName) + { + BasicFileAndDirectoryValidation(fileNameOnDisk, fileName); + ValidateFileExists(fileNameOnDisk, string.Format(Resources.PathDoesNotExistForElement, fileName, fileNameOnDisk)); + } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Extensions/CloudExceptionExtensions.cs b/src/Common/Commands.Common.Authentication/Extensions/CloudExceptionExtensions.cs new file mode 100644 index 000000000000..f51f6698d518 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Extensions/CloudExceptionExtensions.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using Hyak.Common; +using System.Linq; + +namespace Microsoft.Azure.Common +{ + public static class CloudExceptionExtensions + { + public static string GetRequestId(this CloudException exception) + { + if(exception == null || + exception.Response == null || + exception.Response.Headers == null || + !exception.Response.Headers.Keys.Contains("x-ms-request-id")) + { + return null; + } + + return exception.Response.Headers["x-ms-request-id"].FirstOrDefault(); + + } + public static string GetRoutingRequestId(this CloudException exception) + { + if (exception == null || + exception.Response == null || + exception.Response.Headers == null || + !exception.Response.Headers.Keys.Contains("x-ms-routing-request-id")) + { + return null; + } + + return exception.Response.Headers["x-ms-routing-request-id"].FirstOrDefault(); + + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Factories/AuthenticationFactory.cs b/src/Common/Commands.Common.Authentication/Factories/AuthenticationFactory.cs new file mode 100644 index 000000000000..1d49be6be746 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Factories/AuthenticationFactory.cs @@ -0,0 +1,302 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using System; +using System.Linq; +using System.Security; +using Hyak.Common; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest; +using Microsoft.Rest.Azure.Authentication; + +namespace Microsoft.Azure.Commands.Common.Authentication.Factories +{ + public class AuthenticationFactory : IAuthenticationFactory + { + public const string CommonAdTenant = "Common"; + + public AuthenticationFactory() + { + TokenProvider = new AdalTokenProvider(); + } + + public ITokenProvider TokenProvider { get; set; } + + public IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + TokenCache tokenCache, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId) + { + var configuration = GetAdalConfiguration(environment, tenant, resourceId, tokenCache); + + TracingAdapter.Information(Resources.AdalAuthConfigurationTrace, configuration.AdDomain, configuration.AdEndpoint, + configuration.ClientId, configuration.ClientRedirectUri, configuration.ResourceClientUri, configuration.ValidateAuthority); + IAccessToken token; + if (account.IsPropertySet(AzureAccount.Property.CertificateThumbprint)) + { + var thumbprint = account.GetProperty(AzureAccount.Property.CertificateThumbprint); + token = TokenProvider.GetAccessTokenWithCertificate(configuration, account.Id, thumbprint, account.Type); + } + else + { + + token = TokenProvider.GetAccessToken(configuration, promptBehavior, account.Id, password, account.Type); + } + + account.Id = token.UserId; + return token; + } + + public IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId) + { + return Authenticate(account, environment, tenant, password, promptBehavior, AzureSession.TokenCache, resourceId); + } + + public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context) + { + return GetSubscriptionCloudCredentials(context, AzureEnvironment.Endpoint.ServiceManagement); + } + + public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context, AzureEnvironment.Endpoint targetEndpoint) + { + if (context.Subscription == null) + { + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.InvalidDefaultSubscription + : Resources.NoSubscriptionInContext; + throw new ApplicationException(exceptionMessage); + } + + if (context.Account == null) + { + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.AccountNotFound + : Resources.ArmAccountNotFound; + throw new ArgumentException(exceptionMessage); + } + + if (context.Account.Type == AzureAccount.AccountType.Certificate) + { + var certificate = AzureSession.DataStore.GetCertificate(context.Account.Id); + return new CertificateCloudCredentials(context.Subscription.Id.ToString(), certificate); + } + + if (context.Account.Type == AzureAccount.AccountType.AccessToken) + { + return new TokenCloudCredentials(context.Subscription.Id.ToString(), context.Account.GetProperty(AzureAccount.Property.AccessToken)); + } + + string tenant = null; + + if (context.Subscription != null && context.Account != null) + { + tenant = context.Subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants) + .Intersect(context.Account.GetPropertyAsArray(AzureAccount.Property.Tenants)) + .FirstOrDefault(); + } + + if (tenant == null && context.Tenant != null && context.Tenant.Id != Guid.Empty) + { + tenant = context.Tenant.Id.ToString(); + } + + if (tenant == null) + { + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.TenantNotFound + : Resources.NoTenantInContext; + throw new ArgumentException(exceptionMessage); + } + + try + { + TracingAdapter.Information(Resources.UPNAuthenticationTrace, + context.Account.Id, context.Environment.Name, tenant); + var tokenCache = AzureSession.TokenCache; + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + tokenCache = new TokenCache(context.TokenCache); + } + + var token = Authenticate(context.Account, context.Environment, + tenant, null, ShowDialog.Never, tokenCache, context.Environment.GetTokenAudience(targetEndpoint)); + + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + context.TokenCache = tokenCache.Serialize(); + } + + TracingAdapter.Information(Resources.UPNAuthenticationTokenTrace, + token.LoginType, token.TenantId, token.UserId); + return new AccessTokenCredential(context.Subscription.Id, token); + } + catch (Exception ex) + { + TracingAdapter.Information(Resources.AdalAuthException, ex.Message); + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.InvalidSubscriptionState + : Resources.InvalidArmContext; + throw new ArgumentException(exceptionMessage, ex); + } + } + + public ServiceClientCredentials GetServiceClientCredentials(AzureContext context) + { + return GetServiceClientCredentials(context, + AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId); + } + + public ServiceClientCredentials GetServiceClientCredentials(AzureContext context, AzureEnvironment.Endpoint targetEndpoint) + { + if (context.Account == null) + { + throw new ArgumentException(Resources.ArmAccountNotFound); + } + + if (context.Account.Type == AzureAccount.AccountType.Certificate) + { + throw new NotSupportedException(AzureAccount.AccountType.Certificate.ToString()); + } + + if (context.Account.Type == AzureAccount.AccountType.AccessToken) + { + return new TokenCredentials(context.Account.GetProperty(AzureAccount.Property.AccessToken)); + } + + string tenant = null; + + if (context.Subscription != null && context.Account != null) + { + tenant = context.Subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants) + .Intersect(context.Account.GetPropertyAsArray(AzureAccount.Property.Tenants)) + .FirstOrDefault(); + } + + if (tenant == null && context.Tenant != null && context.Tenant.Id != Guid.Empty) + { + tenant = context.Tenant.Id.ToString(); + } + + if (tenant == null) + { + throw new ArgumentException(Resources.NoTenantInContext); + } + + try + { + TracingAdapter.Information(Resources.UPNAuthenticationTrace, + context.Account.Id, context.Environment.Name, tenant); + + // TODO: When we will refactor the code, need to add tracing + /*TracingAdapter.Information(Resources.UPNAuthenticationTokenTrace, + token.LoginType, token.TenantId, token.UserId);*/ + + var env = new ActiveDirectoryServiceSettings + { + AuthenticationEndpoint = context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ActiveDirectory), + TokenAudience = context.Environment.GetEndpointAsUri(context.Environment.GetTokenAudience(targetEndpoint)), + ValidateAuthority = !context.Environment.OnPremise + }; + + var tokenCache = AzureSession.TokenCache; + + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + tokenCache = new TokenCache(context.TokenCache); + } + + ServiceClientCredentials result = null; + + if (context.Account.Type == AzureAccount.AccountType.User) + { + result = Rest.Azure.Authentication.UserTokenProvider.CreateCredentialsFromCache( + AdalConfiguration.PowerShellClientId, + tenant, + context.Account.Id, + env, + tokenCache).ConfigureAwait(false).GetAwaiter().GetResult(); + } + else if (context.Account.Type == AzureAccount.AccountType.ServicePrincipal) + { + if (context.Account.IsPropertySet(AzureAccount.Property.CertificateThumbprint)) + { + result = ApplicationTokenProvider.LoginSilentAsync( + tenant, + context.Account.Id, + new CertificateApplicationCredentialProvider( + context.Account.GetProperty(AzureAccount.Property.CertificateThumbprint)), + env, + tokenCache).ConfigureAwait(false).GetAwaiter().GetResult(); + } + else + { + result = ApplicationTokenProvider.LoginSilentAsync( + tenant, + context.Account.Id, + new KeyStoreApplicationCredentialProvider(tenant), + env, + tokenCache).ConfigureAwait(false).GetAwaiter().GetResult(); + } + } + else + { + throw new NotSupportedException(context.Account.Type.ToString()); + } + + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + context.TokenCache = tokenCache.Serialize(); + } + + return result; + } + catch (Exception ex) + { + TracingAdapter.Information(Resources.AdalAuthException, ex.Message); + throw new ArgumentException(Resources.InvalidArmContext, ex); + } + } + + private AdalConfiguration GetAdalConfiguration(AzureEnvironment environment, string tenantId, + AzureEnvironment.Endpoint resourceId, TokenCache tokenCache) + { + if (environment == null) + { + throw new ArgumentNullException("environment"); + } + var adEndpoint = environment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectory]; + + return new AdalConfiguration + { + AdEndpoint = adEndpoint, + ResourceClientUri = environment.Endpoints[resourceId], + AdDomain = tenantId, + ValidateAuthority = !environment.OnPremise, + TokenCache = tokenCache + }; + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Factories/ClientFactory.cs b/src/Common/Commands.Common.Authentication/Factories/ClientFactory.cs new file mode 100644 index 000000000000..7ac12cce7418 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Factories/ClientFactory.cs @@ -0,0 +1,312 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Microsoft.Azure.Commands.Common.Authentication.Factories +{ + public class ClientFactory : IClientFactory + { + private static readonly char[] uriPathSeparator = { '/' }; + + private Dictionary _actions; + private OrderedDictionary _handlers; + + public ClientFactory() + { + _actions = new Dictionary(); + UserAgents = new HashSet(); + _handlers = new OrderedDictionary(); + } + + public virtual TClient CreateArmClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient + { + if (context == null) + { + throw new ApplicationException(Resources.NoSubscriptionInContext); + } + + var creds = AzureSession.AuthenticationFactory.GetServiceClientCredentials(context); + var newHandlers = GetCustomHandlers(); + TClient client = (newHandlers == null || newHandlers.Length == 0) + ? CreateCustomArmClient(context.Environment.GetEndpointAsUri(endpoint), creds) + : CreateCustomArmClient(context.Environment.GetEndpointAsUri(endpoint), creds, GetCustomHandlers()); + + var subscriptionId = typeof(TClient).GetProperty("SubscriptionId"); + if (subscriptionId != null && context.Subscription != null) + { + subscriptionId.SetValue(client, context.Subscription.Id.ToString()); + } + + return client; + } + + public virtual TClient CreateCustomArmClient(params object[] parameters) where TClient : Microsoft.Rest.ServiceClient + { + List types = new List(); + foreach (object obj in parameters) + { + types.Add(obj.GetType()); + } + + var constructor = typeof(TClient).GetConstructor(types.ToArray()); + + if (constructor == null) + { + throw new InvalidOperationException(string.Format(Resources.InvalidManagementClientType, typeof(TClient).Name)); + } + + TClient client = (TClient)constructor.Invoke(parameters); + + foreach (ProductInfoHeaderValue userAgent in UserAgents) + { + client.UserAgent.Add(userAgent); + } + + return client; + } + + public virtual TClient CreateClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + { + if (context == null) + { + var exceptionMessage = endpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.InvalidDefaultSubscription + : Resources.NoSubscriptionInContext; + throw new ApplicationException(exceptionMessage); + } + + SubscriptionCloudCredentials creds = AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(context, endpoint); + TClient client = CreateCustomClient(creds, context.Environment.GetEndpointAsUri(endpoint)); + foreach(DelegatingHandler handler in GetCustomHandlers()) + { + client.AddHandlerToPipeline(handler); + } + + return client; + } + + public virtual TClient CreateClient(AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + { + TClient client = CreateClient(profile.Context, endpoint); + + foreach (IClientAction action in _actions.Values) + { + action.Apply(client, profile, endpoint); + } + + return client; + } + + /// + /// + /// + /// + /// + /// + public virtual TClient CreateClient(AzureSMProfile profile, AzureSubscription subscription, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + { + if (subscription == null) + { + throw new ApplicationException(Resources.InvalidDefaultSubscription); + } + + if (!profile.Accounts.ContainsKey(subscription.Account)) + { + throw new ArgumentException(string.Format("Account with name '{0}' does not exist.", subscription.Account), "accountName"); + } + + if (!profile.Environments.ContainsKey(subscription.Environment)) + { + throw new ArgumentException(string.Format(Resources.EnvironmentNotFound, subscription.Environment)); + } + + AzureContext context = new AzureContext(subscription, + profile.Accounts[subscription.Account], + profile.Environments[subscription.Environment]); + + TClient client = CreateClient(context, endpoint); + + foreach (IClientAction action in _actions.Values) + { + action.Apply(client, profile, endpoint); + } + + return client; + } + + public virtual TClient CreateCustomClient(params object[] parameters) where TClient : ServiceClient + { + List types = new List(); + foreach (object obj in parameters) + { + types.Add(obj.GetType()); + } + + var constructor = typeof(TClient).GetConstructor(types.ToArray()); + + if (constructor == null) + { + throw new InvalidOperationException(string.Format(Resources.InvalidManagementClientType, typeof(TClient).Name)); + } + + TClient client = (TClient)constructor.Invoke(parameters); + + foreach (ProductInfoHeaderValue userAgent in UserAgents) + { + client.UserAgent.Add(userAgent); + } + + return client; + } + + public virtual HttpClient CreateHttpClient(string endpoint, ICredentials credentials) + { + return CreateHttpClient(endpoint, CreateHttpClientHandler(endpoint, credentials)); + } + + public virtual HttpClient CreateHttpClient(string endpoint, HttpMessageHandler effectiveHandler) + { + if (endpoint == null) + { + throw new ArgumentNullException("endpoint"); + } + + Uri serviceAddr = new Uri(endpoint); + HttpClient client = new HttpClient(effectiveHandler) + { + BaseAddress = serviceAddr, + MaxResponseContentBufferSize = 30 * 1024 * 1024 + }; + + client.DefaultRequestHeaders.Accept.Clear(); + + return client; + } + + public static HttpClientHandler CreateHttpClientHandler(string endpoint, ICredentials credentials) + { + if (endpoint == null) + { + throw new ArgumentNullException("endpoint"); + } + + // Set up our own HttpClientHandler and configure it + HttpClientHandler clientHandler = new HttpClientHandler(); + + if (credentials != null) + { + // Set up credentials cache which will handle basic authentication + CredentialCache credentialCache = new CredentialCache(); + + // Get base address without terminating slash + string credentialAddress = new Uri(endpoint).GetLeftPart(UriPartial.Authority).TrimEnd(uriPathSeparator); + + // Add credentials to cache and associate with handler + NetworkCredential networkCredentials = credentials.GetCredential(new Uri(credentialAddress), "Basic"); + credentialCache.Add(new Uri(credentialAddress), "Basic", networkCredentials); + clientHandler.Credentials = credentialCache; + clientHandler.PreAuthenticate = true; + } + + // Our handler is ready + return clientHandler; + } + + public void AddAction(IClientAction action) + { + if (action != null) + { + action.ClientFactory = this; + _actions[action.GetType()] = action; + } + } + + public void RemoveAction(Type actionType) + { + if (_actions.ContainsKey(actionType)) + { + _actions.Remove(actionType); + } + } + + public void AddHandler(T handler) where T: DelegatingHandler, ICloneable + { + if (handler != null) + { + _handlers[handler.GetType()] = handler; + } + } + + public void RemoveHandler(Type handlerType) + { + if (_handlers.Contains(handlerType)) + { + _handlers.Remove(handlerType); + } + } + + /// + /// Adds user agent to UserAgents collection. + /// + /// Product name. + /// Product version. + public void AddUserAgent(string productName, string productVersion) + { + UserAgents.Add(new ProductInfoHeaderValue(productName, productVersion)); + } + + /// + /// Adds user agent to UserAgents collection with empty version. + /// + /// Product name. + public void AddUserAgent(string productName) + { + AddUserAgent(productName, ""); + } + + public HashSet UserAgents { get; set; } + + private DelegatingHandler[] GetCustomHandlers() + { + List newHandlers = new List(); + var enumerator = _handlers.GetEnumerator(); + while (enumerator.MoveNext()) + { + var handler = enumerator.Value; + ICloneable cloneableHandler = handler as ICloneable; + if (cloneableHandler != null) + { + var newHandler = cloneableHandler.Clone(); + DelegatingHandler convertedHandler = newHandler as DelegatingHandler; + if (convertedHandler != null) + { + newHandlers.Add(convertedHandler); + } + } + } + + return newHandlers.ToArray(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Interfaces/IAuthenticationFactory.cs b/src/Common/Commands.Common.Authentication/Interfaces/IAuthenticationFactory.cs new file mode 100644 index 000000000000..62b4cfdffad1 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Interfaces/IAuthenticationFactory.cs @@ -0,0 +1,70 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest; +using System.Security; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public interface IAuthenticationFactory + { + /// + /// Returns IAccessToken if authentication succeeds or throws an exception if authentication fails. + /// + /// The azure account object + /// The azure environment object + /// The AD tenant in most cases should be 'common' + /// The AD account password + /// The prompt behavior + /// Token Cache + /// Optional, the AD resource id + /// + IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + TokenCache tokenCache, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId); + + /// + /// Returns IAccessToken if authentication succeeds or throws an exception if authentication fails. + /// + /// The azure account object + /// The azure environment object + /// The AD tenant in most cases should be 'common' + /// The AD account password + /// The prompt behavior + /// Optional, the AD resource id + /// + IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId); + + SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context); + SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context, AzureEnvironment.Endpoint targetEndpoint); + + ServiceClientCredentials GetServiceClientCredentials(AzureContext context); + + ServiceClientCredentials GetServiceClientCredentials(AzureContext context, + AzureEnvironment.Endpoint targetEndpoint); + } +} diff --git a/src/Common/Commands.Common.Authentication/Interfaces/IClientFactory.cs b/src/Common/Commands.Common.Authentication/Interfaces/IClientFactory.cs new file mode 100644 index 000000000000..eda7b9073431 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Interfaces/IClientFactory.cs @@ -0,0 +1,66 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public interface IClientFactory + { + TClient CreateArmClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient; + + TClient CreateCustomArmClient(params object[] parameters) where TClient : Microsoft.Rest.ServiceClient; + + TClient CreateClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + TClient CreateClient(AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + TClient CreateClient(AzureSMProfile profile, AzureSubscription subscription, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + TClient CreateCustomClient(params object[] parameters) where TClient : ServiceClient; + + HttpClient CreateHttpClient(string endpoint, ICredentials credentials); + + HttpClient CreateHttpClient(string endpoint, HttpMessageHandler effectiveHandler); + + void AddAction(IClientAction action); + + void RemoveAction(Type actionType); + + void AddHandler(T handler) where T: DelegatingHandler, ICloneable; + + void RemoveHandler(Type handlerType); + + /// + /// Adds user agent to UserAgents collection with empty version. + /// + /// Product name. + void AddUserAgent(string productName); + + /// + /// Adds user agent to UserAgents collection. + /// + /// Product name. + /// Product version. + void AddUserAgent(string productName, string productVersion); + + HashSet UserAgents { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Interfaces/IDataStore.cs b/src/Common/Commands.Common.Authentication/Interfaces/IDataStore.cs new file mode 100644 index 000000000000..22121f1fd861 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Interfaces/IDataStore.cs @@ -0,0 +1,67 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.IO; +using System.Security.Cryptography.X509Certificates; +using System.Text; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public interface IDataStore + { + void WriteFile(string path, string contents); + + void WriteFile(string path, string content, Encoding encoding); + + void WriteFile(string path, byte[] contents); + + string ReadFileAsText(string path); + + Stream ReadFileAsStream(string path); + + byte[] ReadFileAsBytes(string path); + + void RenameFile(string oldPath, string newPath); + + void CopyFile(string oldPath, string newPath); + + bool FileExists(string path); + + void DeleteFile(string path); + + void DeleteDirectory(string dir); + + void EmptyDirectory(string dirPath); + + bool DirectoryExists(string path); + + void CreateDirectory(string path); + + string[] GetDirectories(string sourceDirName); + + string[] GetDirectories(string startDirectory, string filePattern, SearchOption options); + + string[] GetFiles(string sourceDirName); + + string[] GetFiles(string startDirectory, string filePattern, SearchOption options); + + FileAttributes GetFileAttributes(string path); + + X509Certificate2 GetCertificate(string thumbprint); + + void AddCertificate(X509Certificate2 cert); + + void RemoveCertificate(string thumbprint); + } +} diff --git a/src/Common/Commands.Common.Authentication/Interfaces/IProfileSerializer.cs b/src/Common/Commands.Common.Authentication/Interfaces/IProfileSerializer.cs new file mode 100644 index 000000000000..a847da23d859 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Interfaces/IProfileSerializer.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; +using System.Collections.Generic; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public interface IProfileSerializer + { + string Serialize(AzureSMProfile profile); + + bool Deserialize(string contents, AzureSMProfile profile); + + IList DeserializeErrors { get; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureAccount.Methods.cs b/src/Common/Commands.Common.Authentication/Models/AzureAccount.Methods.cs new file mode 100644 index 000000000000..4923ee75562c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureAccount.Methods.cs @@ -0,0 +1,145 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Utilities; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public partial class AzureAccount + { + public AzureAccount() + { + Properties = new Dictionary(); + } + + public string GetProperty(Property property) + { + return Properties.GetProperty(property); + } + + public string[] GetPropertyAsArray(Property property) + { + return Properties.GetPropertyAsArray(property); + } + + public void SetProperty(Property property, params string[] values) + { + Properties.SetProperty(property, values); + } + + public void SetOrAppendProperty(Property property, params string[] values) + { + Properties.SetOrAppendProperty(property, values); + } + + public bool IsPropertySet(Property property) + { + return Properties.IsPropertySet(property); + } + + public List GetSubscriptions(AzureSMProfile profile) + { + string subscriptions = string.Empty; + List subscriptionsList = new List(); + if (Properties.ContainsKey(Property.Subscriptions)) + { + subscriptions = Properties[Property.Subscriptions]; + } + + foreach (var subscription in subscriptions.Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries)) + { + try + { + Guid subscriptionId = new Guid(subscription); + Debug.Assert(profile.Subscriptions.ContainsKey(subscriptionId)); + subscriptionsList.Add(profile.Subscriptions[subscriptionId]); + } + catch + { + // Skip + } + } + + return subscriptionsList; + } + + public bool HasSubscription(Guid subscriptionId) + { + bool exists = false; + string subscriptions = GetProperty(Property.Subscriptions); + + if (!string.IsNullOrEmpty(subscriptions)) + { + exists = subscriptions.Contains(subscriptionId.ToString()); + } + + return exists; + } + + public void SetSubscriptions(List subscriptions) + { + if (subscriptions == null || subscriptions.Count == 0) + { + if (Properties.ContainsKey(Property.Subscriptions)) + { + Properties.Remove(Property.Subscriptions); + } + } + else + { + string value = string.Join(",", subscriptions.Select(s => s.Id.ToString())); + Properties[Property.Subscriptions] = value; + } + } + + public void RemoveSubscription(Guid id) + { + if (HasSubscription(id)) + { + var remainingSubscriptions = GetPropertyAsArray(Property.Subscriptions).Where(s => s != id.ToString()).ToArray(); + + if (remainingSubscriptions.Any()) + { + Properties[Property.Subscriptions] = string.Join(",", remainingSubscriptions); + } + else + { + Properties.Remove(Property.Subscriptions); + } + } + } + + public override bool Equals(object obj) + { + var anotherAccount = obj as AzureAccount; + if (anotherAccount == null) + { + return false; + } + else + { + return string.Equals(anotherAccount.Id, Id, StringComparison.InvariantCultureIgnoreCase); + } + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureAccount.cs b/src/Common/Commands.Common.Authentication/Models/AzureAccount.cs new file mode 100644 index 000000000000..334a547150f1 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureAccount.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + [Serializable] + public partial class AzureAccount + { + public string Id { get; set; } + + public AccountType Type { get; set; } + + public Dictionary Properties { get; set; } + + public enum AccountType + { + Certificate, + User, + ServicePrincipal, + AccessToken + } + + public enum Property + { + /// + /// Comma separated list of subscription ids on this account. + /// + Subscriptions, + + /// + /// Comma separated list of tenants on this account. + /// + Tenants, + + /// + /// Access token. + /// + AccessToken, + + /// + /// Thumbprint for associated certificate + /// + CertificateThumbprint + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureContext.cs b/src/Common/Commands.Common.Authentication/Models/AzureContext.cs new file mode 100644 index 000000000000..c5c4f3c20ae8 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureContext.cs @@ -0,0 +1,90 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Newtonsoft.Json; +using System; +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + /// + /// Represents current Azure session context. + /// + [Serializable] + public class AzureContext + { + /// + /// Creates new instance of AzureContext. + /// + /// The azure subscription object + /// The azure account object + /// The azure environment object + public AzureContext(AzureSubscription subscription, AzureAccount account, AzureEnvironment environment) + : this(subscription, account, environment, null) + { + + } + + /// + /// Creates new instance of AzureContext. + /// + /// The azure account object + /// The azure environment object + /// The azure tenant object + public AzureContext(AzureAccount account, AzureEnvironment environment, AzureTenant tenant) + : this(null, account, environment, tenant) + { + + } + + /// + /// Creates new instance of AzureContext. + /// + /// The azure subscription object + /// The azure account object + /// The azure environment object + /// The azure tenant object + [JsonConstructor] + public AzureContext(AzureSubscription subscription, AzureAccount account, AzureEnvironment environment, AzureTenant tenant) + { + Subscription = subscription; + Account = account; + Environment = environment; + Tenant = tenant; + } + + /// + /// Gets the azure account. + /// + public AzureAccount Account { get; private set; } + + /// + /// Gets the azure subscription. + /// + public AzureSubscription Subscription { get; private set; } + + /// + /// Gets the azure environment. + /// + public AzureEnvironment Environment { get; private set; } + + /// + /// Gets the azure tenant. + /// + public AzureTenant Tenant { get; private set; } + + /// + /// Gets or sets the token cache contents. + /// + public byte[] TokenCache { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureEnvironment.Methods.cs b/src/Common/Commands.Common.Authentication/Models/AzureEnvironment.Methods.cs new file mode 100644 index 000000000000..e03beb5dd6e0 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureEnvironment.Methods.cs @@ -0,0 +1,422 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using Microsoft.Azure.Commands.Common.Authentication.Utilities; +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public partial class AzureEnvironment + { + /// + /// Predefined Microsoft Azure environments + /// + public static Dictionary PublicEnvironments + { + get { return environments; } + } + + private const string storageFormatTemplate = "{{0}}://{{1}}.{0}.{1}/"; + + private string EndpointFormatFor(string service) + { + string suffix = GetEndpointSuffix(AzureEnvironment.Endpoint.StorageEndpointSuffix); + + if (!string.IsNullOrEmpty(suffix)) + { + suffix = string.Format(storageFormatTemplate, service, suffix); + } + + return suffix; + } + + /// + /// The storage service blob endpoint format. + /// + private string StorageBlobEndpointFormat() + { + return EndpointFormatFor("blob"); + } + + /// + /// The storage service queue endpoint format. + /// + private string StorageQueueEndpointFormat() + { + return EndpointFormatFor("queue"); + } + + /// + /// The storage service table endpoint format. + /// + private string StorageTableEndpointFormat() + { + return EndpointFormatFor("table"); + } + + /// + /// The storage service file endpoint format. + /// + private string StorageFileEndpointFormat() + { + return EndpointFormatFor("file"); + } + + private static readonly Dictionary environments = + new Dictionary(StringComparer.InvariantCultureIgnoreCase) + { + { + EnvironmentName.AzureCloud, + new AzureEnvironment + { + Name = EnvironmentName.AzureCloud, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, AzureEnvironmentConstants.AzurePublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ServiceManagement, AzureEnvironmentConstants.AzureServiceEndpoint }, + { AzureEnvironment.Endpoint.ResourceManager, AzureEnvironmentConstants.AzureResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, AzureEnvironmentConstants.AzureManagementPortalUrl }, + { AzureEnvironment.Endpoint.ActiveDirectory, AzureEnvironmentConstants.AzureActiveDirectoryEndpoint }, + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, AzureEnvironmentConstants.AzureServiceEndpoint }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, AzureEnvironmentConstants.AzureStorageEndpointSuffix }, + { AzureEnvironment.Endpoint.Gallery, AzureEnvironmentConstants.GalleryEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.AzureSqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.AzureGraphEndpoint }, + { AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, AzureEnvironmentConstants.AzureTrafficManagerDnsSuffix }, + { AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.AzureKeyVaultDnsSuffix}, + { AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.AzureKeyVaultServiceEndpointResourceId}, + { AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, AzureEnvironmentConstants.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix}, + { AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, AzureEnvironmentConstants.AzureDataLakeStoreFileSystemEndpointSuffix}, + { AzureEnvironment.Endpoint.GraphEndpointResourceId, AzureEnvironmentConstants.AzureGraphEndpoint} + } + } + }, + { + EnvironmentName.AzureChinaCloud, + new AzureEnvironment + { + Name = EnvironmentName.AzureChinaCloud, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, AzureEnvironmentConstants.ChinaPublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ServiceManagement, AzureEnvironmentConstants.ChinaServiceEndpoint }, + { AzureEnvironment.Endpoint.ResourceManager, AzureEnvironmentConstants.ChinaResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, AzureEnvironmentConstants.ChinaManagementPortalUrl }, + { AzureEnvironment.Endpoint.ActiveDirectory, AzureEnvironmentConstants.ChinaActiveDirectoryEndpoint }, + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, AzureEnvironmentConstants.ChinaServiceEndpoint }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, AzureEnvironmentConstants.ChinaStorageEndpointSuffix }, + { AzureEnvironment.Endpoint.Gallery, AzureEnvironmentConstants.ChinaGalleryEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.ChinaSqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.ChinaGraphEndpoint }, + { AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, AzureEnvironmentConstants.ChinaTrafficManagerDnsSuffix }, + { AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.ChinaKeyVaultDnsSuffix }, + { AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.ChinaKeyVaultServiceEndpointResourceId }, + { AzureEnvironment.Endpoint.GraphEndpointResourceId, AzureEnvironmentConstants.ChinaGraphEndpoint} + // TODO: DataLakeAnalytics and ADL do not have a China endpoint yet. Once they do, add them here. + } + } + }, + { + EnvironmentName.AzureUSGovernment, + new AzureEnvironment + { + Name = EnvironmentName.AzureUSGovernment, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, AzureEnvironmentConstants.USGovernmentPublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ServiceManagement, AzureEnvironmentConstants.USGovernmentServiceEndpoint }, + { AzureEnvironment.Endpoint.ResourceManager, AzureEnvironmentConstants.USGovernmentResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, AzureEnvironmentConstants.USGovernmentManagementPortalUrl }, + { AzureEnvironment.Endpoint.ActiveDirectory, AzureEnvironmentConstants.USGovernmentActiveDirectoryEndpoint }, + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, AzureEnvironmentConstants.USGovernmentServiceEndpoint }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, AzureEnvironmentConstants.USGovernmentStorageEndpointSuffix }, + { AzureEnvironment.Endpoint.Gallery, AzureEnvironmentConstants.USGovernmentGalleryEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.USGovernmentSqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.USGovernmentGraphEndpoint }, + { AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, null }, + { AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.USGovernmentKeyVaultDnsSuffix}, + { AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.USGovernmentKeyVaultServiceEndpointResourceId}, + { AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, null}, + { AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, null}, + {AzureEnvironment.Endpoint.GraphEndpointResourceId, AzureEnvironmentConstants.USGovernmentGraphEndpoint} + } + } + } + }; + + public Uri GetEndpointAsUri(AzureEnvironment.Endpoint endpoint) + { + if (Endpoints.ContainsKey(endpoint)) + { + return new Uri(Endpoints[endpoint]); + } + + return null; + } + + public string GetEndpoint(AzureEnvironment.Endpoint endpoint) + { + if (Endpoints.ContainsKey(endpoint)) + { + return Endpoints[endpoint]; + } + + return null; + } + + public AzureEnvironment.Endpoint GetTokenAudience(AzureEnvironment.Endpoint targetEndpoint) + { + return targetEndpoint == AzureEnvironment.Endpoint.Graph + ? AzureEnvironment.Endpoint.GraphEndpointResourceId + : AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId; + } + + + + public bool IsEndpointSet(AzureEnvironment.Endpoint endpoint) + { + return Endpoints.IsPropertySet(endpoint); + } + + public bool IsEndpointSetToValue(AzureEnvironment.Endpoint endpoint, string url) + { + if (url == null && !Endpoints.IsPropertySet(endpoint)) + { + return true; + } + if (url != null && Endpoints.IsPropertySet(endpoint)) + { + return GetEndpoint(endpoint) + .Trim(new[] { '/' }) + .Equals(url.Trim(new[] { '/' }), StringComparison.InvariantCultureIgnoreCase); + } + return false; + } + + public string GetEndpointSuffix(AzureEnvironment.Endpoint endpointSuffix) + { + if (Endpoints.ContainsKey(endpointSuffix)) + { + return Endpoints[endpointSuffix]; + } + + return null; + } + + /// + /// Gets the endpoint for storage blob. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the blob service + public Uri GetStorageBlobEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageBlobEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the endpoint for storage queue. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the queue service + public Uri GetStorageQueueEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageQueueEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the endpoint for storage table. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the table service + public Uri GetStorageTableEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageTableEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the endpoint for storage file. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the file service + public Uri GetStorageFileEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageFileEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the management portal URI with a particular realm suffix if supplied + /// + /// Realm for user's account + /// Url to management portal. + public string GetManagementPortalUrlWithRealm(string realm = null) + { + if (realm != null) + { + realm = string.Format(Resources.PublishSettingsFileRealmFormat, realm); + } + else + { + realm = string.Empty; + } + return GetEndpointAsUri(Endpoint.ManagementPortalUrl) + realm; + } + + /// + /// Get the publish settings file download url with a realm suffix if needed. + /// + /// Realm for user's account + /// Url to publish settings file + public string GetPublishSettingsFileUrlWithRealm(string realm = null) + { + if (realm != null) + { + realm = string.Format(Resources.PublishSettingsFileRealmFormat, realm); + } + else + { + realm = string.Empty; + } + return GetEndpointAsUri(Endpoint.PublishSettingsFileUrl) + realm; + } + + public enum Endpoint + { + ActiveDirectoryServiceEndpointResourceId, + + AdTenant, + + Gallery, + + ManagementPortalUrl, + + ServiceManagement, + + PublishSettingsFileUrl, + + ResourceManager, + + SqlDatabaseDnsSuffix, + + StorageEndpointSuffix, + + ActiveDirectory, + + Graph, + + TrafficManagerDnsSuffix, + + AzureKeyVaultDnsSuffix, + + AzureKeyVaultServiceEndpointResourceId, + + AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, + + AzureDataLakeStoreFileSystemEndpointSuffix, + + GraphEndpointResourceId + } + } + + public static class EnvironmentName + { + public const string AzureCloud = "AzureCloud"; + + public const string AzureChinaCloud = "AzureChinaCloud"; + + public const string AzureUSGovernment = "AzureUSGovernment"; + } + + public static class AzureEnvironmentConstants + { + public const string AzureServiceEndpoint = "https://management.core.windows.net/"; + + public const string ChinaServiceEndpoint = "https://management.core.chinacloudapi.cn/"; + + public const string USGovernmentServiceEndpoint = "https://management.core.usgovcloudapi.net/"; + + public const string AzureResourceManagerEndpoint = "https://management.azure.com/"; + + public const string ChinaResourceManagerEndpoint = "https://management.chinacloudapi.cn/"; + + public const string USGovernmentResourceManagerEndpoint = "https://management.usgovcloudapi.net/"; + + public const string GalleryEndpoint = "https://gallery.azure.com/"; + + public const string ChinaGalleryEndpoint = "https://gallery.chinacloudapi.cn/"; + + public const string USGovernmentGalleryEndpoint = "https://gallery.usgovcloudapi.net/"; + + public const string AzurePublishSettingsFileUrl = "http://go.microsoft.com/fwlink/?LinkID=301775"; + + public const string ChinaPublishSettingsFileUrl = "http://go.microsoft.com/fwlink/?LinkID=301776"; + + public const string USGovernmentPublishSettingsFileUrl = "https://manage.windowsazure.us/publishsettings/index"; + + public const string AzureManagementPortalUrl = "http://go.microsoft.com/fwlink/?LinkId=254433"; + + public const string ChinaManagementPortalUrl = "http://go.microsoft.com/fwlink/?LinkId=301902"; + + public const string USGovernmentManagementPortalUrl = "https://manage.windowsazure.us"; + + public const string AzureStorageEndpointSuffix = "core.windows.net"; + + public const string ChinaStorageEndpointSuffix = "core.chinacloudapi.cn"; + + public const string USGovernmentStorageEndpointSuffix = "core.usgovcloudapi.net"; + + public const string AzureSqlDatabaseDnsSuffix = ".database.windows.net"; + + public const string ChinaSqlDatabaseDnsSuffix = ".database.chinacloudapi.cn"; + + public const string USGovernmentSqlDatabaseDnsSuffix = ".database.usgovcloudapi.net"; + + public const string AzureActiveDirectoryEndpoint = "https://login.microsoftonline.com/"; + + public const string ChinaActiveDirectoryEndpoint = "https://login.chinacloudapi.cn/"; + + public const string USGovernmentActiveDirectoryEndpoint = "https://login.microsoftonline.com/"; + + public const string AzureGraphEndpoint = "https://graph.windows.net/"; + + public const string ChinaGraphEndpoint = "https://graph.chinacloudapi.cn/"; + + public const string USGovernmentGraphEndpoint = "https://graph.windows.net/"; + + public const string AzureTrafficManagerDnsSuffix = "trafficmanager.net"; + + public const string ChinaTrafficManagerDnsSuffix = "trafficmanager.cn"; + + public const string AzureKeyVaultDnsSuffix = "vault.azure.net"; + + public const string ChinaKeyVaultDnsSuffix = "vault.azure.cn"; + + public const string USGovernmentKeyVaultDnsSuffix = "vault.usgovcloudapi.net"; + + public const string AzureKeyVaultServiceEndpointResourceId = "https://vault.azure.net"; + + public const string ChinaKeyVaultServiceEndpointResourceId = "https://vault.azure.cn"; + + public const string USGovernmentKeyVaultServiceEndpointResourceId = "https://vault.usgovcloudapi.net"; + + public const string AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix = "azuredatalakeanalytics.net"; + + public const string AzureDataLakeStoreFileSystemEndpointSuffix = "azuredatalakestore.net"; + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureEnvironment.cs b/src/Common/Commands.Common.Authentication/Models/AzureEnvironment.cs new file mode 100644 index 000000000000..8d4da201f47b --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureEnvironment.cs @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + [Serializable] + public partial class AzureEnvironment + { + public AzureEnvironment() + { + Endpoints = new Dictionary(); + } + + public string Name { get; set; } + + public bool OnPremise { get; set; } + + public Dictionary Endpoints { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureRMProfile.cs b/src/Common/Commands.Common.Authentication/Models/AzureRMProfile.cs new file mode 100644 index 000000000000..0fbfeb878d60 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureRMProfile.cs @@ -0,0 +1,147 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + /// + /// Represents Azure Resource Manager profile structure with default context, environments and token cache. + /// + [Serializable] + public sealed class AzureRMProfile : IAzureProfile + { + /// + /// Gets or sets Azure environments. + /// + public Dictionary Environments { get; set; } + + /// + /// Gets or sets the default azure context object. + /// + public AzureContext Context { get; set; } + + /// + /// Gets the path of the profile file. + /// + [JsonIgnore] + public string ProfilePath { get; private set; } + + private void Load(string path) + { + this.ProfilePath = path; + + if (!AzureSession.DataStore.DirectoryExists(AzureSession.ProfileDirectory)) + { + AzureSession.DataStore.CreateDirectory(AzureSession.ProfileDirectory); + } + + if (AzureSession.DataStore.FileExists(ProfilePath)) + { + string contents = AzureSession.DataStore.ReadFileAsText(ProfilePath); + AzureRMProfile profile = JsonConvert.DeserializeObject(contents); + Debug.Assert(profile != null); + this.Context = profile.Context; + this.Environments = profile.Environments; + } + } + + /// + /// Creates new instance of AzureRMProfile. + /// + public AzureRMProfile() + { + Environments = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + // Adding predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + + /// + /// Initializes a new instance of AzureRMProfile and loads its content from specified path. + /// + /// The location of profile file on disk. + public AzureRMProfile(string path) : this() + { + Load(path); + } + + /// + /// Writes profile to the disk it was opened from disk. + /// + public void Save() + { + if (!string.IsNullOrEmpty(ProfilePath)) + { + Save(ProfilePath); + } + } + + /// + /// Writes profile to a specified path. + /// + /// File path on disk to save profile to + public void Save(string path) + { + if (string.IsNullOrEmpty(path)) + { + return; + } + + // Removing predefined environments + foreach (string env in AzureEnvironment.PublicEnvironments.Keys) + { + Environments.Remove(env); + } + + try + { + string contents = ToString(); + string diskContents = string.Empty; + if (AzureSession.DataStore.FileExists(path)) + { + diskContents = AzureSession.DataStore.ReadFileAsText(path); + } + + if (diskContents != contents) + { + AzureSession.DataStore.WriteFile(path, contents); + } + } + finally + { + // Adding back predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + } + + /// + /// Serializes the current profile and return its contents. + /// + /// The current string. + public override string ToString() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureSMProfile.cs b/src/Common/Commands.Common.Authentication/Models/AzureSMProfile.cs new file mode 100644 index 000000000000..6d356de3f673 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureSMProfile.cs @@ -0,0 +1,240 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + /// + /// Represents Azure profile structure with multiple environments, subscriptions, and accounts. + /// + [Serializable] + public sealed class AzureSMProfile : IAzureProfile + { + /// + /// Gets Azure Accounts + /// + public Dictionary Accounts { get; set; } + + /// + /// Gets Azure Subscriptions + /// + public Dictionary Subscriptions { get; set; } + + /// + /// Gets or sets current Azure Subscription + /// + public AzureSubscription DefaultSubscription + { + get + { + return Subscriptions.Values.FirstOrDefault( + s => s.Properties.ContainsKey(AzureSubscription.Property.Default)); + } + + set + { + if (value == null) + { + foreach (var subscription in Subscriptions.Values) + { + subscription.SetProperty(AzureSubscription.Property.Default, null); + } + } + else if (Subscriptions.ContainsKey(value.Id)) + { + foreach (var subscription in Subscriptions.Values) + { + subscription.SetProperty(AzureSubscription.Property.Default, null); + } + + Subscriptions[value.Id].Properties[AzureSubscription.Property.Default] = "True"; + value.Properties[AzureSubscription.Property.Default] = "True"; + } + } + } + + /// + /// Gets Azure Environments + /// + public Dictionary Environments { get; set; } + + /// + /// Gets the default azure context object. + /// + [JsonIgnore] + public AzureContext Context + { + get + { + var context = new AzureContext(null, null, null, null); + + if (DefaultSubscription != null) + { + AzureAccount account = null; + AzureEnvironment environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud]; + if (DefaultSubscription.Account != null && + Accounts.ContainsKey(DefaultSubscription.Account)) + { + account = Accounts[DefaultSubscription.Account]; + } + else + { + TracingAdapter.Information(Resources.NoAccountInContext, DefaultSubscription.Account, DefaultSubscription.Id); + } + + if (DefaultSubscription.Environment != null && + Environments.ContainsKey(DefaultSubscription.Environment)) + { + environment = Environments[DefaultSubscription.Environment]; + } + else + { + TracingAdapter.Information(Resources.NoEnvironmentInContext, DefaultSubscription.Environment, DefaultSubscription.Id); + } + + context = new AzureContext(DefaultSubscription, account, environment); + } + + return context; + } + } + + /// + /// Gets errors from loading the profile. + /// + public List ProfileLoadErrors { get; private set; } + + /// + /// Location of the profile file. + /// + public string ProfilePath { get; private set; } + + /// + /// Initializes a new instance of AzureSMProfile + /// + public AzureSMProfile() + { + Environments = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + Subscriptions = new Dictionary(); + Accounts = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + // Adding predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + + /// + /// Initializes a new instance of AzureSMProfile and loads its content from specified path. + /// Any errors generated in the process are stored in ProfileLoadErrors collection. + /// + /// Location of profile file on disk. + public AzureSMProfile(string path) : this() + { + ProfilePath = path; + ProfileLoadErrors = new List(); + + if (!AzureSession.DataStore.DirectoryExists(AzureSession.ProfileDirectory)) + { + AzureSession.DataStore.CreateDirectory(AzureSession.ProfileDirectory); + } + + if (AzureSession.DataStore.FileExists(ProfilePath)) + { + string contents = AzureSession.DataStore.ReadFileAsText(ProfilePath); + + IProfileSerializer serializer; + + if (CloudException.IsXml(contents)) + { + serializer = new XmlProfileSerializer(); + if (!serializer.Deserialize(contents, this)) + { + ProfileLoadErrors.AddRange(serializer.DeserializeErrors); + } + } + else if (CloudException.IsJson(contents)) + { + serializer = new JsonProfileSerializer(); + if (!serializer.Deserialize(contents, this)) + { + ProfileLoadErrors.AddRange(serializer.DeserializeErrors); + } + } + } + } + + /// + /// Writes profile to a ProfilePath + /// + public void Save() + { + Save(ProfilePath); + } + + /// + /// Writes profile to a specified path. + /// + /// File path on disk to save profile to + public void Save(string path) + { + if (string.IsNullOrEmpty(path)) + { + return; + } + + // Removing predefined environments + foreach (string env in AzureEnvironment.PublicEnvironments.Keys) + { + Environments.Remove(env); + } + + try + { + string contents = ToString(); + string diskContents = string.Empty; + if (AzureSession.DataStore.FileExists(path)) + { + diskContents = AzureSession.DataStore.ReadFileAsText(path); + } + + if (diskContents != contents) + { + AzureSession.DataStore.WriteFile(path, contents); + } + } + finally + { + // Adding back predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + } + + public override string ToString() + { + JsonProfileSerializer jsonSerializer = new JsonProfileSerializer(); + return jsonSerializer.Serialize(this); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureSubscription.Methods.cs b/src/Common/Commands.Common.Authentication/Models/AzureSubscription.Methods.cs new file mode 100644 index 000000000000..72e9df3c4386 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureSubscription.Methods.cs @@ -0,0 +1,70 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Utilities; +using System.Collections.Generic; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public partial class AzureSubscription + { + public AzureSubscription() + { + Properties = new Dictionary(); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + + public string GetProperty(Property property) + { + return Properties.GetProperty(property); + } + + public string[] GetPropertyAsArray(Property property) + { + return Properties.GetPropertyAsArray(property); + } + + public void SetProperty(Property property, params string[] values) + { + Properties.SetProperty(property, values); + } + + public void SetOrAppendProperty(Property property, params string[] values) + { + Properties.SetOrAppendProperty(property, values); + } + + public bool IsPropertySet(Property property) + { + return Properties.IsPropertySet(property); + } + + public override bool Equals(object obj) + { + var anotherSubscription = obj as AzureSubscription; + if (anotherSubscription == null) + { + return false; + } + else + { + return anotherSubscription.Id == Id; + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureSubscription.cs b/src/Common/Commands.Common.Authentication/Models/AzureSubscription.cs new file mode 100644 index 000000000000..2ae95d2284f8 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureSubscription.cs @@ -0,0 +1,55 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + [Serializable] + public partial class AzureSubscription + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public string Environment { get; set; } + + public string Account { get; set; } + + public string State { get; set; } + + public Dictionary Properties { get; set; } + + public enum Property + { + /// + /// Comma separated registered resource providers, i.e.: websites,compute,hdinsight + /// + RegisteredResourceProviders, + + /// + /// Associated tenants + /// + Tenants, + + /// + /// If this property existed on the subscription indicates that it's default one. + /// + Default, + + StorageAccount + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/AzureTenant.cs b/src/Common/Commands.Common.Authentication/Models/AzureTenant.cs new file mode 100644 index 000000000000..f02c0ac8777f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/AzureTenant.cs @@ -0,0 +1,35 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + /// + /// Represents an AD tenant. + /// + [Serializable] + public class AzureTenant + { + /// + /// Gets or sets the tenant id. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the tenant domain. + /// + public string Domain { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/DiskDataStore.cs b/src/Common/Commands.Common.Authentication/Models/DiskDataStore.cs new file mode 100644 index 000000000000..cf1f15302307 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/DiskDataStore.cs @@ -0,0 +1,180 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using System; +using System.IO; +using System.Security.Cryptography.X509Certificates; +using System.Text; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public class DiskDataStore : IDataStore + { + public void WriteFile(string path, string contents) + { + File.WriteAllText(path, contents); + } + + public void WriteFile(string path, string contents, Encoding encoding) + { + File.WriteAllText(path, contents, encoding); + } + + public void WriteFile(string path, byte[] contents) + { + File.WriteAllBytes(path, contents); + } + + public string ReadFileAsText(string path) + { + return File.ReadAllText(path); + } + + public byte[] ReadFileAsBytes(string path) + { + return File.ReadAllBytes(path); + } + + public Stream ReadFileAsStream(string path) + { + return File.Open(path, FileMode.Open, FileAccess.Read); + } + + public void RenameFile(string oldPath, string newPath) + { + File.Move(oldPath, newPath); + } + + public void CopyFile(string oldPath, string newPath) + { + File.Copy(oldPath, newPath, true); + } + + public bool FileExists(string path) + { + return File.Exists(path); + } + + public void DeleteFile(string path) + { + File.Delete(path); + } + + public void DeleteDirectory(string dir) + { + Directory.Delete(dir, true); + } + + public void EmptyDirectory(string dirPath) + { + foreach (var filePath in Directory.GetFiles(dirPath)) + { + File.Delete(filePath); + } + } + + public string[] GetFiles(string sourceDirName) + { + return Directory.GetFiles(sourceDirName); + } + + public string[] GetFiles(string startDirectory, string filePattern, SearchOption options) + { + return Directory.GetFiles(startDirectory, filePattern, options); + } + + public FileAttributes GetFileAttributes(string path) + { + return File.GetAttributes(path); + } + + public X509Certificate2 GetCertificate(string thumbprint) + { + if (thumbprint == null) + { + return null; + } + else + { + Validate.ValidateStringIsNullOrEmpty(thumbprint, "certificate thumbprint"); + X509Certificate2Collection certificates; + if (TryFindCertificatesInStore(thumbprint, StoreLocation.CurrentUser, out certificates) || + TryFindCertificatesInStore(thumbprint, StoreLocation.LocalMachine, out certificates)) + { + return certificates[0]; + } + else + { + throw new ArgumentException(string.Format(Resources.CertificateNotFoundInStore, thumbprint)); + } + } + } + + private static bool TryFindCertificatesInStore(string thumbprint, + StoreLocation location, out X509Certificate2Collection certificates) + { + X509Store store = new X509Store(StoreName.My, location); + store.Open(OpenFlags.ReadOnly); + certificates = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false); + store.Close(); + + return certificates.Count > 0; + } + + public void AddCertificate(X509Certificate2 certificate) + { + Validate.ValidateNullArgument(certificate, Resources.InvalidCertificate); + X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); + store.Open(OpenFlags.ReadWrite); + store.Add(certificate); + store.Close(); + } + + public void RemoveCertificate(string thumbprint) + { + if (thumbprint != null) + { + var certificate = GetCertificate(thumbprint); + if (certificate != null) + { + X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); + store.Open(OpenFlags.ReadWrite); + store.Remove(certificate); + store.Close(); + } + } + } + + public bool DirectoryExists(string path) + { + return Directory.Exists(path); + } + + public void CreateDirectory(string path) + { + Directory.CreateDirectory(path); + } + + public string[] GetDirectories(string sourceDirName) + { + return Directory.GetDirectories(sourceDirName); + } + + public string[] GetDirectories(string startDirectory, string filePattern, SearchOption options) + { + return Directory.GetDirectories(startDirectory, filePattern, options); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/IAzureProfile.cs b/src/Common/Commands.Common.Authentication/Models/IAzureProfile.cs new file mode 100644 index 000000000000..bdb1784d8881 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/IAzureProfile.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + /// + /// Interface for Azure supported profiles. + /// + public interface IAzureProfile + { + /// + /// Gets the default azure context object. + /// + AzureContext Context { get; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/IClientAction.cs b/src/Common/Commands.Common.Authentication/Models/IClientAction.cs new file mode 100644 index 000000000000..eea6e424d270 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/IClientAction.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public interface IClientAction + { + IClientFactory ClientFactory { get; set; } + + void Apply(TClient client, AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + void ApplyArm(TClient client, AzureRMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient; + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/JsonProfileSerializer.cs b/src/Common/Commands.Common.Authentication/Models/JsonProfileSerializer.cs new file mode 100644 index 000000000000..3510ea1e5a54 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/JsonProfileSerializer.cs @@ -0,0 +1,91 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public class JsonProfileSerializer : IProfileSerializer + { + public string Serialize(AzureSMProfile profile) + { + return JsonConvert.SerializeObject(new + { + Environments = profile.Environments.Values.ToList(), + Subscriptions = profile.Subscriptions.Values.ToList(), + Accounts = profile.Accounts.Values.ToList() + }, Formatting.Indented); + } + + public bool Deserialize(string contents, AzureSMProfile profile) + { + DeserializeErrors = new List(); + + try + { + var jsonProfile = JObject.Parse(contents); + + foreach (var env in jsonProfile["Environments"]) + { + try + { + profile.Environments[(string) env["Name"]] = + JsonConvert.DeserializeObject(env.ToString()); + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + } + + foreach (var subscription in jsonProfile["Subscriptions"]) + { + try + { + profile.Subscriptions[new Guid((string) subscription["Id"])] = + JsonConvert.DeserializeObject(subscription.ToString()); + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + } + + foreach (var account in jsonProfile["Accounts"]) + { + try + { + profile.Accounts[(string) account["Id"]] = + JsonConvert.DeserializeObject(account.ToString()); + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + } + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + return DeserializeErrors.Count == 0; + } + + public IList DeserializeErrors { get; private set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/MemoryDataStore.cs b/src/Common/Commands.Common.Authentication/Models/MemoryDataStore.cs new file mode 100644 index 000000000000..e9b1b6892a1e --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/MemoryDataStore.cs @@ -0,0 +1,317 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Text.RegularExpressions; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public class MemoryDataStore : IDataStore + { + private Dictionary virtualStore = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + private Dictionary certStore = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + private const string FolderKey = "Folder"; + + public Dictionary VirtualStore + { + get { return virtualStore; } + set { virtualStore = value; } + } + + public void WriteFile(string path, string contents) + { + VirtualStore[path] = contents; + } + + public void WriteFile(string path, string contents, Encoding encoding) + { + WriteFile(path, contents); + } + + public void WriteFile(string path, byte[] contents) + { + VirtualStore[path] = Encoding.Default.GetString(contents); + } + + public string ReadFileAsText(string path) + { + if (VirtualStore.ContainsKey(path)) + { + return VirtualStore[path]; + } + else + { + throw new IOException("File not found: " + path); + } + } + + public Stream ReadFileAsStream(string path) + { + if (VirtualStore.ContainsKey(path)) + { + MemoryStream stream = new MemoryStream(); + StreamWriter writer = new StreamWriter(stream); + writer.Write(VirtualStore[path]); + writer.Flush(); + stream.Position = 0; + return stream; + } + else + { + throw new IOException("File not found: " + path); + } + } + + public byte[] ReadFileAsBytes(string path) + { + if (VirtualStore.ContainsKey(path)) + { + return Encoding.Default.GetBytes(VirtualStore[path]); + } + else + { + throw new IOException("File not found: " + path); + } + } + + public void RenameFile(string oldPath, string newPath) + { + if (VirtualStore.ContainsKey(oldPath)) + { + VirtualStore[newPath] = VirtualStore[oldPath]; + VirtualStore.Remove(oldPath); + } + else + { + throw new IOException("File not found: " + oldPath); + } + } + + public void CopyFile(string oldPath, string newPath) + { + if (VirtualStore.ContainsKey(oldPath)) + { + VirtualStore[newPath] = VirtualStore[oldPath]; + } + else + { + throw new IOException("File not found: " + oldPath); + } + } + + public bool FileExists(string path) + { + return VirtualStore.ContainsKey(path); + } + + public void DeleteFile(string path) + { + if (VirtualStore.ContainsKey(path)) + { + VirtualStore.Remove(path); + } + else + { + throw new IOException("File not found: " + path); + } + } + + public void DeleteDirectory(string dir) + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(dir)) + { + VirtualStore.Remove(key); + } + } + } + + public void EmptyDirectory(string dirPath) + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(dirPath)) + { + VirtualStore.Remove(key); + } + } + } + + public bool DirectoryExists(string path) + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(path)) + { + return true; + } + } + return false; + } + + public void CreateDirectory(string path) + { + VirtualStore[path] = FolderKey; + } + + public string[] GetDirectories(string sourceDirName) + { + HashSet dirs = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(sourceDirName)) + { + var directoryName = Path.GetDirectoryName(key); + if (!dirs.Contains(directoryName)) + { + dirs.Add(directoryName); + } + } + } + return dirs.ToArray(); + } + + public string[] GetDirectories(string startDirectory, string filePattern, SearchOption options) + { + HashSet dirs = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(startDirectory) && Regex.IsMatch(key, WildcardToRegex(filePattern), RegexOptions.IgnoreCase)) + { + var directoryName = Path.GetDirectoryName(key); + if (!dirs.Contains(directoryName)) + { + dirs.Add(directoryName); + } + } + } + return dirs.ToArray(); + } + + public string[] GetFiles(string sourceDirName) + { + HashSet files = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(sourceDirName) && VirtualStore[key] != FolderKey) + { + if (!files.Contains(key)) + { + files.Add(key); + } + } + } + return files.ToArray(); + } + + public string[] GetFiles(string startDirectory, string filePattern, SearchOption options) + { + HashSet files = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(startDirectory) && VirtualStore[key] != FolderKey && Regex.IsMatch(key, WildcardToRegex(filePattern), RegexOptions.IgnoreCase)) + { + if (!files.Contains(key)) + { + files.Add(key); + } + } + } + return files.ToArray(); + } + + public FileAttributes GetFileAttributes(string path) + { + if (VirtualStore[path] == FolderKey) + { + return FileAttributes.Directory; + } + if (VirtualStore.ContainsKey(path)) + { + return FileAttributes.Normal; + } + else + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(path)) + { + return FileAttributes.Directory; + } + } + throw new IOException("File not found: " + path); + } + } + + public X509Certificate2 GetCertificate(string thumbprint) + { + if (thumbprint != null && certStore.ContainsKey(thumbprint)) + { + return certStore[thumbprint]; + } + else + { + return new X509Certificate2(); + } + } + + public void AddCertificate(X509Certificate2 cert) + { + if (cert != null && cert.Thumbprint != null) + { + certStore[cert.Thumbprint] = cert; + } + } + + public void RemoveCertificate(string thumbprint) + { + if (thumbprint != null && certStore.ContainsKey(thumbprint)) + { + certStore.Remove(thumbprint); + } + } + + /// + /// Converts unix asterisk based file pattern to regex + /// + /// Asterisk based pattern + /// Regeular expression of null is empty + private static string WildcardToRegex(string wildcard) + { + if (wildcard == null || wildcard == "") return wildcard; + + StringBuilder sb = new StringBuilder(); + + char[] chars = wildcard.ToCharArray(); + for (int i = 0; i < chars.Length; ++i) + { + if (chars[i] == '*') + sb.Append(".*"); + else if (chars[i] == '?') + sb.Append("."); + else if ("+()^$.{}|\\".IndexOf(chars[i]) != -1) + sb.Append('\\').Append(chars[i]); // prefix all metacharacters with backslash + else + sb.Append(chars[i]); + } + return sb.ToString().ToLowerInvariant(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Models/XmlProfileSerializer.cs b/src/Common/Commands.Common.Authentication/Models/XmlProfileSerializer.cs new file mode 100644 index 000000000000..c1eda20aefef --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Models/XmlProfileSerializer.cs @@ -0,0 +1,95 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Microsoft.Azure.Commands.Common.Authentication.Models +{ + public class XmlProfileSerializer : IProfileSerializer + { + public string Serialize(AzureSMProfile obj) + { + // We do not use the serialize for xml serializer anymore and rely solely on the JSON serializer. + throw new NotImplementedException(); + } + + public bool Deserialize(string contents, AzureSMProfile profile) + { + ProfileData data; + Debug.Assert(profile != null); + + DeserializeErrors = new List(); + + DataContractSerializer serializer = new DataContractSerializer(typeof(ProfileData)); + using (MemoryStream s = new MemoryStream(Encoding.UTF8.GetBytes(contents ?? ""))) + { + data = (ProfileData)serializer.ReadObject(s); + } + + if (data != null) + { + foreach (AzureEnvironmentData oldEnv in data.Environments) + { + profile.Environments[oldEnv.Name] = oldEnv.ToAzureEnvironment(); + } + + List envs = profile.Environments.Values.ToList(); + foreach (AzureSubscriptionData oldSubscription in data.Subscriptions) + { + try + { + var newSubscription = oldSubscription.ToAzureSubscription(envs); + if (newSubscription.Account == null) + { + continue; + } + + var newAccounts = oldSubscription.ToAzureAccounts(); + foreach (var account in newAccounts) + { + if (profile.Accounts.ContainsKey(account.Id)) + { + profile.Accounts[account.Id].SetOrAppendProperty(AzureAccount.Property.Tenants, + account.GetPropertyAsArray(AzureAccount.Property.Tenants)); + profile.Accounts[account.Id].SetOrAppendProperty(AzureAccount.Property.Subscriptions, + account.GetPropertyAsArray(AzureAccount.Property.Subscriptions)); + } + else + { + profile.Accounts[account.Id] = account; + } + } + + profile.Subscriptions[newSubscription.Id] = newSubscription; + } + catch (Exception ex) + { + // Skip subscription if failed to load + DeserializeErrors.Add(ex.Message); + } + } + } + + return DeserializeErrors.Count == 0; + } + + public IList DeserializeErrors { get; private set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/Properties/AssemblyInfo.cs b/src/Common/Commands.Common.Authentication/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..af2f483fb0a1 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Properties/AssemblyInfo.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Commands.Common.Authentication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Commands.Common.Authentication")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("51ee5716-6b2e-4488-8c7e-97e49e9101b8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Common/Commands.Common.Authentication/Properties/Resources.Designer.cs b/src/Common/Commands.Common.Authentication/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..abe8955e9c48 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Properties/Resources.Designer.cs @@ -0,0 +1,612 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.Commands.Common.Authentication.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Commands.Common.Authentication.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Account needs to be specified. + /// + public static string AccountNeedsToBeSpecified { + get { + return ResourceManager.GetString("AccountNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No account was found for this subscription. Please execute Clear-AzureProfile and then execute Add-AzureAccount.. + /// + public static string AccountNotFound { + get { + return ResourceManager.GetString("AccountNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating using configuration values: Domain: '{0}', Endpoint: '{1}', ClientId: '{2}', ClientRedirect: '{3}', ResourceClientUri: '{4}', ValidateAuthrity: '{5}'. + /// + public static string AdalAuthConfigurationTrace { + get { + return ResourceManager.GetString("AdalAuthConfigurationTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Received exception {0}, while authenticating.. + /// + public static string AdalAuthException { + get { + return ResourceManager.GetString("AdalAuthException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple tokens were found for this user. Please clear your token cache using, Clear-AzureProfile and try this command again.. + /// + public static string AdalMultipleTokens { + get { + return ResourceManager.GetString("AdalMultipleTokens", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User Interaction is required to authenticate this user. Please authenticate using the log in dialog. In PowerShell, execute Login-AzureRMAccount for Azure Resource Manager cmdlets or Add-AzureAccount for service management cmdlets.. + /// + public static string AdalUserInteractionRequired { + get { + return ResourceManager.GetString("AdalUserInteractionRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No account found in the context. Please login using Login-AzureRMAccount.. + /// + public static string ArmAccountNotFound { + get { + return ResourceManager.GetString("ArmAccountNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User Interaction is required to authenticate this user. Please execute Login-AzureRMAccount without parameters and enter your credentials.. + /// + public static string ArmUserInteractionRequired { + get { + return ResourceManager.GetString("ArmUserInteractionRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating for account {0} with single tenant {1}. + /// + public static string AuthenticatingForSingleTenant { + get { + return ResourceManager.GetString("AuthenticatingForSingleTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Windows Azure Powershell. + /// + public static string AzureDirectoryName { + get { + return ResourceManager.GetString("AzureDirectoryName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. + /// + public static string CertificateNotFoundInStore { + get { + return ResourceManager.GetString("CertificateNotFoundInStore", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing public environment is not supported.. + /// + public static string ChangingDefaultEnvironmentNotSupported { + get { + return ResourceManager.GetString("ChangingDefaultEnvironmentNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to -Credential parameter can only be used with Organization ID credentials. For more information, please refer to http://go.microsoft.com/fwlink/?linkid=331007&clcid=0x409 for more information about the difference between an organizational account and a Microsoft account.. + /// + public static string CredentialOrganizationIdMessage { + get { + return ResourceManager.GetString("CredentialOrganizationIdMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name needs to be specified. + /// + public static string EnvironmentNameNeedsToBeSpecified { + get { + return ResourceManager.GetString("EnvironmentNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment needs to be specified. + /// + public static string EnvironmentNeedsToBeSpecified { + get { + return ResourceManager.GetString("EnvironmentNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment name '{0}' is not found.. + /// + public static string EnvironmentNotFound { + get { + return ResourceManager.GetString("EnvironmentNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your Microsoft Azure credential in the Windows PowerShell session has expired. Please log in again. In PowerShell, execute Login-AzureRMAccount for Azure Resource Manager cmdlets or Add-AzureAccount for service management cmdlets.. + /// + public static string ExpiredRefreshToken { + get { + return ResourceManager.GetString("ExpiredRefreshToken", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File path is not valid. + /// + public static string FilePathIsNotValid { + get { + return ResourceManager.GetString("FilePathIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal characters in path.. + /// + public static string IllegalPath { + get { + return ResourceManager.GetString("IllegalPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your Azure credentials have not been set up or have expired, please run Login-AzureRMAccount to set up your Azure credentials.. + /// + public static string InvalidArmContext { + get { + return ResourceManager.GetString("InvalidArmContext", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. + /// + public static string InvalidCertificate { + get { + return ResourceManager.GetString("InvalidCertificate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Credential type invalid, only handles '{0}'. + /// + public static string InvalidCredentialType { + get { + return ResourceManager.GetString("InvalidCredentialType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.. + /// + public static string InvalidDefaultSubscription { + get { + return ResourceManager.GetString("InvalidDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "{0}" is an invalid DNS name for {1}. + /// + public static string InvalidDnsName { + get { + return ResourceManager.GetString("InvalidDnsName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided file in {0} must be have {1} extension. + /// + public static string InvalidFileExtension { + get { + return ResourceManager.GetString("InvalidFileExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot create instance of management client type {0}. It does not have the expected constructor.. + /// + public static string InvalidManagementClientType { + get { + return ResourceManager.GetString("InvalidManagementClientType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is invalid or empty. + /// + public static string InvalidOrEmptyArgumentMessage { + get { + return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Must specify a non-null subscription name.. + /// + public static string InvalidSubscriptionName { + get { + return ResourceManager.GetString("InvalidSubscriptionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials.. + /// + public static string InvalidSubscriptionState { + get { + return ResourceManager.GetString("InvalidSubscriptionState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: No matching account record for account {0} in subscription {1}. + /// + public static string NoAccountInContext { + get { + return ResourceManager.GetString("NoAccountInContext", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: No matching environment record for environment {0} in subscription {1}, using AzureCloud environment instead. + /// + public static string NoEnvironmentInContext { + get { + return ResourceManager.GetString("NoEnvironmentInContext", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. + /// + public static string NoInternetConnection { + get { + return ResourceManager.GetString("NoInternetConnection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscription found in the context. Please ensure that the credentials you provided are authorized to access an Azure subscription, then run Login-AzureRMAccount to login.. + /// + public static string NoSubscriptionInContext { + get { + return ResourceManager.GetString("NoSubscriptionInContext", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No tenant found in the context. Please ensure that the credentials you provided are authorized to access an Azure subscription, then run Login-AzureRMAccount to login.. + /// + public static string NoTenantInContext { + get { + return ResourceManager.GetString("NoTenantInContext", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} doesn't exist.. + /// + public static string PathDoesNotExist { + get { + return ResourceManager.GetString("PathDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path for {0} doesn't exist in {1}.. + /// + public static string PathDoesNotExistForElement { + get { + return ResourceManager.GetString("PathDoesNotExistForElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to &whr={0}. + /// + public static string PublishSettingsFileRealmFormat { + get { + return ResourceManager.GetString("PublishSettingsFileRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing public environment is not supported.. + /// + public static string RemovingDefaultEnvironmentsNotSupported { + get { + return ResourceManager.GetString("RemovingDefaultEnvironmentsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to retrieve service key for ServicePrincipal account {0}. Please log in again to supply the credentials for this service principal. In PowerShell, execute Login-AzureRMAccount for Azure Resource Manager cmdlets or Add-AzureAccount for service management cmdlets.. + /// + public static string ServiceKeyNotFound { + get { + return ResourceManager.GetString("ServiceKeyNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. + /// + public static string ServiceNameExists { + get { + return ResourceManager.GetString("ServiceNameExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Renewing token using AppId: '{0}', AdalConfiguration with ADDomain: '{1}', AdEndpoint: '{2}', ClientId: '{3}', RedirectUri: '{4}'. + /// + public static string SPNRenewTokenTrace { + get { + return ResourceManager.GetString("SPNRenewTokenTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Checking token expiration, token expires '{0}' Comparing to '{1}' With threshold '{2}', calculated time until token expiry: '{3}'. + /// + public static string SPNTokenExpirationCheckTrace { + get { + return ResourceManager.GetString("SPNTokenExpirationCheckTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription id {0} doesn't exist.. + /// + public static string SubscriptionIdNotFoundMessage { + get { + return ResourceManager.GetString("SubscriptionIdNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription name needs to be specified. + /// + public static string SubscriptionNameNeedsToBeSpecified { + get { + return ResourceManager.GetString("SubscriptionNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription name {0} doesn't exist.. + /// + public static string SubscriptionNameNotFoundMessage { + get { + return ResourceManager.GetString("SubscriptionNameNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription needs to be specified. + /// + public static string SubscriptionNeedsToBeSpecified { + get { + return ResourceManager.GetString("SubscriptionNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No tenant was found for this subscription. Please execute Clear-AzureProfile and then execute Add-AzureAccount.. + /// + public static string TenantNotFound { + get { + return ResourceManager.GetString("TenantNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to update mismatching Json structured: {0} {1}.. + /// + public static string UnableToPatchJson { + get { + return ResourceManager.GetString("UnableToPatchJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal credential type. + /// + public static string UnknownCredentialType { + get { + return ResourceManager.GetString("UnknownCredentialType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate authentication is not supported for account type {0}.. + /// + public static string UnsupportedCredentialType { + get { + return ResourceManager.GetString("UnsupportedCredentialType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '{0}', AdEndpoint: '{1}', ClientId: '{2}', ClientRedirectUri: {3}. + /// + public static string UPNAcquireTokenConfigTrace { + get { + return ResourceManager.GetString("UPNAcquireTokenConfigTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Acquiring token using context with Authority '{0}', CorrelationId: '{1}', ValidateAuthority: '{2}'. + /// + public static string UPNAcquireTokenContextTrace { + get { + return ResourceManager.GetString("UPNAcquireTokenContextTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Received token with LoginType '{0}', Tenant: '{1}', UserId: '{2}'. + /// + public static string UPNAuthenticationTokenTrace { + get { + return ResourceManager.GetString("UPNAuthenticationTokenTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating using Account: '{0}', environment: '{1}', tenant: '{2}'. + /// + public static string UPNAuthenticationTrace { + get { + return ResourceManager.GetString("UPNAuthenticationTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Token is expired. + /// + public static string UPNExpiredTokenTrace { + get { + return ResourceManager.GetString("UPNExpiredTokenTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Renewing Token with Type: '{0}', Expiry: '{1}', MultipleResource? '{2}', Tenant: '{3}', UserId: '{4}'. + /// + public static string UPNRenewTokenTrace { + get { + return ResourceManager.GetString("UPNRenewTokenTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: User info for token DisplayId: '{0}', Name: {2} {1}, IdProvider: '{3}', Uid: '{4}'. + /// + public static string UPNRenewTokenUserInfoTrace { + get { + return ResourceManager.GetString("UPNRenewTokenUserInfoTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Checking token expiration, token expires '{0}' Comparing to '{1}' With threshold '{2}', calculated time until token expiry: '{3}'. + /// + public static string UPNTokenExpirationCheckTrace { + get { + return ResourceManager.GetString("UPNTokenExpirationCheckTrace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name is not valid. + /// + public static string UserNameIsNotValid { + get { + return ResourceManager.GetString("UserNameIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name needs to be specified. + /// + public static string UserNameNeedsToBeSpecified { + get { + return ResourceManager.GetString("UserNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (x86). + /// + public static string x86InProgramFiles { + get { + return ResourceManager.GetString("x86InProgramFiles", resourceCulture); + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Properties/Resources.resx b/src/Common/Commands.Common.Authentication/Properties/Resources.resx new file mode 100644 index 000000000000..40dc18b1e1e5 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Properties/Resources.resx @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Account needs to be specified + + + Windows Azure Powershell + + + No certificate was found in the certificate store with thumbprint {0} + + + Changing public environment is not supported. + + + -Credential parameter can only be used with Organization ID credentials. For more information, please refer to http://go.microsoft.com/fwlink/?linkid=331007&clcid=0x409 for more information about the difference between an organizational account and a Microsoft account. + + + Environment name needs to be specified + + + Environment needs to be specified + + + The environment name '{0}' is not found. + + + Your Microsoft Azure credential in the Windows PowerShell session has expired. Please log in again. In PowerShell, execute Login-AzureRMAccount for Azure Resource Manager cmdlets or Add-AzureAccount for service management cmdlets. + + + File path is not valid + + + Illegal characters in path. + + + Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings + + + Credential type invalid, only handles '{0}' + + + No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. + + + "{0}" is an invalid DNS name for {1} + + + The provided file in {0} must be have {1} extension + + + Cannot create instance of management client type {0}. It does not have the expected constructor. + + + {0} is invalid or empty + + + Must specify a non-null subscription name. + + + Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials. + + + Please connect to internet before executing this cmdlet + + + Path {0} doesn't exist. + + + Path for {0} doesn't exist in {1}. + + + &whr={0} + + + Removing public environment is not supported. + + + Unable to retrieve service key for ServicePrincipal account {0}. Please log in again to supply the credentials for this service principal. In PowerShell, execute Login-AzureRMAccount for Azure Resource Manager cmdlets or Add-AzureAccount for service management cmdlets. + + + The provided service name {0} already exists, please pick another name + + + [Common.Authentication]: Renewing token using AppId: '{0}', AdalConfiguration with ADDomain: '{1}', AdEndpoint: '{2}', ClientId: '{3}', RedirectUri: '{4}' + + + [Common.Authentication]: Checking token expiration, token expires '{0}' Comparing to '{1}' With threshold '{2}', calculated time until token expiry: '{3}' + + + The subscription id {0} doesn't exist. + + + Subscription name needs to be specified + + + The subscription name {0} doesn't exist. + + + Subscription needs to be specified + + + Unable to update mismatching Json structured: {0} {1}. + + + Illegal credential type + + + [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '{0}', AdEndpoint: '{1}', ClientId: '{2}', ClientRedirectUri: {3} + + + [Common.Authentication]: Acquiring token using context with Authority '{0}', CorrelationId: '{1}', ValidateAuthority: '{2}' + + + [Common.Authentication]: Token is expired + + + [Common.Authentication]: Renewing Token with Type: '{0}', Expiry: '{1}', MultipleResource? '{2}', Tenant: '{3}', UserId: '{4}' + + + [Common.Authentication]: User info for token DisplayId: '{0}', Name: {2} {1}, IdProvider: '{3}', Uid: '{4}' + + + [Common.Authentication]: Checking token expiration, token expires '{0}' Comparing to '{1}' With threshold '{2}', calculated time until token expiry: '{3}' + + + User name is not valid + + + User name needs to be specified + + + (x86) + + + No account was found for this subscription. Please execute Clear-AzureProfile and then execute Add-AzureAccount. + + + [Common.Authentication]: Received exception {0}, while authenticating. + + + Multiple tokens were found for this user. Please clear your token cache using, Clear-AzureProfile and try this command again. + + + User Interaction is required to authenticate this user. Please authenticate using the log in dialog. In PowerShell, execute Login-AzureRMAccount for Azure Resource Manager cmdlets or Add-AzureAccount for service management cmdlets. + + + No tenant was found for this subscription. Please execute Clear-AzureProfile and then execute Add-AzureAccount. + + + [Common.Authentication]: Received token with LoginType '{0}', Tenant: '{1}', UserId: '{2}' + + + [Common.Authentication]: Authenticating using Account: '{0}', environment: '{1}', tenant: '{2}' + + + [Common.Authentication]: Authenticating using configuration values: Domain: '{0}', Endpoint: '{1}', ClientId: '{2}', ClientRedirect: '{3}', ResourceClientUri: '{4}', ValidateAuthrity: '{5}' + + + [Common.Authentication]: No matching account record for account {0} in subscription {1} + + + [Common.Authentication]: No matching environment record for environment {0} in subscription {1}, using AzureCloud environment instead + + + [Common.Authentication]: Authenticating for account {0} with single tenant {1} + + + No account found in the context. Please login using Login-AzureRMAccount. + + + User Interaction is required to authenticate this user. Please execute Login-AzureRMAccount without parameters and enter your credentials. + + + Your Azure credentials have not been set up or have expired, please run Login-AzureRMAccount to set up your Azure credentials. + + + No subscription found in the context. Please ensure that the credentials you provided are authorized to access an Azure subscription, then run Login-AzureRMAccount to login. + + + No tenant found in the context. Please ensure that the credentials you provided are authorized to access an Azure subscription, then run Login-AzureRMAccount to login. + + + Certificate authentication is not supported for account type {0}. + + \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/Utilities/DictionaryExtensions.cs b/src/Common/Commands.Common.Authentication/Utilities/DictionaryExtensions.cs new file mode 100644 index 000000000000..fd279b236a9d --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Utilities/DictionaryExtensions.cs @@ -0,0 +1,78 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.Commands.Common.Authentication.Utilities +{ + public static class DictionaryExtensions + { + public static TValue GetProperty(this Dictionary dictionary, TKey property) + { + if (dictionary.ContainsKey(property)) + { + return dictionary[property]; + } + + return default(TValue); + } + + public static string[] GetPropertyAsArray(this Dictionary dictionary, TKey property) + { + if (dictionary.ContainsKey(property)) + { + return dictionary[property].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + } + + return new string[0]; + } + + public static void SetProperty(this Dictionary dictionary, TKey property, params string[] values) + { + if (values == null || values.Length == 0) + { + if (dictionary.ContainsKey(property)) + { + dictionary.Remove(property); + } + } + else + { + dictionary[property] = string.Join(",", values); + } + } + + public static void SetOrAppendProperty(this Dictionary dictionary, TKey property, params string[] values) + { + string oldValueString = ""; + if (dictionary.ContainsKey(property)) + { + oldValueString = dictionary[property]; + } + var oldValues = oldValueString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var newValues = oldValues.Union(values, StringComparer.CurrentCultureIgnoreCase).Where(s => !string.IsNullOrEmpty(s)).ToArray(); + if (newValues.Any()) + { + dictionary[property] = string.Join(",", newValues); + } + } + + public static bool IsPropertySet(this Dictionary dictionary, TKey property) + { + return dictionary.ContainsKey(property) && !string.IsNullOrEmpty(dictionary[property]); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Utilities/FileUtilities.cs b/src/Common/Commands.Common.Authentication/Utilities/FileUtilities.cs new file mode 100644 index 000000000000..cb361deaf860 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Utilities/FileUtilities.cs @@ -0,0 +1,321 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public static class FileUtilities + { + static FileUtilities() + { + DataStore = new DiskDataStore(); + } + + public static IDataStore DataStore { get; set; } + + public static string GetAssemblyDirectory() + { + var assemblyPath = Uri.UnescapeDataString(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath); + return Path.GetDirectoryName(assemblyPath); + } + + public static string GetContentFilePath(string fileName) + { + return GetContentFilePath(GetAssemblyDirectory(), fileName); + } + + public static string GetContentFilePath(string startDirectory, string fileName) + { + string path = Path.Combine(startDirectory, fileName); + + // Try search in the subdirectories in case that the file path does not exist in root path + if (!DataStore.FileExists(path) && !DataStore.DirectoryExists(path)) + { + try + { + path = DataStore.GetDirectories(startDirectory, fileName, SearchOption.AllDirectories).FirstOrDefault(); + + if (string.IsNullOrEmpty(path)) + { + path = DataStore.GetFiles(startDirectory, fileName, SearchOption.AllDirectories).First(); + } + } + catch + { + throw new FileNotFoundException(Path.Combine(startDirectory, fileName)); + } + } + + return path; + } + + public static string GetWithProgramFilesPath(string directoryName, bool throwIfNotFound) + { + string programFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + if (DataStore.DirectoryExists(Path.Combine(programFilesPath, directoryName))) + { + return Path.Combine(programFilesPath, directoryName); + } + else + { + if (programFilesPath.IndexOf(Resources.x86InProgramFiles, StringComparison.InvariantCultureIgnoreCase) == -1) + { + programFilesPath += Resources.x86InProgramFiles; + if (throwIfNotFound) + { + Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); + } + return Path.Combine(programFilesPath, directoryName); + } + else + { + programFilesPath = programFilesPath.Replace(Resources.x86InProgramFiles, String.Empty); + if (throwIfNotFound) + { + Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); + } + return Path.Combine(programFilesPath, directoryName); + } + } + } + + /// + /// Copies a directory. + /// + /// The source directory name + /// The destination directory name + /// Should the copy be recursive + public static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) + { + var dirs = DataStore.GetDirectories(sourceDirName); + + if (!DataStore.DirectoryExists(sourceDirName)) + { + throw new DirectoryNotFoundException(String.Format(Resources.PathDoesNotExist, sourceDirName)); + } + + DataStore.CreateDirectory(destDirName); + + var files = DataStore.GetFiles(sourceDirName); + foreach (var file in files) + { + string tempPath = Path.Combine(destDirName, Path.GetFileName(file)); + DataStore.CopyFile(file, tempPath); + } + + if (copySubDirs) + { + foreach (var subdir in dirs) + { + string temppath = Path.Combine(destDirName, Path.GetDirectoryName(subdir)); + DirectoryCopy(subdir, temppath, copySubDirs); + } + } + } + + /// + /// Ensures that a directory exists beofre attempting to write a file + /// + /// The path to the file that will be created + public static void EnsureDirectoryExists(string pathName) + { + Validate.ValidateStringIsNullOrEmpty(pathName, "Settings directory"); + string directoryPath = Path.GetDirectoryName(pathName); + if (!DataStore.DirectoryExists(directoryPath)) + { + DataStore.CreateDirectory(directoryPath); + } + } + + /// + /// Create a unique temp directory. + /// + /// Path to the temp directory. + public static string CreateTempDirectory() + { + string tempPath; + do + { + tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + } + while (DataStore.DirectoryExists(tempPath) || DataStore.FileExists(tempPath)); + + DataStore.CreateDirectory(tempPath); + return tempPath; + } + + /// + /// Copy a directory from one path to another. + /// + /// Source directory. + /// Destination directory. + public static void CopyDirectory(string sourceDirectory, string destinationDirectory) + { + Debug.Assert(!String.IsNullOrEmpty(sourceDirectory), "sourceDictory cannot be null or empty!"); + Debug.Assert(Directory.Exists(sourceDirectory), "sourceDirectory must exist!"); + Debug.Assert(!String.IsNullOrEmpty(destinationDirectory), "destinationDirectory cannot be null or empty!"); + Debug.Assert(!Directory.Exists(destinationDirectory), "destinationDirectory must not exist!"); + + foreach (string file in DataStore.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories)) + { + string relativePath = file.Substring( + sourceDirectory.Length + 1, + file.Length - sourceDirectory.Length - 1); + string destinationPath = Path.Combine(destinationDirectory, relativePath); + + string destinationDir = Path.GetDirectoryName(destinationPath); + if (!DataStore.DirectoryExists(destinationDir)) + { + DataStore.CreateDirectory(destinationDir); + } + + DataStore.CopyFile(file, destinationPath); + } + } + + public static Encoding GetFileEncoding(string path) + { + Encoding encoding; + + + if (DataStore.FileExists(path)) + { + using (StreamReader r = new StreamReader(DataStore.ReadFileAsStream(path))) + { + encoding = r.CurrentEncoding; + } + } + else + { + encoding = Encoding.Default; + } + + return encoding; + } + + public static string CombinePath(params string[] paths) + { + return Path.Combine(paths); + } + + /// + /// Returns true if path is a valid directory. + /// + /// + /// + public static bool IsValidDirectoryPath(string path) + { + if (String.IsNullOrEmpty(path)) + { + return false; + } + + try + { + FileAttributes attributes = DataStore.GetFileAttributes(path); + + if ((attributes & FileAttributes.Directory) == FileAttributes.Directory) + { + return true; + } + else + { + return false; + } + } + catch + { + return false; + } + } + + public static void RecreateDirectory(string dir) + { + if (DataStore.DirectoryExists(dir)) + { + DataStore.DeleteDirectory(dir); + } + + DataStore.CreateDirectory(dir); + } + + /// + /// Gets the root installation path for the given Azure module. + /// + /// The module name + /// The module full path + public static string GetPSModulePathForModule(AzureModule module) + { + return GetContentFilePath(GetInstallPath(), GetModuleFolderName(module)); + } + + /// + /// Gets the root directory for all modules installation. + /// + /// The install path + public static string GetInstallPath() + { + string currentPath = GetAssemblyDirectory(); + while (!currentPath.EndsWith(GetModuleFolderName(AzureModule.AzureProfile)) && + !currentPath.EndsWith(GetModuleFolderName(AzureModule.AzureResourceManager)) && + !currentPath.EndsWith(GetModuleFolderName(AzureModule.AzureServiceManagement))) + { + currentPath = Directory.GetParent(currentPath).FullName; + } + + // The assemption is that the install directory looks like that: + // ServiceManagement + // AzureServiceManagement + // + // ResourceManager + // AzureResourceManager + // + // Profile + // AzureSMProfile + // + return Directory.GetParent(currentPath).FullName; + } + + public static string GetModuleName(AzureModule module) + { + switch (module) + { + case AzureModule.AzureServiceManagement: + return "Azure"; + + case AzureModule.AzureResourceManager: + return "AzureResourceManager"; + + case AzureModule.AzureProfile: + return "AzureProfile"; + + default: + throw new ArgumentOutOfRangeException(module.ToString()); + } + } + + public static string GetModuleFolderName(AzureModule module) + { + return module.ToString().Replace("Azure", ""); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Utilities/JsonUtilities.cs b/src/Common/Commands.Common.Authentication/Utilities/JsonUtilities.cs new file mode 100644 index 000000000000..2149e045b5a0 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Utilities/JsonUtilities.cs @@ -0,0 +1,204 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public static class JsonUtilities + { + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")] + public static string TryFormatJson(string str) + { + try + { + object parsedJson = JsonConvert.DeserializeObject(str); + return JsonConvert.SerializeObject(parsedJson, Formatting.Indented); + } + catch + { + // can't parse JSON, return the original string + return str; + } + } + + public static Dictionary DeserializeJson(string jsonString, bool throwExceptionOnFailure = false) + { + Dictionary result = new Dictionary(); + if (jsonString == null) + { + return null; + } + if (String.IsNullOrWhiteSpace(jsonString)) + { + return result; + } + + try + { + JToken responseDoc = JToken.Parse(jsonString); + + if (responseDoc != null && responseDoc.Type == JTokenType.Object) + { + result = DeserializeJObject(responseDoc as JObject); + } + } + catch + { + if (throwExceptionOnFailure) + { + throw; + } + result = null; + } + return result; + } + + private static Dictionary DeserializeJObject(JObject jsonObject) + { + Dictionary result = new Dictionary(); + if (jsonObject == null || jsonObject.Type == JTokenType.Null) + { + return result; + } + foreach (var property in jsonObject) + { + if (property.Value.Type == JTokenType.Object) + { + result[property.Key] = DeserializeJObject(property.Value as JObject); + } + else if (property.Value.Type == JTokenType.Array) + { + result[property.Key] = DeserializeJArray(property.Value as JArray); + } + else + { + result[property.Key] = DeserializeJValue(property.Value as JValue); + } + } + return result; + } + + private static List DeserializeJArray(JArray jsonArray) + { + List result = new List(); + if (jsonArray == null || jsonArray.Type == JTokenType.Null) + { + return result; + } + foreach (var token in jsonArray) + { + if (token.Type == JTokenType.Object) + { + result.Add(DeserializeJObject(token as JObject)); + } + else if (token.Type == JTokenType.Array) + { + result.Add(DeserializeJArray(token as JArray)); + } + else + { + result.Add(DeserializeJValue(token as JValue)); + } + } + return result; + } + + private static object DeserializeJValue(JValue jsonObject) + { + if (jsonObject == null || jsonObject.Type == JTokenType.Null) + { + return null; + } + + return jsonObject.Value; + } + + public static string Patch(string originalJsonString, string patchJsonString) + { + if (string.IsNullOrWhiteSpace(originalJsonString)) + { + return patchJsonString; + } + else if (string.IsNullOrWhiteSpace(patchJsonString)) + { + return originalJsonString; + } + + JToken originalJson = JToken.Parse(originalJsonString); + JToken patchJson = JToken.Parse(patchJsonString); + + if (originalJson != null && originalJson.Type == JTokenType.Object && + patchJson != null && patchJson.Type == JTokenType.Object) + { + PatchJObject(originalJson as JObject, patchJson as JObject); + } + else if (originalJson != null && originalJson.Type == JTokenType.Array && + patchJson != null && patchJson.Type == JTokenType.Array) + { + originalJson = patchJson; + } + else if (originalJson != null && patchJson != null && originalJson.Type == patchJson.Type) + { + originalJson = patchJson; + } + else + { + throw new ArgumentException(string.Format(Resources.UnableToPatchJson, originalJson, patchJson)); + } + + return originalJson.ToString(Formatting.None); + } + + private static void PatchJObject(JObject originalJsonObject, JObject patchJsonObject) + { + foreach (var patchProperty in patchJsonObject) + { + if (originalJsonObject[patchProperty.Key] != null) + { + JToken originalJson = originalJsonObject[patchProperty.Key]; + JToken patchJson = patchProperty.Value; + + if (originalJson != null && originalJson.Type == JTokenType.Object && + patchJson != null && patchJson.Type == JTokenType.Object) + { + PatchJObject(originalJson as JObject, patchJson as JObject); + } + else if (originalJson != null && originalJson.Type == JTokenType.Array && + patchJson != null && patchJson.Type == JTokenType.Array) + { + originalJsonObject[patchProperty.Key] = patchJson; + } + else if (originalJson != null && patchJson != null && originalJson.Type == patchJson.Type) + { + originalJsonObject[patchProperty.Key] = patchJson; + } + else + { + throw new ArgumentException(string.Format(Resources.UnableToPatchJson, originalJson, patchJson)); + } + } + else + { + originalJsonObject[patchProperty.Key] = patchProperty.Value; + } + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/Utilities/XmlUtilities.cs b/src/Common/Commands.Common.Authentication/Utilities/XmlUtilities.cs new file mode 100644 index 000000000000..8400260fea88 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/Utilities/XmlUtilities.cs @@ -0,0 +1,129 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Properties; +using System; +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Serialization; + +namespace Microsoft.Azure.Commands.Common.Authentication +{ + public static class XmlUtilities + { + public static T DeserializeXmlFile(string fileName, string exceptionMessage = null) + { + // TODO: fix and uncomment. second parameter is wrong + // Validate.ValidateFileFull(fileName, string.Format(Resources.PathDoesNotExistForElement, string.Empty, fileName)); + + T item; + + XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); + using (TextReader reader = new StreamReader(FileUtilities.DataStore.ReadFileAsStream(fileName))) + { + try { item = (T)xmlSerializer.Deserialize(reader); } + catch + { + if (!String.IsNullOrEmpty(exceptionMessage)) + { + throw new InvalidOperationException(exceptionMessage); + } + else + { + throw; + } + } + } + + return item; + } + + public static void SerializeXmlFile(T obj, string fileName) + { + Validate.ValidatePathName(fileName, String.Format(Resources.PathDoesNotExistForElement, String.Empty, fileName)); + Validate.ValidateStringIsNullOrEmpty(fileName, String.Empty); + + XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); + StringBuilder sBuilder = new StringBuilder(); + using (StringWriter writer = new StringWriter(sBuilder)) + { + xmlSerializer.Serialize(writer, obj); + } + FileUtilities.DataStore.WriteFile(fileName, sBuilder.ToString(), Encoding.Unicode); + } + + public static string SerializeXmlString(T obj) + { + XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); + StringBuilder sBuilder = new StringBuilder(); + + using (StringWriter writer = new StringWriter(sBuilder)) + { + xmlSerializer.Serialize(writer, obj); + } + + return sBuilder.ToString(); + } + + /// + /// Formats the given XML into indented way. + /// + /// The input xml string + /// The formatted xml string + public static string TryFormatXml(string content) + { + try + { + XDocument doc = XDocument.Parse(content); + return doc.ToString(); + } + catch (Exception) + { + return content; + } + } + + /// + /// Formats given string into well formatted XML. + /// + /// The unformatted xml string + /// The formatted XML string + public static string Beautify(string unformattedXml) + { + string formattedXml = String.Empty; + if (!String.IsNullOrEmpty(unformattedXml)) + { + XmlDocument doc = new XmlDocument(); + doc.LoadXml(unformattedXml); + StringBuilder stringBuilder = new StringBuilder(); + XmlWriterSettings settings = new XmlWriterSettings() + { + Indent = true, + IndentChars = "\t", + NewLineChars = Environment.NewLine, + NewLineHandling = NewLineHandling.Replace + }; + using (XmlWriter writer = XmlWriter.Create(stringBuilder, settings)) + { + doc.Save(writer); + } + formattedXml = stringBuilder.ToString(); + } + + return formattedXml; + } + } +} diff --git a/src/Common/Commands.Common.Authentication/packages.config b/src/Common/Commands.Common.Authentication/packages.config new file mode 100644 index 000000000000..7cd3ca0ec601 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/packages.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/AadAuthenticationException.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/AadAuthenticationException.cs new file mode 100644 index 000000000000..d6742a28cd86 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/AadAuthenticationException.cs @@ -0,0 +1,94 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// Base class representing an exception that occurs when + /// authenticating against Azure Active Directory + /// + [Serializable] + public abstract class AadAuthenticationException : Exception + { + protected AadAuthenticationException() + { + } + + protected AadAuthenticationException(string message) : base(message) + { + } + + protected AadAuthenticationException(string message, Exception innerException) : base(message, innerException) + { + } + } + + /// + /// Exception that gets thrown when the user explicitly + /// cancels an authentication operation. + /// + [Serializable] + public class AadAuthenticationCanceledException : AadAuthenticationException + { + public AadAuthenticationCanceledException(string message, Exception innerException) : base(message, innerException) + { + } + } + + /// + /// Exception that gets thrown when the ADAL library + /// is unable to authenticate without a popup dialog. + /// + [Serializable] + public class AadAuthenticationFailedWithoutPopupException : AadAuthenticationException + { + public AadAuthenticationFailedWithoutPopupException(string message, Exception innerException) + : base(message, innerException) + { + } + } + + /// + /// Exception that gets thrown if an authentication operation + /// fails on the server. + /// + [Serializable] + public class AadAuthenticationFailedException : AadAuthenticationException + { + public AadAuthenticationFailedException(string message, Exception innerException) : base(message, innerException) + { + } + } + + /// + /// Exception thrown if a refresh token has expired. + /// + [Serializable] + public class AadAuthenticationCantRenewException : AadAuthenticationException + { + public AadAuthenticationCantRenewException() + { + } + + public AadAuthenticationCantRenewException(string message) : base(message) + { + } + + public AadAuthenticationCantRenewException(string message, Exception innerException) : base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/AccessTokenCredential.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/AccessTokenCredential.cs new file mode 100644 index 000000000000..9af6256a24de --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/AccessTokenCredential.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Common.Authentication +{ + public class AccessTokenCredential : SubscriptionCloudCredentials + { + private readonly Guid subscriptionId; + private readonly IAccessToken token; + + public AccessTokenCredential(Guid subscriptionId, IAccessToken token) + { + this.subscriptionId = subscriptionId; + this.token = token; + this.TenantID = token.TenantId; + } + + public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + token.AuthorizeRequest((tokenType, tokenValue) => { + request.Headers.Authorization = new AuthenticationHeaderValue(tokenType, tokenValue); + }); + return base.ProcessHttpRequestAsync(request, cancellationToken); + } + + public override string SubscriptionId + { + get { return subscriptionId.ToString(); } + } + + public string TenantID { get; set; } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/AdalConfiguration.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/AdalConfiguration.cs new file mode 100644 index 000000000000..5b2afb1a98d8 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/AdalConfiguration.cs @@ -0,0 +1,63 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// Class storing the configuration information needed + /// for ADAL to request token from the right AD tenant + /// depending on environment. + /// + public class AdalConfiguration + { + // + // These constants define the default values to use for AD authentication + // against RDFE + // + public const string PowerShellClientId = "1950a258-227b-4e31-a9cf-717495945fc2"; + + public static readonly Uri PowerShellRedirectUri = new Uri("urn:ietf:wg:oauth:2.0:oob"); + + // ID for site to pass to enable EBD (email-based differentiation) + // This gets passed in the call to get the azure branding on the + // login window. Also adding popup flag to handle overly large login windows. + public const string EnableEbdMagicCookie = "site_id=501358&display=popup"; + + public string AdEndpoint { get;set; } + + public bool ValidateAuthority { get; set; } + + public string AdDomain { get; set; } + + public string ClientId { get; set; } + + public Uri ClientRedirectUri { get; set; } + + public string ResourceClientUri { get; set; } + + public TokenCache TokenCache { get; set; } + + public AdalConfiguration() + { + ClientId = PowerShellClientId; + ClientRedirectUri = PowerShellRedirectUri; + ValidateAuthority = true; + AdEndpoint = string.Empty; + ResourceClientUri = "https://management.core.windows.net/"; + } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/AdalTokenProvider.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/AdalTokenProvider.cs new file mode 100644 index 000000000000..889c76dca73f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/AdalTokenProvider.cs @@ -0,0 +1,68 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication.Properties; +using System; +using System.Security; +using System.Windows.Forms; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// A token provider that uses ADAL to retrieve + /// tokens from Azure Active Directory + /// + public class AdalTokenProvider : ITokenProvider + { + private readonly ITokenProvider userTokenProvider; + private readonly ITokenProvider servicePrincipalTokenProvider; + + public AdalTokenProvider() + : this(new ConsoleParentWindow()) + { + } + + public AdalTokenProvider(IWin32Window parentWindow) + { + this.userTokenProvider = new UserTokenProvider(parentWindow); + servicePrincipalTokenProvider = new ServicePrincipalTokenProvider(); + } + + public IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, SecureString password, + AzureAccount.AccountType credentialType) + { + switch (credentialType) + { + case AzureAccount.AccountType.User: + return userTokenProvider.GetAccessToken(config, promptBehavior, userId, password, credentialType); + case AzureAccount.AccountType.ServicePrincipal: + return servicePrincipalTokenProvider.GetAccessToken(config, promptBehavior, userId, password, credentialType); + default: + throw new ArgumentException(Resources.UnknownCredentialType, "credentialType"); + } + } + + public IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string clientId, string certificate, AzureAccount.AccountType credentialType) + { + switch (credentialType) + { + case AzureAccount.AccountType.ServicePrincipal: + return servicePrincipalTokenProvider.GetAccessTokenWithCertificate(config, clientId, certificate, credentialType); + default: + throw new ArgumentException(string.Format(Resources.UnsupportedCredentialType, credentialType), "credentialType"); + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/CertificateApplicationCredentialProvider.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/CertificateApplicationCredentialProvider.cs new file mode 100644 index 000000000000..08f334684b34 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/CertificateApplicationCredentialProvider.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest.Azure.Authentication; +using System.Security; +using System.Security.Cryptography.X509Certificates; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// Interface to the certificate store for authentication + /// + internal sealed class CertificateApplicationCredentialProvider : IApplicationAuthenticationProvider + { + private string _certificateThumbprint; + + /// + /// Create a certificate provider + /// + /// + public CertificateApplicationCredentialProvider(string certificateThumbprint) + { + this._certificateThumbprint = certificateThumbprint; + } + + /// + /// Authenticate using certificate thumbprint from the datastore + /// + /// The active directory client id for the application. + /// The intended audience for authentication + /// The AD AuthenticationContext to use + /// + public async Task AuthenticateAsync(string clientId, string audience, AuthenticationContext context) + { + var task = new Task(() => + { + return AzureSession.DataStore.GetCertificate(this._certificateThumbprint); + }); + task.Start(); + var certificate = await task.ConfigureAwait(false); + + return await context.AcquireTokenAsync( + audience, + new ClientAssertionCertificate(clientId, certificate)); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/ConsoleParentWindow.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/ConsoleParentWindow.cs new file mode 100644 index 000000000000..a9080fe2972f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/ConsoleParentWindow.cs @@ -0,0 +1,35 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// An implementation of that gives the + /// windows handle for the current console window. + /// + public class ConsoleParentWindow : IWin32Window + { + public IntPtr Handle { get { return NativeMethods.GetConsoleWindow(); } } + + static class NativeMethods + { + [DllImport("kernel32.dll")] + public static extern IntPtr GetConsoleWindow(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/CredStore.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/CredStore.cs new file mode 100644 index 000000000000..a7b61207f044 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/CredStore.cs @@ -0,0 +1,114 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Runtime.ConstrainedExecution; +using System.Runtime.InteropServices; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// Class wrapping PInvoke signatures for Windows Credential store + /// + internal static class CredStore + { + internal enum CredentialType + { + Generic = 1, + } + + internal static class NativeMethods + { + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredRead( + string targetName, + CredentialType type, + int flags, + [Out] out IntPtr pCredential + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredEnumerate( + string targetName, + int flags, + [Out] out int count, + [Out] out IntPtr pCredential + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredDelete( + string targetName, + CredentialType type, + int flags + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredWrite( + IntPtr pCredential, + int flags + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + internal extern static bool CredFree( + IntPtr pCredential + ); + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable", Justification = "Wrapper for native struct")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct Credential + { + public Credential(string userName, string key, string value) + { + this.flags = 0; + this.type = CredentialType.Generic; + + // set the key in the targetName + this.targetName = key; + + this.targetAlias = null; + this.comment = null; + this.lastWritten.dwHighDateTime = 0; + this.lastWritten.dwLowDateTime = 0; + + // set the value in credentialBlob. + this.credentialBlob = Marshal.StringToHGlobalUni(value); + this.credentialBlobSize = (uint)((value.Length + 1) * 2); + + this.persist = 1; + this.attibuteCount = 0; + this.attributes = IntPtr.Zero; + this.userName = userName; + } + + internal uint flags; + internal CredentialType type; + internal string targetName; + internal string comment; + internal System.Runtime.InteropServices.ComTypes.FILETIME lastWritten; + internal uint credentialBlobSize; + internal IntPtr credentialBlob; + internal uint persist; + internal uint attibuteCount; + internal IntPtr attributes; + internal string targetAlias; + internal string userName; + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/IAccessToken.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/IAccessToken.cs new file mode 100644 index 000000000000..6e23ebedd3cc --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/IAccessToken.cs @@ -0,0 +1,31 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; + +namespace Microsoft.Azure.Common.Authentication +{ + public interface IAccessToken + { + void AuthorizeRequest(Action authTokenSetter); + + string AccessToken { get; } + + string UserId { get; } + + string TenantId { get; } + + LoginType LoginType { get; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/ITokenProvider.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/ITokenProvider.cs new file mode 100644 index 000000000000..583866b16e2c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/ITokenProvider.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Models; +using System.Security; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// This interface represents objects that can be used + /// to obtain and manage access tokens. + /// + public interface ITokenProvider + { + /// + /// Get a new login token for the given environment, user credential, + /// and credential type. + /// + /// Configuration. + /// Prompt behavior. + /// User ID/Service principal to get the token for. + /// Secure strings with password/service principal key. + /// Credential type. + /// An access token. + IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, + SecureString password, AzureAccount.AccountType credentialType); + + /// + /// Get a new authentication token for the given environment + /// + /// The ADAL Configuration + /// The id for the given principal + /// The certificate thumbprint for this user + /// The account type + /// An access token, which can be renewed + IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string principalId, string certificateThumbprint, + AzureAccount.AccountType credentialType); + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/KeyStoreApplicationCredentialProvider.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/KeyStoreApplicationCredentialProvider.cs new file mode 100644 index 000000000000..f5f2c74034f8 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/KeyStoreApplicationCredentialProvider.cs @@ -0,0 +1,57 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest.Azure.Authentication; +using System.Security; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// Interface to the keystore for authentication + /// + internal sealed class KeyStoreApplicationCredentialProvider : IApplicationAuthenticationProvider + { + private string _tenantId; + + /// + /// Create a credential provider + /// + /// + public KeyStoreApplicationCredentialProvider(string tenant) + { + this._tenantId = tenant; + } + + /// + /// Authenticate using the secret for the specified client from the key store + /// + /// The active directory client id for the application. + /// The intended audience for authentication + /// The AD AuthenticationContext to use + /// + public async Task AuthenticateAsync(string clientId, string audience, AuthenticationContext context) + { + var task = new Task(() => + { + return ServicePrincipalKeyStore.GetKey(clientId, _tenantId); + }); + task.Start(); + var key = await task.ConfigureAwait(false); + + return await context.AcquireTokenAsync(audience, new ClientCredential(clientId, key)); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/LoginType.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/LoginType.cs new file mode 100644 index 000000000000..0924dc5210aa --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/LoginType.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Common.Authentication +{ + public enum LoginType + { + /// + /// User is logging in with orgid credentials + /// + OrgId, + + /// + /// User is logging in with liveid credentials + /// + LiveId + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/ProtectedFileTokenCache.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/ProtectedFileTokenCache.cs new file mode 100644 index 000000000000..b96a98239f8c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/ProtectedFileTokenCache.cs @@ -0,0 +1,121 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.IO; +using System.Security.Cryptography; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// An implementation of the Adal token cache that stores the cache items + /// in the DPAPI-protected file. + /// + public class ProtectedFileTokenCache : TokenCache + { + private static readonly string CacheFileName = Path.Combine(AzureSession.ProfileDirectory, AzureSession.TokenCacheFile); + + private static readonly object fileLock = new object(); + + private static readonly Lazy instance = new Lazy(() => new ProtectedFileTokenCache()); + + // Initializes the cache against a local file. + // If the file is already present, it loads its content in the ADAL cache + private ProtectedFileTokenCache() + { + Initialize(CacheFileName); + } + + private void Initialize(string fileName) + { + AfterAccess = AfterAccessNotification; + BeforeAccess = BeforeAccessNotification; + lock (fileLock) + { + if (AzureSession.DataStore.FileExists(fileName)) + { + var existingData = AzureSession.DataStore.ReadFileAsBytes(fileName); + if (existingData != null) + { + try + { + Deserialize(ProtectedData.Unprotect(existingData, null, DataProtectionScope.CurrentUser)); + } + catch (CryptographicException) + { + AzureSession.DataStore.DeleteFile(fileName); + } + } + } + } + } + + public ProtectedFileTokenCache(string cacheFile) + { + Initialize(cacheFile); + } + + // Empties the persistent store. + public override void Clear() + { + base.Clear(); + if (AzureSession.DataStore.FileExists(CacheFileName)) + { + AzureSession.DataStore.DeleteFile(CacheFileName); + } + } + + // Triggered right before ADAL needs to access the cache. + // Reload the cache from the persistent store in case it changed since the last access. + void BeforeAccessNotification(TokenCacheNotificationArgs args) + { + lock (fileLock) + { + if (AzureSession.DataStore.FileExists(CacheFileName)) + { + var existingData = AzureSession.DataStore.ReadFileAsBytes(CacheFileName); + if (existingData != null) + { + try + { + Deserialize(ProtectedData.Unprotect(existingData, null, DataProtectionScope.CurrentUser)); + } + catch (CryptographicException) + { + AzureSession.DataStore.DeleteFile(CacheFileName); + } + } + } + } + } + + // Triggered right after ADAL accessed the cache. + void AfterAccessNotification(TokenCacheNotificationArgs args) + { + // if the access operation resulted in a cache update + if (HasStateChanged) + { + lock (fileLock) + { + // reflect changes in the persistent store + AzureSession.DataStore.WriteFile(CacheFileName, + ProtectedData.Protect(Serialize(), null, DataProtectionScope.CurrentUser)); + // once the write operation took place, restore the HasStateChanged bit to false + HasStateChanged = false; + } + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/ServicePrincipalKeyStore.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/ServicePrincipalKeyStore.cs new file mode 100644 index 000000000000..8932ceab8e34 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/ServicePrincipalKeyStore.cs @@ -0,0 +1,117 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Runtime.InteropServices; +using System.Security; +using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// Helper class to store service principal keys and retrieve them + /// from the Windows Credential Store. + /// + public static class ServicePrincipalKeyStore + { + private const string keyStoreUserName = "PowerShellServicePrincipalKey"; + private const string targetNamePrefix = "AzureSession:target="; + + public static void SaveKey(string appId, string tenantId, SecureString serviceKey) + { + var credential = new CredStore.NativeMethods.Credential + { + flags = 0, + type = CredStore.CredentialType.Generic, + targetName = CreateKey(appId, tenantId), + targetAlias = null, + comment = null, + lastWritten = new FILETIME {dwHighDateTime = 0, dwLowDateTime = 0}, + persist = 2, // persist on local machine + attibuteCount = 0, + attributes = IntPtr.Zero, + userName = keyStoreUserName + }; + + // Pull bits out of SecureString to put in credential + IntPtr credPtr = IntPtr.Zero; + try + { + credential.credentialBlob = Marshal.SecureStringToGlobalAllocUnicode(serviceKey); + credential.credentialBlobSize = (uint)(serviceKey.Length * Marshal.SystemDefaultCharSize); + + int size = Marshal.SizeOf(credential); + credPtr = Marshal.AllocHGlobal(size); + + Marshal.StructureToPtr(credential, credPtr, false); + CredStore.NativeMethods.CredWrite(credPtr, 0); + } + finally + { + if (credPtr != IntPtr.Zero) + { + Marshal.FreeHGlobal(credPtr); + } + + Marshal.ZeroFreeGlobalAllocUnicode(credential.credentialBlob); + } + } + + public static SecureString GetKey(string appId, string tenantId) + { + IntPtr pCredential = IntPtr.Zero; + try + { + if (CredStore.NativeMethods.CredRead( + CreateKey(appId, tenantId), + CredStore.CredentialType.Generic, 0, + out pCredential)) + { + var credential = (CredStore.NativeMethods.Credential) + Marshal.PtrToStructure(pCredential, typeof (CredStore.NativeMethods.Credential)); + unsafe + { + return new SecureString((char*) (credential.credentialBlob), + (int)(credential.credentialBlobSize/Marshal.SystemDefaultCharSize)); + } + } + return null; + } + catch + { + // we could be running in an environment that does not have credentials store + } + finally + { + if (pCredential != IntPtr.Zero) + { + CredStore.NativeMethods.CredFree(pCredential); + } + } + + return null; + } + + + public static void DeleteKey(string appId, string tenantId) + { + CredStore.NativeMethods.CredDelete(CreateKey(appId, tenantId), CredStore.CredentialType.Generic, 0); + } + + private static string CreateKey(string appId, string tenantId) + { + return string.Format("{0}AppId={1};Tenant={2}", targetNamePrefix, appId, tenantId); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/ServicePrincipalTokenProvider.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/ServicePrincipalTokenProvider.cs new file mode 100644 index 000000000000..c6d1d4a63aaa --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/ServicePrincipalTokenProvider.cs @@ -0,0 +1,166 @@ +// ---------------------------------------------------------------------------------- +// Copyright Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication.Properties; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.Collections.Generic; +using System.Security; + +namespace Microsoft.Azure.Common.Authentication +{ + internal class ServicePrincipalTokenProvider : ITokenProvider + { + private static readonly TimeSpan expirationThreshold = TimeSpan.FromMinutes(5); + + public IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, SecureString password, + AzureAccount.AccountType credentialType) + { + if (credentialType == AzureAccount.AccountType.User) + { + throw new ArgumentException(string.Format(Resources.InvalidCredentialType, "User"), "credentialType"); + } + return new ServicePrincipalAccessToken(config, AcquireTokenWithSecret(config, userId, password), this.RenewWithSecret, userId); + } + + public IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string clientId, string certificateThumbprint, AzureAccount.AccountType credentialType) + { + if (credentialType == AzureAccount.AccountType.User) + { + throw new ArgumentException(string.Format(Resources.InvalidCredentialType, "User"), "credentialType"); + } + return new ServicePrincipalAccessToken(config, AcquireTokenWithCertificate(config, clientId, certificateThumbprint), + (adalConfig, appId) => this.RenewWithCertificate(adalConfig, appId, certificateThumbprint), clientId); + } + + private AuthenticationContext GetContext(AdalConfiguration config) + { + string authority = config.AdEndpoint + config.AdDomain; + return new AuthenticationContext(authority, config.ValidateAuthority, config.TokenCache); + } + + private AuthenticationResult AcquireTokenWithSecret(AdalConfiguration config, string appId, SecureString appKey) + { + if (appKey == null) + { + return RenewWithSecret(config, appId); + } + + StoreAppKey(appId, config.AdDomain, appKey); + var credential = new ClientCredential(appId, appKey); + var context = GetContext(config); + return context.AcquireToken(config.ResourceClientUri, credential); + } + + private AuthenticationResult AcquireTokenWithCertificate(AdalConfiguration config, string appId, + string thumbprint) + { + var certificate = AzureSession.DataStore.GetCertificate(thumbprint); + if (certificate == null) + { + throw new ArgumentException(string.Format(Resources.CertificateNotFoundInStore, thumbprint)); + } + + var context = GetContext(config); + return context.AcquireToken(config.ResourceClientUri, new ClientAssertionCertificate(appId, certificate)); + } + + private AuthenticationResult RenewWithSecret(AdalConfiguration config, string appId) + { + TracingAdapter.Information(Resources.SPNRenewTokenTrace, appId, config.AdDomain, config.AdEndpoint, + config.ClientId, config.ClientRedirectUri); + using (SecureString appKey = LoadAppKey(appId, config.AdDomain)) + { + if (appKey == null) + { + throw new KeyNotFoundException(string.Format(Resources.ServiceKeyNotFound, appId)); + } + return AcquireTokenWithSecret(config, appId, appKey); + } + } + + private AuthenticationResult RenewWithCertificate(AdalConfiguration config, string appId, + string thumbprint) + { + TracingAdapter.Information(Resources.SPNRenewTokenTrace, appId, config.AdDomain, config.AdEndpoint, + config.ClientId, config.ClientRedirectUri); + return AcquireTokenWithCertificate(config, appId, thumbprint); + } + + private SecureString LoadAppKey(string appId, string tenantId) + { + return ServicePrincipalKeyStore.GetKey(appId, tenantId); + } + + private void StoreAppKey(string appId, string tenantId, SecureString appKey) + { + ServicePrincipalKeyStore.SaveKey(appId, tenantId, appKey); + } + + + private class ServicePrincipalAccessToken : IAccessToken + { + internal readonly AdalConfiguration Configuration; + internal AuthenticationResult AuthResult; + private readonly Func tokenRenewer; + private readonly string appId; + + public ServicePrincipalAccessToken(AdalConfiguration configuration, AuthenticationResult authResult, Func tokenRenewer, string appId) + { + Configuration = configuration; + AuthResult = authResult; + this.tokenRenewer = tokenRenewer; + this.appId = appId; + } + + public void AuthorizeRequest(Action authTokenSetter) + { + if (IsExpired) + { + AuthResult = tokenRenewer(Configuration, appId); + } + + authTokenSetter(AuthResult.AccessTokenType, AuthResult.AccessToken); + } + + public string UserId { get { return appId; } } + public string AccessToken { get { return AuthResult.AccessToken; } } + public LoginType LoginType { get { return LoginType.OrgId; } } + public string TenantId { get { return this.Configuration.AdDomain; } } + + private bool IsExpired + { + get + { +#if DEBUG + if (Environment.GetEnvironmentVariable("FORCE_EXPIRED_ACCESS_TOKEN") != null) + { + return true; + } +#endif + + var expiration = AuthResult.ExpiresOn; + var currentTime = DateTimeOffset.UtcNow; + var timeUntilExpiration = expiration - currentTime; + TracingAdapter.Information(Resources.SPNTokenExpirationCheckTrace, expiration, currentTime, + expirationThreshold, timeUntilExpiration); + return timeUntilExpiration < expirationThreshold; + } + } + } + } +} + diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/ShowDialog.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/ShowDialog.cs new file mode 100644 index 000000000000..a4c4882119bd --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/ShowDialog.cs @@ -0,0 +1,23 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Common.Authentication +{ + public enum ShowDialog + { + Auto, + Always, + Never + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/stuff/Authentication/UserTokenProvider.cs b/src/Common/Commands.Common.Authentication/stuff/Authentication/UserTokenProvider.cs new file mode 100644 index 000000000000..ad20eac71a86 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Authentication/UserTokenProvider.cs @@ -0,0 +1,301 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication.Properties; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Authentication; +using System.Threading; +using System.Windows.Forms; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// A token provider that uses ADAL to retrieve + /// tokens from Azure Active Directory for user + /// credentials. + /// + internal class UserTokenProvider : ITokenProvider + { + private readonly IWin32Window parentWindow; + + public UserTokenProvider(IWin32Window parentWindow) + { + this.parentWindow = parentWindow; + } + + public IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, SecureString password, + AzureAccount.AccountType credentialType) + { + if (credentialType != AzureAccount.AccountType.User) + { + throw new ArgumentException(string.Format(Resources.InvalidCredentialType, "User"), "credentialType"); + } + + return new AdalAccessToken(AcquireToken(config, promptBehavior, userId, password), this, config); + } + + private readonly static TimeSpan expirationThreshold = TimeSpan.FromMinutes(5); + + private bool IsExpired(AdalAccessToken token) + { +#if DEBUG + if (Environment.GetEnvironmentVariable("FORCE_EXPIRED_ACCESS_TOKEN") != null) + { + return true; + } +#endif + var expiration = token.AuthResult.ExpiresOn; + var currentTime = DateTimeOffset.UtcNow; + var timeUntilExpiration = expiration - currentTime; + TracingAdapter.Information(Resources.UPNTokenExpirationCheckTrace, expiration, currentTime, expirationThreshold, + timeUntilExpiration); + return timeUntilExpiration < expirationThreshold; + } + + private void Renew(AdalAccessToken token) + { + TracingAdapter.Information(Resources.UPNRenewTokenTrace, token.AuthResult.AccessTokenType, token.AuthResult.ExpiresOn, + token.AuthResult.IsMultipleResourceRefreshToken, token.AuthResult.TenantId, token.UserId); + var user = token.AuthResult.UserInfo; + if (user != null) + { + TracingAdapter.Information(Resources.UPNRenewTokenUserInfoTrace, user.DisplayableId, user.FamilyName, + user.GivenName, user.IdentityProvider, user.UniqueId); + } + if (IsExpired(token)) + { + TracingAdapter.Information(Resources.UPNExpiredTokenTrace); + AuthenticationResult result = AcquireToken(token.Configuration, ShowDialog.Never, token.UserId, null); + + if (result == null) + { + throw new AuthenticationException(Resources.ExpiredRefreshToken); + } + else + { + token.AuthResult = result; + } + } + } + + private AuthenticationContext CreateContext(AdalConfiguration config) + { + return new AuthenticationContext(config.AdEndpoint + config.AdDomain, config.ValidateAuthority, config.TokenCache) + { + OwnerWindow = parentWindow + }; + } + + // We have to run this in a separate thread to guarantee that it's STA. This method + // handles the threading details. + private AuthenticationResult AcquireToken(AdalConfiguration config, ShowDialog promptBehavior, string userId, + SecureString password) + { + AuthenticationResult result = null; + Exception ex = null; + if (promptBehavior == ShowDialog.Never) + { + result = SafeAquireToken(config, promptBehavior, userId, password, out ex); + } + else + { + var thread = new Thread(() => + { + result = SafeAquireToken(config, promptBehavior, userId, password, out ex); + }); + + thread.SetApartmentState(ApartmentState.STA); + thread.Name = "AcquireTokenThread"; + thread.Start(); + thread.Join(); + } + + if (ex != null) + { + var adex = ex as AdalException; + if (adex != null) + { + if (adex.ErrorCode == AdalError.AuthenticationCanceled) + { + throw new AadAuthenticationCanceledException(adex.Message, adex); + } + } + if (ex is AadAuthenticationException) + { + throw ex; + } + throw new AadAuthenticationFailedException(GetExceptionMessage(ex), ex); + } + + return result; + } + + private AuthenticationResult SafeAquireToken( + AdalConfiguration config, + ShowDialog showDialog, + string userId, + SecureString password, + out Exception ex) + { + try + { + ex = null; + var promptBehavior = (PromptBehavior)Enum.Parse(typeof(PromptBehavior), showDialog.ToString()); + + return DoAcquireToken(config, promptBehavior, userId, password); + } + catch (AdalException adalEx) + { + if (adalEx.ErrorCode == AdalError.UserInteractionRequired || + adalEx.ErrorCode == AdalError.MultipleTokensMatched) + { + string message = Resources.AdalUserInteractionRequired; + if (adalEx.ErrorCode == AdalError.MultipleTokensMatched) + { + message = Resources.AdalMultipleTokens; + } + + ex = new AadAuthenticationFailedWithoutPopupException(message, adalEx); + } + else if (adalEx.ErrorCode == AdalError.MissingFederationMetadataUrl) + { + ex = new AadAuthenticationFailedException(Resources.CredentialOrganizationIdMessage, adalEx); + } + else + { + ex = adalEx; + } + } + catch (Exception threadEx) + { + ex = threadEx; + } + return null; + } + + private AuthenticationResult DoAcquireToken(AdalConfiguration config, PromptBehavior promptBehavior, string userId, + SecureString password) + { + AuthenticationResult result; + var context = CreateContext(config); + + TracingAdapter.Information(Resources.UPNAcquireTokenContextTrace, context.Authority, context.CorrelationId, + context.ValidateAuthority); + TracingAdapter.Information(Resources.UPNAcquireTokenConfigTrace, config.AdDomain, config.AdEndpoint, + config.ClientId, config.ClientRedirectUri); + if (string.IsNullOrEmpty(userId)) + { + if (promptBehavior != PromptBehavior.Never) + { + ClearCookies(); + } + + result = context.AcquireToken(config.ResourceClientUri, config.ClientId, + config.ClientRedirectUri, promptBehavior, + UserIdentifier.AnyUser, AdalConfiguration.EnableEbdMagicCookie); + } + else + { + if (password == null) + { + result = context.AcquireToken(config.ResourceClientUri, config.ClientId, + config.ClientRedirectUri, promptBehavior, + new UserIdentifier(userId, UserIdentifierType.RequiredDisplayableId), + AdalConfiguration.EnableEbdMagicCookie); + } + else + { + UserCredential credential = new UserCredential(userId, password); + result = context.AcquireToken(config.ResourceClientUri, config.ClientId, credential); + } + } + return result; + } + + private string GetExceptionMessage(Exception ex) + { + string message = ex.Message; + if (ex.InnerException != null) + { + message += ": " + ex.InnerException.Message; + } + return message; + } + /// + /// Implementation of using data from ADAL + /// + private class AdalAccessToken : IAccessToken + { + internal readonly AdalConfiguration Configuration; + internal AuthenticationResult AuthResult; + private readonly UserTokenProvider tokenProvider; + + public AdalAccessToken(AuthenticationResult authResult, UserTokenProvider tokenProvider, AdalConfiguration configuration) + { + AuthResult = authResult; + this.tokenProvider = tokenProvider; + Configuration = configuration; + } + + public void AuthorizeRequest(Action authTokenSetter) + { + tokenProvider.Renew(this); + authTokenSetter(AuthResult.AccessTokenType, AuthResult.AccessToken); + } + + public string AccessToken { get { return AuthResult.AccessToken; } } + public string UserId { get { return AuthResult.UserInfo.DisplayableId; } } + + public string TenantId { get { return AuthResult.TenantId; } } + + public LoginType LoginType + { + get + { + if (AuthResult.UserInfo.IdentityProvider != null) + { + return LoginType.LiveId; + } + return LoginType.OrgId; + } + } + } + + + private void ClearCookies() + { + NativeMethods.InternetSetOption(IntPtr.Zero, NativeMethods.INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0); + } + + private static class NativeMethods + { + internal const int INTERNET_OPTION_END_BROWSER_SESSION = 42; + + [DllImport("wininet.dll", SetLastError = true)] + internal static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, + int lpdwBufferLength); + } + + public IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string clientId, string certificate, AzureAccount.AccountType credentialType) + { + throw new NotImplementedException(); + } + } +} + diff --git a/src/Common/Commands.Common.Authentication/stuff/AzureSession.cs b/src/Common/Commands.Common.Authentication/stuff/AzureSession.cs new file mode 100644 index 000000000000..ac6d1236750d --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/AzureSession.cs @@ -0,0 +1,89 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication.Properties; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System; +using System.IO; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// Represents current Azure session. + /// + public static class AzureSession + { + /// + /// Gets or sets Azure client factory. + /// + public static IClientFactory ClientFactory { get; set; } + + /// + /// Gets or sets Azure authentication factory. + /// + public static IAuthenticationFactory AuthenticationFactory { get; set; } + + /// + /// Gets or sets data persistence store. + /// + public static IDataStore DataStore { get; set; } + + /// + /// Gets or sets the token cache store. + /// + public static TokenCache TokenCache { get; set; } + + /// + /// Gets or sets profile directory. + /// + public static string ProfileDirectory { get; set; } + + /// + /// Gets or sets token cache file path. + /// + public static string TokenCacheFile { get; set; } + + /// + /// Gets or sets profile file name. + /// + public static string ProfileFile { get; set; } + + /// + /// Gets or sets file name for the migration backup. + /// + public static string OldProfileFileBackup { get; set; } + + /// + /// Gets or sets old profile file name. + /// + public static string OldProfileFile { get; set; } + + static AzureSession() + { + ClientFactory = new ClientFactory(); + AuthenticationFactory = new AuthenticationFactory(); + DataStore = new MemoryDataStore(); + TokenCache = new TokenCache(); + OldProfileFile = "WindowsAzureProfile.xml"; + OldProfileFileBackup = "WindowsAzureProfile.xml.bak"; + ProfileDirectory = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + Resources.AzureDirectoryName); ; + ProfileFile = "AzureProfile.json"; + TokenCacheFile = "TokenCache.dat"; + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Common/AzureModule.cs b/src/Common/Commands.Common.Authentication/stuff/Common/AzureModule.cs new file mode 100644 index 000000000000..21de827e3025 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Common/AzureModule.cs @@ -0,0 +1,23 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Common.Authentication +{ + public enum AzureModule + { + AzureServiceManagement, + AzureResourceManager, + AzureProfile + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Common/ProfileData.cs b/src/Common/Commands.Common.Authentication/stuff/Common/ProfileData.cs new file mode 100644 index 000000000000..67118a0119d7 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Common/ProfileData.cs @@ -0,0 +1,272 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Microsoft.Azure.Common.Authentication +{ + /// + /// This class provides the representation of + /// data loaded and saved into data files + /// for AzureSMProfile. + /// + [DataContract] + public class ProfileData + { + [DataMember] + public string DefaultEnvironmentName { get; set; } + + [DataMember] + public IEnumerable Environments { get; set; } + + [DataMember] + public IEnumerable Subscriptions { get; set; } + } + + /// + /// This class provides the representation of + /// data loaded and saved into data files for + /// an individual Azure environment + /// + [DataContract] + public class AzureEnvironmentData + { + public AzureEnvironment ToAzureEnvironment() + { + return new AzureEnvironment + { + Name = this.Name, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, this.ActiveDirectoryServiceEndpointResourceId }, + { AzureEnvironment.Endpoint.AdTenant, this.AdTenantUrl }, + { AzureEnvironment.Endpoint.Gallery, this.GalleryEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, this.ManagementPortalUrl }, + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, this.PublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ResourceManager, this.ResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ServiceManagement, this.ServiceEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, this.SqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, this.StorageEndpointSuffix }, + { AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, this.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix }, + { AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, this.AzureDataLakeStoreFileSystemEndpointSuffix }, + } + }; + } + + [DataMember] + public string Name { get; set; } + + [DataMember] + public string PublishSettingsFileUrl { get; set; } + + [DataMember] + public string ServiceEndpoint { get; set; } + + [DataMember] + public string ResourceManagerEndpoint { get; set; } + + [DataMember] + public string ManagementPortalUrl { get; set; } + + [DataMember] + public string StorageEndpointSuffix { get; set; } + + [DataMember] + public string AdTenantUrl { get; set; } + + [DataMember] + public string CommonTenantId { get; set; } + + [DataMember] + public string GalleryEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryServiceEndpointResourceId { get; set; } + + [DataMember] + public string SqlDatabaseDnsSuffix { get; set; } + + [DataMember] + public string TrafficManagerEndpointSuffix { get; set; } + + [DataMember] + public string AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix { get; set; } + + [DataMember] + public string AzureDataLakeStoreFileSystemEndpointSuffix { get; set; } + } + + /// + /// This class provides the representation of data loaded + /// and saved into data file for an individual Azure subscription. + /// + [DataContract] + public class AzureSubscriptionData + { + /// + /// Constructor used by DataContractSerializer + /// + public AzureSubscriptionData() + { + } + + public AzureSubscription ToAzureSubscription(List envs) + { + AzureSubscription subscription = new AzureSubscription(); + try + { + subscription.Id = new Guid(this.SubscriptionId); + } + catch (Exception ex) + { + throw new ArgumentException("Subscription ID is not a valid GUID.", ex); + } + subscription.Name = Name; + + // Logic to detect what is the subscription environment rely's on having ManagementEndpoint (i.e. RDFE endpoint) set already on the subscription + List allEnvs = envs.Union(AzureEnvironment.PublicEnvironments.Values).ToList(); + AzureEnvironment env = allEnvs.FirstOrDefault(e => e.IsEndpointSetToValue(AzureEnvironment.Endpoint.ServiceManagement, this.ManagementEndpoint)); + + if (env != null) + { + subscription.Environment = env.Name; + } + else + { + subscription.Environment = EnvironmentName.AzureCloud; + } + + if (!string.IsNullOrEmpty(this.ManagementCertificate)) + { + subscription.Account = this.ManagementCertificate; + } + + if (!string.IsNullOrEmpty(this.ActiveDirectoryUserId)) + { + subscription.Account = this.ActiveDirectoryUserId; + } + + if (!string.IsNullOrEmpty(this.ActiveDirectoryTenantId)) + { + subscription.SetProperty(AzureSubscription.Property.Tenants, ActiveDirectoryTenantId); + } + + if (this.IsDefault) + { + subscription.SetProperty(AzureSubscription.Property.Default, "True"); + } + + if (!string.IsNullOrEmpty(this.CloudStorageAccount)) + { + subscription.Properties.Add(AzureSubscription.Property.StorageAccount, this.CloudStorageAccount); + } + + if (this.RegisteredResourceProviders.Count() > 0) + { + StringBuilder providers = new StringBuilder(); + subscription.Properties.Add(AzureSubscription.Property.RegisteredResourceProviders, + string.Join(",", RegisteredResourceProviders)); + } + + return subscription; + } + + public IEnumerable ToAzureAccounts() + { + if (!string.IsNullOrEmpty(ActiveDirectoryUserId)) + { + AzureAccount userAccount = new AzureAccount + { + Id = ActiveDirectoryUserId, + Type = AzureAccount.AccountType.User + }; + + userAccount.SetProperty(AzureAccount.Property.Subscriptions, new Guid(this.SubscriptionId).ToString()); + + if (!string.IsNullOrEmpty(ActiveDirectoryTenantId)) + { + userAccount.SetProperty(AzureAccount.Property.Tenants, ActiveDirectoryTenantId); + } + + yield return userAccount; + } + + if (!string.IsNullOrEmpty(ManagementCertificate)) + { + AzureAccount certificateAccount = new AzureAccount + { + Id = ManagementCertificate, + Type = AzureAccount.AccountType.Certificate + }; + + certificateAccount.SetProperty(AzureAccount.Property.Subscriptions, new Guid(this.SubscriptionId).ToString()); + + yield return certificateAccount; + } + } + + [DataMember] + public string Name { get; set; } + + [DataMember] + public string SubscriptionId { get; set; } + + [DataMember] + public string ManagementEndpoint { get; set; } + + [DataMember] + public string ResourceManagerEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryTenantId { get; set; } + + [DataMember] + public string ActiveDirectoryUserId { get; set; } + + [DataMember] + public string LoginType { get; set; } + + [DataMember] + public bool IsDefault { get; set; } + + [DataMember] + public string ManagementCertificate { get; set; } + + [DataMember] + public string CloudStorageAccount { get; set; } + + [DataMember] + public IEnumerable RegisteredResourceProviders { get; set; } + + [DataMember] + public string GalleryEndpoint { get; set; } + + [DataMember] + public string ActiveDirectoryServiceEndpointResourceId { get; set; } + + [DataMember] + public string SqlDatabaseDnsSuffix { get; set; } + + [DataMember] + public string TrafficManagerEndpointSuffix { get; set; } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/stuff/Common/Validate.cs b/src/Common/Commands.Common.Authentication/stuff/Common/Validate.cs new file mode 100644 index 000000000000..fbea0fea0ac9 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Common/Validate.cs @@ -0,0 +1,218 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Properties; +using System; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Runtime.InteropServices; + +namespace Microsoft.Azure.Common.Authentication +{ + public static class Validate + { + [Flags] + enum InternetConnectionState : int + { + INTERNET_CONNECTION_MODEM = 0x1, + INTERNET_CONNECTION_LAN = 0x2, + INTERNET_CONNECTION_PROXY = 0x4, + INTERNET_RAS_INSTALLED = 0x10, + INTERNET_CONNECTION_OFFLINE = 0x20, + INTERNET_CONNECTION_CONFIGURED = 0x40 + } + + [SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass", Justification = "Not necessary for a single p-invoke")] + [DllImport("WININET", CharSet = CharSet.Auto)] + static extern bool InternetGetConnectedState(ref InternetConnectionState lpdwFlags, int dwReserved); + + /// + /// Validates against given string if null or empty. + /// + /// string variable to validate + /// This parameter is used when the validation fails. It can contain actual message to display + /// or parameter name to display with default message + /// Indicates either to use messageData as actual message or parameter name + public static void ValidateStringIsNullOrEmpty(string data, string messageData, bool useDefaultMessage = true) + { + if (string.IsNullOrEmpty(data)) + { + // In this case use messageData parameter as name for null/empty string. + if (useDefaultMessage) + { + throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, messageData)); + } + else + { + // Use the message provided by the user + throw new ArgumentException(messageData); + } + } + } + + public static void ValidatePathName(string element, string exceptionMessage) + { + if (element.IndexOfAny(Path.GetInvalidPathChars()) != -1) + { + throw new ArgumentException(exceptionMessage); + } + } + + public static void ValidateFileName(string element, string exceptionMessage = null) + { + try + { + string fileName = Path.GetFileName(element); + + if (fileName.IndexOfAny(Path.GetInvalidFileNameChars()) != -1) + { + throw new ArgumentException(exceptionMessage ?? string.Empty); + } + } + catch + { + throw new ArgumentException(exceptionMessage ?? string.Empty); + } + } + + public static void ValidateFileExists(string filePath, string exceptionMessage) + { + if (!FileUtilities.DataStore.FileExists(filePath)) + { + throw new FileNotFoundException(exceptionMessage); + } + } + + public static void ValidateDirectoryExists(string directory, string exceptionMessage = null) + { + string msg = string.Format(Resources.PathDoesNotExist, directory); + + if (!FileUtilities.DataStore.DirectoryExists(directory)) + { + if (!string.IsNullOrEmpty(exceptionMessage)) + { + msg = exceptionMessage; + } + + throw new FileNotFoundException(msg); + } + } + + public static void ValidateNullArgument(object item, string exceptionMessage) + { + if (item == null) + { + throw new ArgumentException(exceptionMessage); + } + } + + public static void ValidateFileExtention(string filePath, string desiredExtention) + { + bool invalidExtension = Convert.ToBoolean(string.Compare(Path.GetExtension(filePath), desiredExtention, true)); + + if (invalidExtension) + { + throw new ArgumentException(string.Format(Resources.InvalidFileExtension, filePath, desiredExtention)); + } + } + + public static void ValidateDnsName(string dnsName, string parameterName) + { + if (Uri.CheckHostName(dnsName) != UriHostNameType.Dns || dnsName.EndsWith("-")) + { + throw new ArgumentException(string.Format(Resources.InvalidDnsName, dnsName, parameterName)); + } + } + + public static void ValidateDnsDoesNotExist(string dnsName) + { + try + { + Dns.GetHostEntry(dnsName); + // Dns does exist throw exception + // + throw new ArgumentException(string.Format(Resources.ServiceNameExists, dnsName)); + } + catch (SocketException) + { + // Dns doesn't exist + } + } + + public static void ValidateInternetConnection() + { + InternetConnectionState flags = 0; + + if (!InternetGetConnectedState(ref flags, 0)) + { + throw new Exception(Resources.NoInternetConnection); + } + } + + public static void HasWhiteCharacter(string text, string exceptionMessage = null) + { + if (text.Any(char.IsWhiteSpace)) + { + throw new ArgumentException(exceptionMessage ?? string.Empty); + } + } + + /// + /// Make validation for given path. + /// + /// Path to validate + /// message to display if this validation failed + public static void ValidatePath(string path, string exceptionMessage) + { + ValidateStringIsNullOrEmpty(path, exceptionMessage, false); + ValidatePathName(path, exceptionMessage); + } + + /// + /// Validates against given directory + /// + /// Directory name + /// Name which you use to identify that directory to user (i.e. AzureSdkDirectory) + public static void ValidateDirectoryFull(string directoryNameOnDisk, string directoryName) + { + BasicFileAndDirectoryValidation(directoryNameOnDisk, directoryName); + ValidateDirectoryExists(directoryNameOnDisk, string.Format(Resources.PathDoesNotExistForElement, directoryName, directoryNameOnDisk)); + } + + private static void BasicFileAndDirectoryValidation(string fullPath, string name) + { + ValidateStringIsNullOrEmpty(fullPath, name); + ValidateFileName(fullPath, Resources.IllegalPath); + string directoryPath = Path.GetDirectoryName(fullPath); + if (!string.IsNullOrEmpty(directoryPath)) + { + ValidatePath(fullPath, Resources.IllegalPath); + } + } + + /// + /// Validates against given file + /// + /// File name + /// Name which you use to identify that directory to user (i.e. Service Settings) + public static void ValidateFileFull(string fileNameOnDisk, string fileName) + { + BasicFileAndDirectoryValidation(fileNameOnDisk, fileName); + ValidateFileExists(fileNameOnDisk, string.Format(Resources.PathDoesNotExistForElement, fileName, fileNameOnDisk)); + } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common.Authentication/stuff/Extensions/CloudExceptionExtensions.cs b/src/Common/Commands.Common.Authentication/stuff/Extensions/CloudExceptionExtensions.cs new file mode 100644 index 000000000000..f51f6698d518 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Extensions/CloudExceptionExtensions.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using Hyak.Common; +using System.Linq; + +namespace Microsoft.Azure.Common +{ + public static class CloudExceptionExtensions + { + public static string GetRequestId(this CloudException exception) + { + if(exception == null || + exception.Response == null || + exception.Response.Headers == null || + !exception.Response.Headers.Keys.Contains("x-ms-request-id")) + { + return null; + } + + return exception.Response.Headers["x-ms-request-id"].FirstOrDefault(); + + } + public static string GetRoutingRequestId(this CloudException exception) + { + if (exception == null || + exception.Response == null || + exception.Response.Headers == null || + !exception.Response.Headers.Keys.Contains("x-ms-routing-request-id")) + { + return null; + } + + return exception.Response.Headers["x-ms-routing-request-id"].FirstOrDefault(); + + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Factories/AuthenticationFactory.cs b/src/Common/Commands.Common.Authentication/stuff/Factories/AuthenticationFactory.cs new file mode 100644 index 000000000000..9ded6ea85554 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Factories/AuthenticationFactory.cs @@ -0,0 +1,302 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication.Properties; +using System; +using System.Linq; +using System.Security; +using Hyak.Common; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest; +using Microsoft.Rest.Azure.Authentication; + +namespace Microsoft.Azure.Common.Authentication.Factories +{ + public class AuthenticationFactory : IAuthenticationFactory + { + public const string CommonAdTenant = "Common"; + + public AuthenticationFactory() + { + TokenProvider = new AdalTokenProvider(); + } + + public ITokenProvider TokenProvider { get; set; } + + public IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + TokenCache tokenCache, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId) + { + var configuration = GetAdalConfiguration(environment, tenant, resourceId, tokenCache); + + TracingAdapter.Information(Resources.AdalAuthConfigurationTrace, configuration.AdDomain, configuration.AdEndpoint, + configuration.ClientId, configuration.ClientRedirectUri, configuration.ResourceClientUri, configuration.ValidateAuthority); + IAccessToken token; + if (account.IsPropertySet(AzureAccount.Property.CertificateThumbprint)) + { + var thumbprint = account.GetProperty(AzureAccount.Property.CertificateThumbprint); + token = TokenProvider.GetAccessTokenWithCertificate(configuration, account.Id, thumbprint, account.Type); + } + else + { + + token = TokenProvider.GetAccessToken(configuration, promptBehavior, account.Id, password, account.Type); + } + + account.Id = token.UserId; + return token; + } + + public IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId) + { + return Authenticate(account, environment, tenant, password, promptBehavior, AzureSession.TokenCache, resourceId); + } + + public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context) + { + return GetSubscriptionCloudCredentials(context, AzureEnvironment.Endpoint.ServiceManagement); + } + + public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context, AzureEnvironment.Endpoint targetEndpoint) + { + if (context.Subscription == null) + { + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.InvalidDefaultSubscription + : Resources.NoSubscriptionInContext; + throw new ApplicationException(exceptionMessage); + } + + if (context.Account == null) + { + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.AccountNotFound + : Resources.ArmAccountNotFound; + throw new ArgumentException(exceptionMessage); + } + + if (context.Account.Type == AzureAccount.AccountType.Certificate) + { + var certificate = AzureSession.DataStore.GetCertificate(context.Account.Id); + return new CertificateCloudCredentials(context.Subscription.Id.ToString(), certificate); + } + + if (context.Account.Type == AzureAccount.AccountType.AccessToken) + { + return new TokenCloudCredentials(context.Subscription.Id.ToString(), context.Account.GetProperty(AzureAccount.Property.AccessToken)); + } + + string tenant = null; + + if (context.Subscription != null && context.Account != null) + { + tenant = context.Subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants) + .Intersect(context.Account.GetPropertyAsArray(AzureAccount.Property.Tenants)) + .FirstOrDefault(); + } + + if (tenant == null && context.Tenant != null && context.Tenant.Id != Guid.Empty) + { + tenant = context.Tenant.Id.ToString(); + } + + if (tenant == null) + { + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.TenantNotFound + : Resources.NoTenantInContext; + throw new ArgumentException(exceptionMessage); + } + + try + { + TracingAdapter.Information(Resources.UPNAuthenticationTrace, + context.Account.Id, context.Environment.Name, tenant); + var tokenCache = AzureSession.TokenCache; + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + tokenCache = new TokenCache(context.TokenCache); + } + + var token = Authenticate(context.Account, context.Environment, + tenant, null, ShowDialog.Never, tokenCache, context.Environment.GetTokenAudience(targetEndpoint)); + + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + context.TokenCache = tokenCache.Serialize(); + } + + TracingAdapter.Information(Resources.UPNAuthenticationTokenTrace, + token.LoginType, token.TenantId, token.UserId); + return new AccessTokenCredential(context.Subscription.Id, token); + } + catch (Exception ex) + { + TracingAdapter.Information(Resources.AdalAuthException, ex.Message); + var exceptionMessage = targetEndpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.InvalidSubscriptionState + : Resources.InvalidArmContext; + throw new ArgumentException(exceptionMessage, ex); + } + } + + public ServiceClientCredentials GetServiceClientCredentials(AzureContext context) + { + return GetServiceClientCredentials(context, + AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId); + } + + public ServiceClientCredentials GetServiceClientCredentials(AzureContext context, AzureEnvironment.Endpoint targetEndpoint) + { + if (context.Account == null) + { + throw new ArgumentException(Resources.ArmAccountNotFound); + } + + if (context.Account.Type == AzureAccount.AccountType.Certificate) + { + throw new NotSupportedException(AzureAccount.AccountType.Certificate.ToString()); + } + + if (context.Account.Type == AzureAccount.AccountType.AccessToken) + { + return new TokenCredentials(context.Account.GetProperty(AzureAccount.Property.AccessToken)); + } + + string tenant = null; + + if (context.Subscription != null && context.Account != null) + { + tenant = context.Subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants) + .Intersect(context.Account.GetPropertyAsArray(AzureAccount.Property.Tenants)) + .FirstOrDefault(); + } + + if (tenant == null && context.Tenant != null && context.Tenant.Id != Guid.Empty) + { + tenant = context.Tenant.Id.ToString(); + } + + if (tenant == null) + { + throw new ArgumentException(Resources.NoTenantInContext); + } + + try + { + TracingAdapter.Information(Resources.UPNAuthenticationTrace, + context.Account.Id, context.Environment.Name, tenant); + + // TODO: When we will refactor the code, need to add tracing + /*TracingAdapter.Information(Resources.UPNAuthenticationTokenTrace, + token.LoginType, token.TenantId, token.UserId);*/ + + var env = new ActiveDirectoryServiceSettings + { + AuthenticationEndpoint = context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ActiveDirectory), + TokenAudience = context.Environment.GetEndpointAsUri(context.Environment.GetTokenAudience(targetEndpoint)), + ValidateAuthority = !context.Environment.OnPremise + }; + + var tokenCache = AzureSession.TokenCache; + + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + tokenCache = new TokenCache(context.TokenCache); + } + + ServiceClientCredentials result = null; + + if (context.Account.Type == AzureAccount.AccountType.User) + { + result = Rest.Azure.Authentication.UserTokenProvider.CreateCredentialsFromCache( + AdalConfiguration.PowerShellClientId, + tenant, + context.Account.Id, + env, + tokenCache).ConfigureAwait(false).GetAwaiter().GetResult(); + } + else if (context.Account.Type == AzureAccount.AccountType.ServicePrincipal) + { + if (context.Account.IsPropertySet(AzureAccount.Property.CertificateThumbprint)) + { + result = ApplicationTokenProvider.LoginSilentAsync( + tenant, + context.Account.Id, + new CertificateApplicationCredentialProvider( + context.Account.GetProperty(AzureAccount.Property.CertificateThumbprint)), + env, + tokenCache).ConfigureAwait(false).GetAwaiter().GetResult(); + } + else + { + result = ApplicationTokenProvider.LoginSilentAsync( + tenant, + context.Account.Id, + new KeyStoreApplicationCredentialProvider(tenant), + env, + tokenCache).ConfigureAwait(false).GetAwaiter().GetResult(); + } + } + else + { + throw new NotSupportedException(context.Account.Type.ToString()); + } + + if (context.TokenCache != null && context.TokenCache.Length > 0) + { + context.TokenCache = tokenCache.Serialize(); + } + + return result; + } + catch (Exception ex) + { + TracingAdapter.Information(Resources.AdalAuthException, ex.Message); + throw new ArgumentException(Resources.InvalidArmContext, ex); + } + } + + private AdalConfiguration GetAdalConfiguration(AzureEnvironment environment, string tenantId, + AzureEnvironment.Endpoint resourceId, TokenCache tokenCache) + { + if (environment == null) + { + throw new ArgumentNullException("environment"); + } + var adEndpoint = environment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectory]; + + return new AdalConfiguration + { + AdEndpoint = adEndpoint, + ResourceClientUri = environment.Endpoints[resourceId], + AdDomain = tenantId, + ValidateAuthority = !environment.OnPremise, + TokenCache = tokenCache + }; + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Factories/ClientFactory.cs b/src/Common/Commands.Common.Authentication/stuff/Factories/ClientFactory.cs new file mode 100644 index 000000000000..39004b1b23bf --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Factories/ClientFactory.cs @@ -0,0 +1,312 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication.Properties; +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Microsoft.Azure.Common.Authentication.Factories +{ + public class ClientFactory : IClientFactory + { + private static readonly char[] uriPathSeparator = { '/' }; + + private Dictionary _actions; + private OrderedDictionary _handlers; + + public ClientFactory() + { + _actions = new Dictionary(); + UserAgents = new HashSet(); + _handlers = new OrderedDictionary(); + } + + public virtual TClient CreateArmClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient + { + if (context == null) + { + throw new ApplicationException(Resources.NoSubscriptionInContext); + } + + var creds = AzureSession.AuthenticationFactory.GetServiceClientCredentials(context); + var newHandlers = GetCustomHandlers(); + TClient client = (newHandlers == null || newHandlers.Length == 0) + ? CreateCustomArmClient(context.Environment.GetEndpointAsUri(endpoint), creds) + : CreateCustomArmClient(context.Environment.GetEndpointAsUri(endpoint), creds, GetCustomHandlers()); + + var subscriptionId = typeof(TClient).GetProperty("SubscriptionId"); + if (subscriptionId != null && context.Subscription != null) + { + subscriptionId.SetValue(client, context.Subscription.Id.ToString()); + } + + return client; + } + + public virtual TClient CreateCustomArmClient(params object[] parameters) where TClient : Microsoft.Rest.ServiceClient + { + List types = new List(); + foreach (object obj in parameters) + { + types.Add(obj.GetType()); + } + + var constructor = typeof(TClient).GetConstructor(types.ToArray()); + + if (constructor == null) + { + throw new InvalidOperationException(string.Format(Resources.InvalidManagementClientType, typeof(TClient).Name)); + } + + TClient client = (TClient)constructor.Invoke(parameters); + + foreach (ProductInfoHeaderValue userAgent in UserAgents) + { + client.UserAgent.Add(userAgent); + } + + return client; + } + + public virtual TClient CreateClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + { + if (context == null) + { + var exceptionMessage = endpoint == AzureEnvironment.Endpoint.ServiceManagement + ? Resources.InvalidDefaultSubscription + : Resources.NoSubscriptionInContext; + throw new ApplicationException(exceptionMessage); + } + + SubscriptionCloudCredentials creds = AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(context, endpoint); + TClient client = CreateCustomClient(creds, context.Environment.GetEndpointAsUri(endpoint)); + foreach(DelegatingHandler handler in GetCustomHandlers()) + { + client.AddHandlerToPipeline(handler); + } + + return client; + } + + public virtual TClient CreateClient(AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + { + TClient client = CreateClient(profile.Context, endpoint); + + foreach (IClientAction action in _actions.Values) + { + action.Apply(client, profile, endpoint); + } + + return client; + } + + /// + /// + /// + /// + /// + /// + public virtual TClient CreateClient(AzureSMProfile profile, AzureSubscription subscription, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient + { + if (subscription == null) + { + throw new ApplicationException(Resources.InvalidDefaultSubscription); + } + + if (!profile.Accounts.ContainsKey(subscription.Account)) + { + throw new ArgumentException(string.Format("Account with name '{0}' does not exist.", subscription.Account), "accountName"); + } + + if (!profile.Environments.ContainsKey(subscription.Environment)) + { + throw new ArgumentException(string.Format(Resources.EnvironmentNotFound, subscription.Environment)); + } + + AzureContext context = new AzureContext(subscription, + profile.Accounts[subscription.Account], + profile.Environments[subscription.Environment]); + + TClient client = CreateClient(context, endpoint); + + foreach (IClientAction action in _actions.Values) + { + action.Apply(client, profile, endpoint); + } + + return client; + } + + public virtual TClient CreateCustomClient(params object[] parameters) where TClient : ServiceClient + { + List types = new List(); + foreach (object obj in parameters) + { + types.Add(obj.GetType()); + } + + var constructor = typeof(TClient).GetConstructor(types.ToArray()); + + if (constructor == null) + { + throw new InvalidOperationException(string.Format(Resources.InvalidManagementClientType, typeof(TClient).Name)); + } + + TClient client = (TClient)constructor.Invoke(parameters); + + foreach (ProductInfoHeaderValue userAgent in UserAgents) + { + client.UserAgent.Add(userAgent); + } + + return client; + } + + public virtual HttpClient CreateHttpClient(string endpoint, ICredentials credentials) + { + return CreateHttpClient(endpoint, CreateHttpClientHandler(endpoint, credentials)); + } + + public virtual HttpClient CreateHttpClient(string endpoint, HttpMessageHandler effectiveHandler) + { + if (endpoint == null) + { + throw new ArgumentNullException("endpoint"); + } + + Uri serviceAddr = new Uri(endpoint); + HttpClient client = new HttpClient(effectiveHandler) + { + BaseAddress = serviceAddr, + MaxResponseContentBufferSize = 30 * 1024 * 1024 + }; + + client.DefaultRequestHeaders.Accept.Clear(); + + return client; + } + + public static HttpClientHandler CreateHttpClientHandler(string endpoint, ICredentials credentials) + { + if (endpoint == null) + { + throw new ArgumentNullException("endpoint"); + } + + // Set up our own HttpClientHandler and configure it + HttpClientHandler clientHandler = new HttpClientHandler(); + + if (credentials != null) + { + // Set up credentials cache which will handle basic authentication + CredentialCache credentialCache = new CredentialCache(); + + // Get base address without terminating slash + string credentialAddress = new Uri(endpoint).GetLeftPart(UriPartial.Authority).TrimEnd(uriPathSeparator); + + // Add credentials to cache and associate with handler + NetworkCredential networkCredentials = credentials.GetCredential(new Uri(credentialAddress), "Basic"); + credentialCache.Add(new Uri(credentialAddress), "Basic", networkCredentials); + clientHandler.Credentials = credentialCache; + clientHandler.PreAuthenticate = true; + } + + // Our handler is ready + return clientHandler; + } + + public void AddAction(IClientAction action) + { + if (action != null) + { + action.ClientFactory = this; + _actions[action.GetType()] = action; + } + } + + public void RemoveAction(Type actionType) + { + if (_actions.ContainsKey(actionType)) + { + _actions.Remove(actionType); + } + } + + public void AddHandler(T handler) where T: DelegatingHandler, ICloneable + { + if (handler != null) + { + _handlers[handler.GetType()] = handler; + } + } + + public void RemoveHandler(Type handlerType) + { + if (_handlers.Contains(handlerType)) + { + _handlers.Remove(handlerType); + } + } + + /// + /// Adds user agent to UserAgents collection. + /// + /// Product name. + /// Product version. + public void AddUserAgent(string productName, string productVersion) + { + UserAgents.Add(new ProductInfoHeaderValue(productName, productVersion)); + } + + /// + /// Adds user agent to UserAgents collection with empty version. + /// + /// Product name. + public void AddUserAgent(string productName) + { + AddUserAgent(productName, ""); + } + + public HashSet UserAgents { get; set; } + + private DelegatingHandler[] GetCustomHandlers() + { + List newHandlers = new List(); + var enumerator = _handlers.GetEnumerator(); + while (enumerator.MoveNext()) + { + var handler = enumerator.Value; + ICloneable cloneableHandler = handler as ICloneable; + if (cloneableHandler != null) + { + var newHandler = cloneableHandler.Clone(); + DelegatingHandler convertedHandler = newHandler as DelegatingHandler; + if (convertedHandler != null) + { + newHandlers.Add(convertedHandler); + } + } + } + + return newHandlers.ToArray(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Interfaces/IAuthenticationFactory.cs b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IAuthenticationFactory.cs new file mode 100644 index 000000000000..3e4be883589e --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IAuthenticationFactory.cs @@ -0,0 +1,70 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest; +using System.Security; + +namespace Microsoft.Azure.Common.Authentication +{ + public interface IAuthenticationFactory + { + /// + /// Returns IAccessToken if authentication succeeds or throws an exception if authentication fails. + /// + /// The azure account object + /// The azure environment object + /// The AD tenant in most cases should be 'common' + /// The AD account password + /// The prompt behavior + /// Token Cache + /// Optional, the AD resource id + /// + IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + TokenCache tokenCache, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId); + + /// + /// Returns IAccessToken if authentication succeeds or throws an exception if authentication fails. + /// + /// The azure account object + /// The azure environment object + /// The AD tenant in most cases should be 'common' + /// The AD account password + /// The prompt behavior + /// Optional, the AD resource id + /// + IAccessToken Authenticate( + AzureAccount account, + AzureEnvironment environment, + string tenant, + SecureString password, + ShowDialog promptBehavior, + AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId); + + SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context); + SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context, AzureEnvironment.Endpoint targetEndpoint); + + ServiceClientCredentials GetServiceClientCredentials(AzureContext context); + + ServiceClientCredentials GetServiceClientCredentials(AzureContext context, + AzureEnvironment.Endpoint targetEndpoint); + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Interfaces/IClientFactory.cs b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IClientFactory.cs new file mode 100644 index 000000000000..ba526a34998d --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IClientFactory.cs @@ -0,0 +1,66 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Common.Authentication.Models; +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Microsoft.Azure.Common.Authentication +{ + public interface IClientFactory + { + TClient CreateArmClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient; + + TClient CreateCustomArmClient(params object[] parameters) where TClient : Microsoft.Rest.ServiceClient; + + TClient CreateClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + TClient CreateClient(AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + TClient CreateClient(AzureSMProfile profile, AzureSubscription subscription, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + TClient CreateCustomClient(params object[] parameters) where TClient : ServiceClient; + + HttpClient CreateHttpClient(string endpoint, ICredentials credentials); + + HttpClient CreateHttpClient(string endpoint, HttpMessageHandler effectiveHandler); + + void AddAction(IClientAction action); + + void RemoveAction(Type actionType); + + void AddHandler(T handler) where T: DelegatingHandler, ICloneable; + + void RemoveHandler(Type handlerType); + + /// + /// Adds user agent to UserAgents collection with empty version. + /// + /// Product name. + void AddUserAgent(string productName); + + /// + /// Adds user agent to UserAgents collection. + /// + /// Product name. + /// Product version. + void AddUserAgent(string productName, string productVersion); + + HashSet UserAgents { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Interfaces/IDataStore.cs b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IDataStore.cs new file mode 100644 index 000000000000..102541358aa1 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IDataStore.cs @@ -0,0 +1,67 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.IO; +using System.Security.Cryptography.X509Certificates; +using System.Text; + +namespace Microsoft.Azure.Common.Authentication +{ + public interface IDataStore + { + void WriteFile(string path, string contents); + + void WriteFile(string path, string content, Encoding encoding); + + void WriteFile(string path, byte[] contents); + + string ReadFileAsText(string path); + + Stream ReadFileAsStream(string path); + + byte[] ReadFileAsBytes(string path); + + void RenameFile(string oldPath, string newPath); + + void CopyFile(string oldPath, string newPath); + + bool FileExists(string path); + + void DeleteFile(string path); + + void DeleteDirectory(string dir); + + void EmptyDirectory(string dirPath); + + bool DirectoryExists(string path); + + void CreateDirectory(string path); + + string[] GetDirectories(string sourceDirName); + + string[] GetDirectories(string startDirectory, string filePattern, SearchOption options); + + string[] GetFiles(string sourceDirName); + + string[] GetFiles(string startDirectory, string filePattern, SearchOption options); + + FileAttributes GetFileAttributes(string path); + + X509Certificate2 GetCertificate(string thumbprint); + + void AddCertificate(X509Certificate2 cert); + + void RemoveCertificate(string thumbprint); + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Interfaces/IProfileSerializer.cs b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IProfileSerializer.cs new file mode 100644 index 000000000000..635b66df896a --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Interfaces/IProfileSerializer.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Models; +using System.Collections.Generic; + +namespace Microsoft.Azure.Common.Authentication +{ + public interface IProfileSerializer + { + string Serialize(AzureSMProfile profile); + + bool Deserialize(string contents, AzureSMProfile profile); + + IList DeserializeErrors { get; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureAccount.Methods.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureAccount.Methods.cs new file mode 100644 index 000000000000..c02846d5a93c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureAccount.Methods.cs @@ -0,0 +1,145 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Utilities; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public partial class AzureAccount + { + public AzureAccount() + { + Properties = new Dictionary(); + } + + public string GetProperty(Property property) + { + return Properties.GetProperty(property); + } + + public string[] GetPropertyAsArray(Property property) + { + return Properties.GetPropertyAsArray(property); + } + + public void SetProperty(Property property, params string[] values) + { + Properties.SetProperty(property, values); + } + + public void SetOrAppendProperty(Property property, params string[] values) + { + Properties.SetOrAppendProperty(property, values); + } + + public bool IsPropertySet(Property property) + { + return Properties.IsPropertySet(property); + } + + public List GetSubscriptions(AzureSMProfile profile) + { + string subscriptions = string.Empty; + List subscriptionsList = new List(); + if (Properties.ContainsKey(Property.Subscriptions)) + { + subscriptions = Properties[Property.Subscriptions]; + } + + foreach (var subscription in subscriptions.Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries)) + { + try + { + Guid subscriptionId = new Guid(subscription); + Debug.Assert(profile.Subscriptions.ContainsKey(subscriptionId)); + subscriptionsList.Add(profile.Subscriptions[subscriptionId]); + } + catch + { + // Skip + } + } + + return subscriptionsList; + } + + public bool HasSubscription(Guid subscriptionId) + { + bool exists = false; + string subscriptions = GetProperty(Property.Subscriptions); + + if (!string.IsNullOrEmpty(subscriptions)) + { + exists = subscriptions.Contains(subscriptionId.ToString()); + } + + return exists; + } + + public void SetSubscriptions(List subscriptions) + { + if (subscriptions == null || subscriptions.Count == 0) + { + if (Properties.ContainsKey(Property.Subscriptions)) + { + Properties.Remove(Property.Subscriptions); + } + } + else + { + string value = string.Join(",", subscriptions.Select(s => s.Id.ToString())); + Properties[Property.Subscriptions] = value; + } + } + + public void RemoveSubscription(Guid id) + { + if (HasSubscription(id)) + { + var remainingSubscriptions = GetPropertyAsArray(Property.Subscriptions).Where(s => s != id.ToString()).ToArray(); + + if (remainingSubscriptions.Any()) + { + Properties[Property.Subscriptions] = string.Join(",", remainingSubscriptions); + } + else + { + Properties.Remove(Property.Subscriptions); + } + } + } + + public override bool Equals(object obj) + { + var anotherAccount = obj as AzureAccount; + if (anotherAccount == null) + { + return false; + } + else + { + return string.Equals(anotherAccount.Id, Id, StringComparison.InvariantCultureIgnoreCase); + } + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureAccount.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureAccount.cs new file mode 100644 index 000000000000..bdd51aa9c9c0 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureAccount.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + [Serializable] + public partial class AzureAccount + { + public string Id { get; set; } + + public AccountType Type { get; set; } + + public Dictionary Properties { get; set; } + + public enum AccountType + { + Certificate, + User, + ServicePrincipal, + AccessToken + } + + public enum Property + { + /// + /// Comma separated list of subscription ids on this account. + /// + Subscriptions, + + /// + /// Comma separated list of tenants on this account. + /// + Tenants, + + /// + /// Access token. + /// + AccessToken, + + /// + /// Thumbprint for associated certificate + /// + CertificateThumbprint + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureContext.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureContext.cs new file mode 100644 index 000000000000..94fe9cca2cc2 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureContext.cs @@ -0,0 +1,90 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Newtonsoft.Json; +using System; +namespace Microsoft.Azure.Common.Authentication.Models +{ + /// + /// Represents current Azure session context. + /// + [Serializable] + public class AzureContext + { + /// + /// Creates new instance of AzureContext. + /// + /// The azure subscription object + /// The azure account object + /// The azure environment object + public AzureContext(AzureSubscription subscription, AzureAccount account, AzureEnvironment environment) + : this(subscription, account, environment, null) + { + + } + + /// + /// Creates new instance of AzureContext. + /// + /// The azure account object + /// The azure environment object + /// The azure tenant object + public AzureContext(AzureAccount account, AzureEnvironment environment, AzureTenant tenant) + : this(null, account, environment, tenant) + { + + } + + /// + /// Creates new instance of AzureContext. + /// + /// The azure subscription object + /// The azure account object + /// The azure environment object + /// The azure tenant object + [JsonConstructor] + public AzureContext(AzureSubscription subscription, AzureAccount account, AzureEnvironment environment, AzureTenant tenant) + { + Subscription = subscription; + Account = account; + Environment = environment; + Tenant = tenant; + } + + /// + /// Gets the azure account. + /// + public AzureAccount Account { get; private set; } + + /// + /// Gets the azure subscription. + /// + public AzureSubscription Subscription { get; private set; } + + /// + /// Gets the azure environment. + /// + public AzureEnvironment Environment { get; private set; } + + /// + /// Gets the azure tenant. + /// + public AzureTenant Tenant { get; private set; } + + /// + /// Gets or sets the token cache contents. + /// + public byte[] TokenCache { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureEnvironment.Methods.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureEnvironment.Methods.cs new file mode 100644 index 000000000000..063e0ecf3369 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureEnvironment.Methods.cs @@ -0,0 +1,422 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Properties; +using Microsoft.Azure.Common.Authentication.Utilities; +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public partial class AzureEnvironment + { + /// + /// Predefined Microsoft Azure environments + /// + public static Dictionary PublicEnvironments + { + get { return environments; } + } + + private const string storageFormatTemplate = "{{0}}://{{1}}.{0}.{1}/"; + + private string EndpointFormatFor(string service) + { + string suffix = GetEndpointSuffix(AzureEnvironment.Endpoint.StorageEndpointSuffix); + + if (!string.IsNullOrEmpty(suffix)) + { + suffix = string.Format(storageFormatTemplate, service, suffix); + } + + return suffix; + } + + /// + /// The storage service blob endpoint format. + /// + private string StorageBlobEndpointFormat() + { + return EndpointFormatFor("blob"); + } + + /// + /// The storage service queue endpoint format. + /// + private string StorageQueueEndpointFormat() + { + return EndpointFormatFor("queue"); + } + + /// + /// The storage service table endpoint format. + /// + private string StorageTableEndpointFormat() + { + return EndpointFormatFor("table"); + } + + /// + /// The storage service file endpoint format. + /// + private string StorageFileEndpointFormat() + { + return EndpointFormatFor("file"); + } + + private static readonly Dictionary environments = + new Dictionary(StringComparer.InvariantCultureIgnoreCase) + { + { + EnvironmentName.AzureCloud, + new AzureEnvironment + { + Name = EnvironmentName.AzureCloud, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, AzureEnvironmentConstants.AzurePublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ServiceManagement, AzureEnvironmentConstants.AzureServiceEndpoint }, + { AzureEnvironment.Endpoint.ResourceManager, AzureEnvironmentConstants.AzureResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, AzureEnvironmentConstants.AzureManagementPortalUrl }, + { AzureEnvironment.Endpoint.ActiveDirectory, AzureEnvironmentConstants.AzureActiveDirectoryEndpoint }, + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, AzureEnvironmentConstants.AzureServiceEndpoint }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, AzureEnvironmentConstants.AzureStorageEndpointSuffix }, + { AzureEnvironment.Endpoint.Gallery, AzureEnvironmentConstants.GalleryEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.AzureSqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.AzureGraphEndpoint }, + { AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, AzureEnvironmentConstants.AzureTrafficManagerDnsSuffix }, + { AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.AzureKeyVaultDnsSuffix}, + { AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.AzureKeyVaultServiceEndpointResourceId}, + { AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, AzureEnvironmentConstants.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix}, + { AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, AzureEnvironmentConstants.AzureDataLakeStoreFileSystemEndpointSuffix}, + { AzureEnvironment.Endpoint.GraphEndpointResourceId, AzureEnvironmentConstants.AzureGraphEndpoint} + } + } + }, + { + EnvironmentName.AzureChinaCloud, + new AzureEnvironment + { + Name = EnvironmentName.AzureChinaCloud, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, AzureEnvironmentConstants.ChinaPublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ServiceManagement, AzureEnvironmentConstants.ChinaServiceEndpoint }, + { AzureEnvironment.Endpoint.ResourceManager, AzureEnvironmentConstants.ChinaResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, AzureEnvironmentConstants.ChinaManagementPortalUrl }, + { AzureEnvironment.Endpoint.ActiveDirectory, AzureEnvironmentConstants.ChinaActiveDirectoryEndpoint }, + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, AzureEnvironmentConstants.ChinaServiceEndpoint }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, AzureEnvironmentConstants.ChinaStorageEndpointSuffix }, + { AzureEnvironment.Endpoint.Gallery, AzureEnvironmentConstants.ChinaGalleryEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.ChinaSqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.ChinaGraphEndpoint }, + { AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, AzureEnvironmentConstants.ChinaTrafficManagerDnsSuffix }, + { AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.ChinaKeyVaultDnsSuffix }, + { AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.ChinaKeyVaultServiceEndpointResourceId }, + { AzureEnvironment.Endpoint.GraphEndpointResourceId, AzureEnvironmentConstants.ChinaGraphEndpoint} + // TODO: DataLakeAnalytics and ADL do not have a China endpoint yet. Once they do, add them here. + } + } + }, + { + EnvironmentName.AzureUSGovernment, + new AzureEnvironment + { + Name = EnvironmentName.AzureUSGovernment, + Endpoints = new Dictionary + { + { AzureEnvironment.Endpoint.PublishSettingsFileUrl, AzureEnvironmentConstants.USGovernmentPublishSettingsFileUrl }, + { AzureEnvironment.Endpoint.ServiceManagement, AzureEnvironmentConstants.USGovernmentServiceEndpoint }, + { AzureEnvironment.Endpoint.ResourceManager, AzureEnvironmentConstants.USGovernmentResourceManagerEndpoint }, + { AzureEnvironment.Endpoint.ManagementPortalUrl, AzureEnvironmentConstants.USGovernmentManagementPortalUrl }, + { AzureEnvironment.Endpoint.ActiveDirectory, AzureEnvironmentConstants.USGovernmentActiveDirectoryEndpoint }, + { AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, AzureEnvironmentConstants.USGovernmentServiceEndpoint }, + { AzureEnvironment.Endpoint.StorageEndpointSuffix, AzureEnvironmentConstants.USGovernmentStorageEndpointSuffix }, + { AzureEnvironment.Endpoint.Gallery, AzureEnvironmentConstants.USGovernmentGalleryEndpoint }, + { AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.USGovernmentSqlDatabaseDnsSuffix }, + { AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.USGovernmentGraphEndpoint }, + { AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, null }, + { AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.USGovernmentKeyVaultDnsSuffix}, + { AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.USGovernmentKeyVaultServiceEndpointResourceId}, + { AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, null}, + { AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, null}, + {AzureEnvironment.Endpoint.GraphEndpointResourceId, AzureEnvironmentConstants.USGovernmentGraphEndpoint} + } + } + } + }; + + public Uri GetEndpointAsUri(AzureEnvironment.Endpoint endpoint) + { + if (Endpoints.ContainsKey(endpoint)) + { + return new Uri(Endpoints[endpoint]); + } + + return null; + } + + public string GetEndpoint(AzureEnvironment.Endpoint endpoint) + { + if (Endpoints.ContainsKey(endpoint)) + { + return Endpoints[endpoint]; + } + + return null; + } + + public AzureEnvironment.Endpoint GetTokenAudience(AzureEnvironment.Endpoint targetEndpoint) + { + return targetEndpoint == AzureEnvironment.Endpoint.Graph + ? AzureEnvironment.Endpoint.GraphEndpointResourceId + : AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId; + } + + + + public bool IsEndpointSet(AzureEnvironment.Endpoint endpoint) + { + return Endpoints.IsPropertySet(endpoint); + } + + public bool IsEndpointSetToValue(AzureEnvironment.Endpoint endpoint, string url) + { + if (url == null && !Endpoints.IsPropertySet(endpoint)) + { + return true; + } + if (url != null && Endpoints.IsPropertySet(endpoint)) + { + return GetEndpoint(endpoint) + .Trim(new[] { '/' }) + .Equals(url.Trim(new[] { '/' }), StringComparison.InvariantCultureIgnoreCase); + } + return false; + } + + public string GetEndpointSuffix(AzureEnvironment.Endpoint endpointSuffix) + { + if (Endpoints.ContainsKey(endpointSuffix)) + { + return Endpoints[endpointSuffix]; + } + + return null; + } + + /// + /// Gets the endpoint for storage blob. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the blob service + public Uri GetStorageBlobEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageBlobEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the endpoint for storage queue. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the queue service + public Uri GetStorageQueueEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageQueueEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the endpoint for storage table. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the table service + public Uri GetStorageTableEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageTableEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the endpoint for storage file. + /// + /// The account name + /// Use Https when creating the URI. Defaults to true. + /// The fully qualified uri to the file service + public Uri GetStorageFileEndpoint(string accountName, bool useHttps = true) + { + return new Uri(string.Format(StorageFileEndpointFormat(), useHttps ? "https" : "http", accountName)); + } + + /// + /// Gets the management portal URI with a particular realm suffix if supplied + /// + /// Realm for user's account + /// Url to management portal. + public string GetManagementPortalUrlWithRealm(string realm = null) + { + if (realm != null) + { + realm = string.Format(Resources.PublishSettingsFileRealmFormat, realm); + } + else + { + realm = string.Empty; + } + return GetEndpointAsUri(Endpoint.ManagementPortalUrl) + realm; + } + + /// + /// Get the publish settings file download url with a realm suffix if needed. + /// + /// Realm for user's account + /// Url to publish settings file + public string GetPublishSettingsFileUrlWithRealm(string realm = null) + { + if (realm != null) + { + realm = string.Format(Resources.PublishSettingsFileRealmFormat, realm); + } + else + { + realm = string.Empty; + } + return GetEndpointAsUri(Endpoint.PublishSettingsFileUrl) + realm; + } + + public enum Endpoint + { + ActiveDirectoryServiceEndpointResourceId, + + AdTenant, + + Gallery, + + ManagementPortalUrl, + + ServiceManagement, + + PublishSettingsFileUrl, + + ResourceManager, + + SqlDatabaseDnsSuffix, + + StorageEndpointSuffix, + + ActiveDirectory, + + Graph, + + TrafficManagerDnsSuffix, + + AzureKeyVaultDnsSuffix, + + AzureKeyVaultServiceEndpointResourceId, + + AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, + + AzureDataLakeStoreFileSystemEndpointSuffix, + + GraphEndpointResourceId + } + } + + public static class EnvironmentName + { + public const string AzureCloud = "AzureCloud"; + + public const string AzureChinaCloud = "AzureChinaCloud"; + + public const string AzureUSGovernment = "AzureUSGovernment"; + } + + public static class AzureEnvironmentConstants + { + public const string AzureServiceEndpoint = "https://management.core.windows.net/"; + + public const string ChinaServiceEndpoint = "https://management.core.chinacloudapi.cn/"; + + public const string USGovernmentServiceEndpoint = "https://management.core.usgovcloudapi.net/"; + + public const string AzureResourceManagerEndpoint = "https://management.azure.com/"; + + public const string ChinaResourceManagerEndpoint = "https://management.chinacloudapi.cn/"; + + public const string USGovernmentResourceManagerEndpoint = "https://management.usgovcloudapi.net/"; + + public const string GalleryEndpoint = "https://gallery.azure.com/"; + + public const string ChinaGalleryEndpoint = "https://gallery.chinacloudapi.cn/"; + + public const string USGovernmentGalleryEndpoint = "https://gallery.usgovcloudapi.net/"; + + public const string AzurePublishSettingsFileUrl = "http://go.microsoft.com/fwlink/?LinkID=301775"; + + public const string ChinaPublishSettingsFileUrl = "http://go.microsoft.com/fwlink/?LinkID=301776"; + + public const string USGovernmentPublishSettingsFileUrl = "https://manage.windowsazure.us/publishsettings/index"; + + public const string AzureManagementPortalUrl = "http://go.microsoft.com/fwlink/?LinkId=254433"; + + public const string ChinaManagementPortalUrl = "http://go.microsoft.com/fwlink/?LinkId=301902"; + + public const string USGovernmentManagementPortalUrl = "https://manage.windowsazure.us"; + + public const string AzureStorageEndpointSuffix = "core.windows.net"; + + public const string ChinaStorageEndpointSuffix = "core.chinacloudapi.cn"; + + public const string USGovernmentStorageEndpointSuffix = "core.usgovcloudapi.net"; + + public const string AzureSqlDatabaseDnsSuffix = ".database.windows.net"; + + public const string ChinaSqlDatabaseDnsSuffix = ".database.chinacloudapi.cn"; + + public const string USGovernmentSqlDatabaseDnsSuffix = ".database.usgovcloudapi.net"; + + public const string AzureActiveDirectoryEndpoint = "https://login.microsoftonline.com/"; + + public const string ChinaActiveDirectoryEndpoint = "https://login.chinacloudapi.cn/"; + + public const string USGovernmentActiveDirectoryEndpoint = "https://login.microsoftonline.com/"; + + public const string AzureGraphEndpoint = "https://graph.windows.net/"; + + public const string ChinaGraphEndpoint = "https://graph.chinacloudapi.cn/"; + + public const string USGovernmentGraphEndpoint = "https://graph.windows.net/"; + + public const string AzureTrafficManagerDnsSuffix = "trafficmanager.net"; + + public const string ChinaTrafficManagerDnsSuffix = "trafficmanager.cn"; + + public const string AzureKeyVaultDnsSuffix = "vault.azure.net"; + + public const string ChinaKeyVaultDnsSuffix = "vault.azure.cn"; + + public const string USGovernmentKeyVaultDnsSuffix = "vault.usgovcloudapi.net"; + + public const string AzureKeyVaultServiceEndpointResourceId = "https://vault.azure.net"; + + public const string ChinaKeyVaultServiceEndpointResourceId = "https://vault.azure.cn"; + + public const string USGovernmentKeyVaultServiceEndpointResourceId = "https://vault.usgovcloudapi.net"; + + public const string AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix = "azuredatalakeanalytics.net"; + + public const string AzureDataLakeStoreFileSystemEndpointSuffix = "azuredatalakestore.net"; + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureEnvironment.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureEnvironment.cs new file mode 100644 index 000000000000..89d80e7569cb --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureEnvironment.cs @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + [Serializable] + public partial class AzureEnvironment + { + public AzureEnvironment() + { + Endpoints = new Dictionary(); + } + + public string Name { get; set; } + + public bool OnPremise { get; set; } + + public Dictionary Endpoints { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureRMProfile.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureRMProfile.cs new file mode 100644 index 000000000000..68085d47d93d --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureRMProfile.cs @@ -0,0 +1,147 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + /// + /// Represents Azure Resource Manager profile structure with default context, environments and token cache. + /// + [Serializable] + public sealed class AzureRMProfile : IAzureProfile + { + /// + /// Gets or sets Azure environments. + /// + public Dictionary Environments { get; set; } + + /// + /// Gets or sets the default azure context object. + /// + public AzureContext Context { get; set; } + + /// + /// Gets the path of the profile file. + /// + [JsonIgnore] + public string ProfilePath { get; private set; } + + private void Load(string path) + { + this.ProfilePath = path; + + if (!AzureSession.DataStore.DirectoryExists(AzureSession.ProfileDirectory)) + { + AzureSession.DataStore.CreateDirectory(AzureSession.ProfileDirectory); + } + + if (AzureSession.DataStore.FileExists(ProfilePath)) + { + string contents = AzureSession.DataStore.ReadFileAsText(ProfilePath); + AzureRMProfile profile = JsonConvert.DeserializeObject(contents); + Debug.Assert(profile != null); + this.Context = profile.Context; + this.Environments = profile.Environments; + } + } + + /// + /// Creates new instance of AzureRMProfile. + /// + public AzureRMProfile() + { + Environments = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + // Adding predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + + /// + /// Initializes a new instance of AzureRMProfile and loads its content from specified path. + /// + /// The location of profile file on disk. + public AzureRMProfile(string path) : this() + { + Load(path); + } + + /// + /// Writes profile to the disk it was opened from disk. + /// + public void Save() + { + if (!string.IsNullOrEmpty(ProfilePath)) + { + Save(ProfilePath); + } + } + + /// + /// Writes profile to a specified path. + /// + /// File path on disk to save profile to + public void Save(string path) + { + if (string.IsNullOrEmpty(path)) + { + return; + } + + // Removing predefined environments + foreach (string env in AzureEnvironment.PublicEnvironments.Keys) + { + Environments.Remove(env); + } + + try + { + string contents = ToString(); + string diskContents = string.Empty; + if (AzureSession.DataStore.FileExists(path)) + { + diskContents = AzureSession.DataStore.ReadFileAsText(path); + } + + if (diskContents != contents) + { + AzureSession.DataStore.WriteFile(path, contents); + } + } + finally + { + // Adding back predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + } + + /// + /// Serializes the current profile and return its contents. + /// + /// The current string. + public override string ToString() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureSMProfile.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureSMProfile.cs new file mode 100644 index 000000000000..e9c1de03904f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureSMProfile.cs @@ -0,0 +1,240 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; +using Microsoft.Azure.Common.Authentication.Properties; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + /// + /// Represents Azure profile structure with multiple environments, subscriptions, and accounts. + /// + [Serializable] + public sealed class AzureSMProfile : IAzureProfile + { + /// + /// Gets Azure Accounts + /// + public Dictionary Accounts { get; set; } + + /// + /// Gets Azure Subscriptions + /// + public Dictionary Subscriptions { get; set; } + + /// + /// Gets or sets current Azure Subscription + /// + public AzureSubscription DefaultSubscription + { + get + { + return Subscriptions.Values.FirstOrDefault( + s => s.Properties.ContainsKey(AzureSubscription.Property.Default)); + } + + set + { + if (value == null) + { + foreach (var subscription in Subscriptions.Values) + { + subscription.SetProperty(AzureSubscription.Property.Default, null); + } + } + else if (Subscriptions.ContainsKey(value.Id)) + { + foreach (var subscription in Subscriptions.Values) + { + subscription.SetProperty(AzureSubscription.Property.Default, null); + } + + Subscriptions[value.Id].Properties[AzureSubscription.Property.Default] = "True"; + value.Properties[AzureSubscription.Property.Default] = "True"; + } + } + } + + /// + /// Gets Azure Environments + /// + public Dictionary Environments { get; set; } + + /// + /// Gets the default azure context object. + /// + [JsonIgnore] + public AzureContext Context + { + get + { + var context = new AzureContext(null, null, null, null); + + if (DefaultSubscription != null) + { + AzureAccount account = null; + AzureEnvironment environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud]; + if (DefaultSubscription.Account != null && + Accounts.ContainsKey(DefaultSubscription.Account)) + { + account = Accounts[DefaultSubscription.Account]; + } + else + { + TracingAdapter.Information(Resources.NoAccountInContext, DefaultSubscription.Account, DefaultSubscription.Id); + } + + if (DefaultSubscription.Environment != null && + Environments.ContainsKey(DefaultSubscription.Environment)) + { + environment = Environments[DefaultSubscription.Environment]; + } + else + { + TracingAdapter.Information(Resources.NoEnvironmentInContext, DefaultSubscription.Environment, DefaultSubscription.Id); + } + + context = new AzureContext(DefaultSubscription, account, environment); + } + + return context; + } + } + + /// + /// Gets errors from loading the profile. + /// + public List ProfileLoadErrors { get; private set; } + + /// + /// Location of the profile file. + /// + public string ProfilePath { get; private set; } + + /// + /// Initializes a new instance of AzureSMProfile + /// + public AzureSMProfile() + { + Environments = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + Subscriptions = new Dictionary(); + Accounts = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + + // Adding predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + + /// + /// Initializes a new instance of AzureSMProfile and loads its content from specified path. + /// Any errors generated in the process are stored in ProfileLoadErrors collection. + /// + /// Location of profile file on disk. + public AzureSMProfile(string path) : this() + { + ProfilePath = path; + ProfileLoadErrors = new List(); + + if (!AzureSession.DataStore.DirectoryExists(AzureSession.ProfileDirectory)) + { + AzureSession.DataStore.CreateDirectory(AzureSession.ProfileDirectory); + } + + if (AzureSession.DataStore.FileExists(ProfilePath)) + { + string contents = AzureSession.DataStore.ReadFileAsText(ProfilePath); + + IProfileSerializer serializer; + + if (CloudException.IsXml(contents)) + { + serializer = new XmlProfileSerializer(); + if (!serializer.Deserialize(contents, this)) + { + ProfileLoadErrors.AddRange(serializer.DeserializeErrors); + } + } + else if (CloudException.IsJson(contents)) + { + serializer = new JsonProfileSerializer(); + if (!serializer.Deserialize(contents, this)) + { + ProfileLoadErrors.AddRange(serializer.DeserializeErrors); + } + } + } + } + + /// + /// Writes profile to a ProfilePath + /// + public void Save() + { + Save(ProfilePath); + } + + /// + /// Writes profile to a specified path. + /// + /// File path on disk to save profile to + public void Save(string path) + { + if (string.IsNullOrEmpty(path)) + { + return; + } + + // Removing predefined environments + foreach (string env in AzureEnvironment.PublicEnvironments.Keys) + { + Environments.Remove(env); + } + + try + { + string contents = ToString(); + string diskContents = string.Empty; + if (AzureSession.DataStore.FileExists(path)) + { + diskContents = AzureSession.DataStore.ReadFileAsText(path); + } + + if (diskContents != contents) + { + AzureSession.DataStore.WriteFile(path, contents); + } + } + finally + { + // Adding back predefined environments + foreach (AzureEnvironment env in AzureEnvironment.PublicEnvironments.Values) + { + Environments[env.Name] = env; + } + } + } + + public override string ToString() + { + JsonProfileSerializer jsonSerializer = new JsonProfileSerializer(); + return jsonSerializer.Serialize(this); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureSubscription.Methods.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureSubscription.Methods.cs new file mode 100644 index 000000000000..7c7a92b38cae --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureSubscription.Methods.cs @@ -0,0 +1,70 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Utilities; +using System.Collections.Generic; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public partial class AzureSubscription + { + public AzureSubscription() + { + Properties = new Dictionary(); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + + public string GetProperty(Property property) + { + return Properties.GetProperty(property); + } + + public string[] GetPropertyAsArray(Property property) + { + return Properties.GetPropertyAsArray(property); + } + + public void SetProperty(Property property, params string[] values) + { + Properties.SetProperty(property, values); + } + + public void SetOrAppendProperty(Property property, params string[] values) + { + Properties.SetOrAppendProperty(property, values); + } + + public bool IsPropertySet(Property property) + { + return Properties.IsPropertySet(property); + } + + public override bool Equals(object obj) + { + var anotherSubscription = obj as AzureSubscription; + if (anotherSubscription == null) + { + return false; + } + else + { + return anotherSubscription.Id == Id; + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureSubscription.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureSubscription.cs new file mode 100644 index 000000000000..8cd7aef66de7 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureSubscription.cs @@ -0,0 +1,55 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + [Serializable] + public partial class AzureSubscription + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public string Environment { get; set; } + + public string Account { get; set; } + + public string State { get; set; } + + public Dictionary Properties { get; set; } + + public enum Property + { + /// + /// Comma separated registered resource providers, i.e.: websites,compute,hdinsight + /// + RegisteredResourceProviders, + + /// + /// Associated tenants + /// + Tenants, + + /// + /// If this property existed on the subscription indicates that it's default one. + /// + Default, + + StorageAccount + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/AzureTenant.cs b/src/Common/Commands.Common.Authentication/stuff/Models/AzureTenant.cs new file mode 100644 index 000000000000..7a2a4f9403c9 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/AzureTenant.cs @@ -0,0 +1,35 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + /// + /// Represents an AD tenant. + /// + [Serializable] + public class AzureTenant + { + /// + /// Gets or sets the tenant id. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the tenant domain. + /// + public string Domain { get; set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/DiskDataStore.cs b/src/Common/Commands.Common.Authentication/stuff/Models/DiskDataStore.cs new file mode 100644 index 000000000000..1218905d7dba --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/DiskDataStore.cs @@ -0,0 +1,180 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Properties; +using System; +using System.IO; +using System.Security.Cryptography.X509Certificates; +using System.Text; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public class DiskDataStore : IDataStore + { + public void WriteFile(string path, string contents) + { + File.WriteAllText(path, contents); + } + + public void WriteFile(string path, string contents, Encoding encoding) + { + File.WriteAllText(path, contents, encoding); + } + + public void WriteFile(string path, byte[] contents) + { + File.WriteAllBytes(path, contents); + } + + public string ReadFileAsText(string path) + { + return File.ReadAllText(path); + } + + public byte[] ReadFileAsBytes(string path) + { + return File.ReadAllBytes(path); + } + + public Stream ReadFileAsStream(string path) + { + return File.Open(path, FileMode.Open, FileAccess.Read); + } + + public void RenameFile(string oldPath, string newPath) + { + File.Move(oldPath, newPath); + } + + public void CopyFile(string oldPath, string newPath) + { + File.Copy(oldPath, newPath, true); + } + + public bool FileExists(string path) + { + return File.Exists(path); + } + + public void DeleteFile(string path) + { + File.Delete(path); + } + + public void DeleteDirectory(string dir) + { + Directory.Delete(dir, true); + } + + public void EmptyDirectory(string dirPath) + { + foreach (var filePath in Directory.GetFiles(dirPath)) + { + File.Delete(filePath); + } + } + + public string[] GetFiles(string sourceDirName) + { + return Directory.GetFiles(sourceDirName); + } + + public string[] GetFiles(string startDirectory, string filePattern, SearchOption options) + { + return Directory.GetFiles(startDirectory, filePattern, options); + } + + public FileAttributes GetFileAttributes(string path) + { + return File.GetAttributes(path); + } + + public X509Certificate2 GetCertificate(string thumbprint) + { + if (thumbprint == null) + { + return null; + } + else + { + Validate.ValidateStringIsNullOrEmpty(thumbprint, "certificate thumbprint"); + X509Certificate2Collection certificates; + if (TryFindCertificatesInStore(thumbprint, StoreLocation.CurrentUser, out certificates) || + TryFindCertificatesInStore(thumbprint, StoreLocation.LocalMachine, out certificates)) + { + return certificates[0]; + } + else + { + throw new ArgumentException(string.Format(Resources.CertificateNotFoundInStore, thumbprint)); + } + } + } + + private static bool TryFindCertificatesInStore(string thumbprint, + StoreLocation location, out X509Certificate2Collection certificates) + { + X509Store store = new X509Store(StoreName.My, location); + store.Open(OpenFlags.ReadOnly); + certificates = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false); + store.Close(); + + return certificates.Count > 0; + } + + public void AddCertificate(X509Certificate2 certificate) + { + Validate.ValidateNullArgument(certificate, Resources.InvalidCertificate); + X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); + store.Open(OpenFlags.ReadWrite); + store.Add(certificate); + store.Close(); + } + + public void RemoveCertificate(string thumbprint) + { + if (thumbprint != null) + { + var certificate = GetCertificate(thumbprint); + if (certificate != null) + { + X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); + store.Open(OpenFlags.ReadWrite); + store.Remove(certificate); + store.Close(); + } + } + } + + public bool DirectoryExists(string path) + { + return Directory.Exists(path); + } + + public void CreateDirectory(string path) + { + Directory.CreateDirectory(path); + } + + public string[] GetDirectories(string sourceDirName) + { + return Directory.GetDirectories(sourceDirName); + } + + public string[] GetDirectories(string startDirectory, string filePattern, SearchOption options) + { + return Directory.GetDirectories(startDirectory, filePattern, options); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/IAzureProfile.cs b/src/Common/Commands.Common.Authentication/stuff/Models/IAzureProfile.cs new file mode 100644 index 000000000000..5c6053cf5b35 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/IAzureProfile.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Common.Authentication.Models +{ + /// + /// Interface for Azure supported profiles. + /// + public interface IAzureProfile + { + /// + /// Gets the default azure context object. + /// + AzureContext Context { get; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/IClientAction.cs b/src/Common/Commands.Common.Authentication/stuff/Models/IClientAction.cs new file mode 100644 index 000000000000..5bae27e4aa6f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/IClientAction.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Hyak.Common; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public interface IClientAction + { + IClientFactory ClientFactory { get; set; } + + void Apply(TClient client, AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient; + + void ApplyArm(TClient client, AzureRMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient; + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/JsonProfileSerializer.cs b/src/Common/Commands.Common.Authentication/stuff/Models/JsonProfileSerializer.cs new file mode 100644 index 000000000000..f5aab4c8250a --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/JsonProfileSerializer.cs @@ -0,0 +1,91 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public class JsonProfileSerializer : IProfileSerializer + { + public string Serialize(AzureSMProfile profile) + { + return JsonConvert.SerializeObject(new + { + Environments = profile.Environments.Values.ToList(), + Subscriptions = profile.Subscriptions.Values.ToList(), + Accounts = profile.Accounts.Values.ToList() + }, Formatting.Indented); + } + + public bool Deserialize(string contents, AzureSMProfile profile) + { + DeserializeErrors = new List(); + + try + { + var jsonProfile = JObject.Parse(contents); + + foreach (var env in jsonProfile["Environments"]) + { + try + { + profile.Environments[(string) env["Name"]] = + JsonConvert.DeserializeObject(env.ToString()); + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + } + + foreach (var subscription in jsonProfile["Subscriptions"]) + { + try + { + profile.Subscriptions[new Guid((string) subscription["Id"])] = + JsonConvert.DeserializeObject(subscription.ToString()); + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + } + + foreach (var account in jsonProfile["Accounts"]) + { + try + { + profile.Accounts[(string) account["Id"]] = + JsonConvert.DeserializeObject(account.ToString()); + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + } + } + catch (Exception ex) + { + DeserializeErrors.Add(ex.Message); + } + return DeserializeErrors.Count == 0; + } + + public IList DeserializeErrors { get; private set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/MemoryDataStore.cs b/src/Common/Commands.Common.Authentication/stuff/Models/MemoryDataStore.cs new file mode 100644 index 000000000000..43dd736fba9c --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/MemoryDataStore.cs @@ -0,0 +1,317 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Text.RegularExpressions; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public class MemoryDataStore : IDataStore + { + private Dictionary virtualStore = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + private Dictionary certStore = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + private const string FolderKey = "Folder"; + + public Dictionary VirtualStore + { + get { return virtualStore; } + set { virtualStore = value; } + } + + public void WriteFile(string path, string contents) + { + VirtualStore[path] = contents; + } + + public void WriteFile(string path, string contents, Encoding encoding) + { + WriteFile(path, contents); + } + + public void WriteFile(string path, byte[] contents) + { + VirtualStore[path] = Encoding.Default.GetString(contents); + } + + public string ReadFileAsText(string path) + { + if (VirtualStore.ContainsKey(path)) + { + return VirtualStore[path]; + } + else + { + throw new IOException("File not found: " + path); + } + } + + public Stream ReadFileAsStream(string path) + { + if (VirtualStore.ContainsKey(path)) + { + MemoryStream stream = new MemoryStream(); + StreamWriter writer = new StreamWriter(stream); + writer.Write(VirtualStore[path]); + writer.Flush(); + stream.Position = 0; + return stream; + } + else + { + throw new IOException("File not found: " + path); + } + } + + public byte[] ReadFileAsBytes(string path) + { + if (VirtualStore.ContainsKey(path)) + { + return Encoding.Default.GetBytes(VirtualStore[path]); + } + else + { + throw new IOException("File not found: " + path); + } + } + + public void RenameFile(string oldPath, string newPath) + { + if (VirtualStore.ContainsKey(oldPath)) + { + VirtualStore[newPath] = VirtualStore[oldPath]; + VirtualStore.Remove(oldPath); + } + else + { + throw new IOException("File not found: " + oldPath); + } + } + + public void CopyFile(string oldPath, string newPath) + { + if (VirtualStore.ContainsKey(oldPath)) + { + VirtualStore[newPath] = VirtualStore[oldPath]; + } + else + { + throw new IOException("File not found: " + oldPath); + } + } + + public bool FileExists(string path) + { + return VirtualStore.ContainsKey(path); + } + + public void DeleteFile(string path) + { + if (VirtualStore.ContainsKey(path)) + { + VirtualStore.Remove(path); + } + else + { + throw new IOException("File not found: " + path); + } + } + + public void DeleteDirectory(string dir) + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(dir)) + { + VirtualStore.Remove(key); + } + } + } + + public void EmptyDirectory(string dirPath) + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(dirPath)) + { + VirtualStore.Remove(key); + } + } + } + + public bool DirectoryExists(string path) + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(path)) + { + return true; + } + } + return false; + } + + public void CreateDirectory(string path) + { + VirtualStore[path] = FolderKey; + } + + public string[] GetDirectories(string sourceDirName) + { + HashSet dirs = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(sourceDirName)) + { + var directoryName = Path.GetDirectoryName(key); + if (!dirs.Contains(directoryName)) + { + dirs.Add(directoryName); + } + } + } + return dirs.ToArray(); + } + + public string[] GetDirectories(string startDirectory, string filePattern, SearchOption options) + { + HashSet dirs = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(startDirectory) && Regex.IsMatch(key, WildcardToRegex(filePattern), RegexOptions.IgnoreCase)) + { + var directoryName = Path.GetDirectoryName(key); + if (!dirs.Contains(directoryName)) + { + dirs.Add(directoryName); + } + } + } + return dirs.ToArray(); + } + + public string[] GetFiles(string sourceDirName) + { + HashSet files = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(sourceDirName) && VirtualStore[key] != FolderKey) + { + if (!files.Contains(key)) + { + files.Add(key); + } + } + } + return files.ToArray(); + } + + public string[] GetFiles(string startDirectory, string filePattern, SearchOption options) + { + HashSet files = new HashSet(); + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(startDirectory) && VirtualStore[key] != FolderKey && Regex.IsMatch(key, WildcardToRegex(filePattern), RegexOptions.IgnoreCase)) + { + if (!files.Contains(key)) + { + files.Add(key); + } + } + } + return files.ToArray(); + } + + public FileAttributes GetFileAttributes(string path) + { + if (VirtualStore[path] == FolderKey) + { + return FileAttributes.Directory; + } + if (VirtualStore.ContainsKey(path)) + { + return FileAttributes.Normal; + } + else + { + foreach (var key in VirtualStore.Keys.ToArray()) + { + if (key.StartsWith(path)) + { + return FileAttributes.Directory; + } + } + throw new IOException("File not found: " + path); + } + } + + public X509Certificate2 GetCertificate(string thumbprint) + { + if (thumbprint != null && certStore.ContainsKey(thumbprint)) + { + return certStore[thumbprint]; + } + else + { + return new X509Certificate2(); + } + } + + public void AddCertificate(X509Certificate2 cert) + { + if (cert != null && cert.Thumbprint != null) + { + certStore[cert.Thumbprint] = cert; + } + } + + public void RemoveCertificate(string thumbprint) + { + if (thumbprint != null && certStore.ContainsKey(thumbprint)) + { + certStore.Remove(thumbprint); + } + } + + /// + /// Converts unix asterisk based file pattern to regex + /// + /// Asterisk based pattern + /// Regeular expression of null is empty + private static string WildcardToRegex(string wildcard) + { + if (wildcard == null || wildcard == "") return wildcard; + + StringBuilder sb = new StringBuilder(); + + char[] chars = wildcard.ToCharArray(); + for (int i = 0; i < chars.Length; ++i) + { + if (chars[i] == '*') + sb.Append(".*"); + else if (chars[i] == '?') + sb.Append("."); + else if ("+()^$.{}|\\".IndexOf(chars[i]) != -1) + sb.Append('\\').Append(chars[i]); // prefix all metacharacters with backslash + else + sb.Append(chars[i]); + } + return sb.ToString().ToLowerInvariant(); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Models/XmlProfileSerializer.cs b/src/Common/Commands.Common.Authentication/stuff/Models/XmlProfileSerializer.cs new file mode 100644 index 000000000000..543169ad53c2 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Models/XmlProfileSerializer.cs @@ -0,0 +1,95 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace Microsoft.Azure.Common.Authentication.Models +{ + public class XmlProfileSerializer : IProfileSerializer + { + public string Serialize(AzureSMProfile obj) + { + // We do not use the serialize for xml serializer anymore and rely solely on the JSON serializer. + throw new NotImplementedException(); + } + + public bool Deserialize(string contents, AzureSMProfile profile) + { + ProfileData data; + Debug.Assert(profile != null); + + DeserializeErrors = new List(); + + DataContractSerializer serializer = new DataContractSerializer(typeof(ProfileData)); + using (MemoryStream s = new MemoryStream(Encoding.UTF8.GetBytes(contents ?? ""))) + { + data = (ProfileData)serializer.ReadObject(s); + } + + if (data != null) + { + foreach (AzureEnvironmentData oldEnv in data.Environments) + { + profile.Environments[oldEnv.Name] = oldEnv.ToAzureEnvironment(); + } + + List envs = profile.Environments.Values.ToList(); + foreach (AzureSubscriptionData oldSubscription in data.Subscriptions) + { + try + { + var newSubscription = oldSubscription.ToAzureSubscription(envs); + if (newSubscription.Account == null) + { + continue; + } + + var newAccounts = oldSubscription.ToAzureAccounts(); + foreach (var account in newAccounts) + { + if (profile.Accounts.ContainsKey(account.Id)) + { + profile.Accounts[account.Id].SetOrAppendProperty(AzureAccount.Property.Tenants, + account.GetPropertyAsArray(AzureAccount.Property.Tenants)); + profile.Accounts[account.Id].SetOrAppendProperty(AzureAccount.Property.Subscriptions, + account.GetPropertyAsArray(AzureAccount.Property.Subscriptions)); + } + else + { + profile.Accounts[account.Id] = account; + } + } + + profile.Subscriptions[newSubscription.Id] = newSubscription; + } + catch (Exception ex) + { + // Skip subscription if failed to load + DeserializeErrors.Add(ex.Message); + } + } + } + + return DeserializeErrors.Count == 0; + } + + public IList DeserializeErrors { get; private set; } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Properties/AssemblyInfo.cs b/src/Common/Commands.Common.Authentication/stuff/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..5ad086ec6bf0 --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Commands.Common.Authentication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Commands.Common.Authentication")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("51ee5716-6b2e-4488-8c7e-97e49e9101b8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Common/Commands.Common.Authentication/stuff/Utilities/DictionaryExtensions.cs b/src/Common/Commands.Common.Authentication/stuff/Utilities/DictionaryExtensions.cs new file mode 100644 index 000000000000..a8513c13aeae --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Utilities/DictionaryExtensions.cs @@ -0,0 +1,78 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.Common.Authentication.Utilities +{ + public static class DictionaryExtensions + { + public static TValue GetProperty(this Dictionary dictionary, TKey property) + { + if (dictionary.ContainsKey(property)) + { + return dictionary[property]; + } + + return default(TValue); + } + + public static string[] GetPropertyAsArray(this Dictionary dictionary, TKey property) + { + if (dictionary.ContainsKey(property)) + { + return dictionary[property].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + } + + return new string[0]; + } + + public static void SetProperty(this Dictionary dictionary, TKey property, params string[] values) + { + if (values == null || values.Length == 0) + { + if (dictionary.ContainsKey(property)) + { + dictionary.Remove(property); + } + } + else + { + dictionary[property] = string.Join(",", values); + } + } + + public static void SetOrAppendProperty(this Dictionary dictionary, TKey property, params string[] values) + { + string oldValueString = ""; + if (dictionary.ContainsKey(property)) + { + oldValueString = dictionary[property]; + } + var oldValues = oldValueString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var newValues = oldValues.Union(values, StringComparer.CurrentCultureIgnoreCase).Where(s => !string.IsNullOrEmpty(s)).ToArray(); + if (newValues.Any()) + { + dictionary[property] = string.Join(",", newValues); + } + } + + public static bool IsPropertySet(this Dictionary dictionary, TKey property) + { + return dictionary.ContainsKey(property) && !string.IsNullOrEmpty(dictionary[property]); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Utilities/FileUtilities.cs b/src/Common/Commands.Common.Authentication/stuff/Utilities/FileUtilities.cs new file mode 100644 index 000000000000..a69f96c4912f --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Utilities/FileUtilities.cs @@ -0,0 +1,321 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Common.Authentication.Properties; +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.Common.Authentication +{ + public static class FileUtilities + { + static FileUtilities() + { + DataStore = new DiskDataStore(); + } + + public static IDataStore DataStore { get; set; } + + public static string GetAssemblyDirectory() + { + var assemblyPath = Uri.UnescapeDataString(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath); + return Path.GetDirectoryName(assemblyPath); + } + + public static string GetContentFilePath(string fileName) + { + return GetContentFilePath(GetAssemblyDirectory(), fileName); + } + + public static string GetContentFilePath(string startDirectory, string fileName) + { + string path = Path.Combine(startDirectory, fileName); + + // Try search in the subdirectories in case that the file path does not exist in root path + if (!DataStore.FileExists(path) && !DataStore.DirectoryExists(path)) + { + try + { + path = DataStore.GetDirectories(startDirectory, fileName, SearchOption.AllDirectories).FirstOrDefault(); + + if (string.IsNullOrEmpty(path)) + { + path = DataStore.GetFiles(startDirectory, fileName, SearchOption.AllDirectories).First(); + } + } + catch + { + throw new FileNotFoundException(Path.Combine(startDirectory, fileName)); + } + } + + return path; + } + + public static string GetWithProgramFilesPath(string directoryName, bool throwIfNotFound) + { + string programFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + if (DataStore.DirectoryExists(Path.Combine(programFilesPath, directoryName))) + { + return Path.Combine(programFilesPath, directoryName); + } + else + { + if (programFilesPath.IndexOf(Resources.x86InProgramFiles, StringComparison.InvariantCultureIgnoreCase) == -1) + { + programFilesPath += Resources.x86InProgramFiles; + if (throwIfNotFound) + { + Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); + } + return Path.Combine(programFilesPath, directoryName); + } + else + { + programFilesPath = programFilesPath.Replace(Resources.x86InProgramFiles, String.Empty); + if (throwIfNotFound) + { + Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); + } + return Path.Combine(programFilesPath, directoryName); + } + } + } + + /// + /// Copies a directory. + /// + /// The source directory name + /// The destination directory name + /// Should the copy be recursive + public static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) + { + var dirs = DataStore.GetDirectories(sourceDirName); + + if (!DataStore.DirectoryExists(sourceDirName)) + { + throw new DirectoryNotFoundException(String.Format(Resources.PathDoesNotExist, sourceDirName)); + } + + DataStore.CreateDirectory(destDirName); + + var files = DataStore.GetFiles(sourceDirName); + foreach (var file in files) + { + string tempPath = Path.Combine(destDirName, Path.GetFileName(file)); + DataStore.CopyFile(file, tempPath); + } + + if (copySubDirs) + { + foreach (var subdir in dirs) + { + string temppath = Path.Combine(destDirName, Path.GetDirectoryName(subdir)); + DirectoryCopy(subdir, temppath, copySubDirs); + } + } + } + + /// + /// Ensures that a directory exists beofre attempting to write a file + /// + /// The path to the file that will be created + public static void EnsureDirectoryExists(string pathName) + { + Validate.ValidateStringIsNullOrEmpty(pathName, "Settings directory"); + string directoryPath = Path.GetDirectoryName(pathName); + if (!DataStore.DirectoryExists(directoryPath)) + { + DataStore.CreateDirectory(directoryPath); + } + } + + /// + /// Create a unique temp directory. + /// + /// Path to the temp directory. + public static string CreateTempDirectory() + { + string tempPath; + do + { + tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + } + while (DataStore.DirectoryExists(tempPath) || DataStore.FileExists(tempPath)); + + DataStore.CreateDirectory(tempPath); + return tempPath; + } + + /// + /// Copy a directory from one path to another. + /// + /// Source directory. + /// Destination directory. + public static void CopyDirectory(string sourceDirectory, string destinationDirectory) + { + Debug.Assert(!String.IsNullOrEmpty(sourceDirectory), "sourceDictory cannot be null or empty!"); + Debug.Assert(Directory.Exists(sourceDirectory), "sourceDirectory must exist!"); + Debug.Assert(!String.IsNullOrEmpty(destinationDirectory), "destinationDirectory cannot be null or empty!"); + Debug.Assert(!Directory.Exists(destinationDirectory), "destinationDirectory must not exist!"); + + foreach (string file in DataStore.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories)) + { + string relativePath = file.Substring( + sourceDirectory.Length + 1, + file.Length - sourceDirectory.Length - 1); + string destinationPath = Path.Combine(destinationDirectory, relativePath); + + string destinationDir = Path.GetDirectoryName(destinationPath); + if (!DataStore.DirectoryExists(destinationDir)) + { + DataStore.CreateDirectory(destinationDir); + } + + DataStore.CopyFile(file, destinationPath); + } + } + + public static Encoding GetFileEncoding(string path) + { + Encoding encoding; + + + if (DataStore.FileExists(path)) + { + using (StreamReader r = new StreamReader(DataStore.ReadFileAsStream(path))) + { + encoding = r.CurrentEncoding; + } + } + else + { + encoding = Encoding.Default; + } + + return encoding; + } + + public static string CombinePath(params string[] paths) + { + return Path.Combine(paths); + } + + /// + /// Returns true if path is a valid directory. + /// + /// + /// + public static bool IsValidDirectoryPath(string path) + { + if (String.IsNullOrEmpty(path)) + { + return false; + } + + try + { + FileAttributes attributes = DataStore.GetFileAttributes(path); + + if ((attributes & FileAttributes.Directory) == FileAttributes.Directory) + { + return true; + } + else + { + return false; + } + } + catch + { + return false; + } + } + + public static void RecreateDirectory(string dir) + { + if (DataStore.DirectoryExists(dir)) + { + DataStore.DeleteDirectory(dir); + } + + DataStore.CreateDirectory(dir); + } + + /// + /// Gets the root installation path for the given Azure module. + /// + /// The module name + /// The module full path + public static string GetPSModulePathForModule(AzureModule module) + { + return GetContentFilePath(GetInstallPath(), GetModuleFolderName(module)); + } + + /// + /// Gets the root directory for all modules installation. + /// + /// The install path + public static string GetInstallPath() + { + string currentPath = GetAssemblyDirectory(); + while (!currentPath.EndsWith(GetModuleFolderName(AzureModule.AzureProfile)) && + !currentPath.EndsWith(GetModuleFolderName(AzureModule.AzureResourceManager)) && + !currentPath.EndsWith(GetModuleFolderName(AzureModule.AzureServiceManagement))) + { + currentPath = Directory.GetParent(currentPath).FullName; + } + + // The assemption is that the install directory looks like that: + // ServiceManagement + // AzureServiceManagement + // + // ResourceManager + // AzureResourceManager + // + // Profile + // AzureSMProfile + // + return Directory.GetParent(currentPath).FullName; + } + + public static string GetModuleName(AzureModule module) + { + switch (module) + { + case AzureModule.AzureServiceManagement: + return "Azure"; + + case AzureModule.AzureResourceManager: + return "AzureResourceManager"; + + case AzureModule.AzureProfile: + return "AzureProfile"; + + default: + throw new ArgumentOutOfRangeException(module.ToString()); + } + } + + public static string GetModuleFolderName(AzureModule module) + { + return module.ToString().Replace("Azure", ""); + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Utilities/JsonUtilities.cs b/src/Common/Commands.Common.Authentication/stuff/Utilities/JsonUtilities.cs new file mode 100644 index 000000000000..6c441fc74e7d --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Utilities/JsonUtilities.cs @@ -0,0 +1,204 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Properties; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.Azure.Common.Authentication +{ + public static class JsonUtilities + { + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")] + public static string TryFormatJson(string str) + { + try + { + object parsedJson = JsonConvert.DeserializeObject(str); + return JsonConvert.SerializeObject(parsedJson, Formatting.Indented); + } + catch + { + // can't parse JSON, return the original string + return str; + } + } + + public static Dictionary DeserializeJson(string jsonString, bool throwExceptionOnFailure = false) + { + Dictionary result = new Dictionary(); + if (jsonString == null) + { + return null; + } + if (String.IsNullOrWhiteSpace(jsonString)) + { + return result; + } + + try + { + JToken responseDoc = JToken.Parse(jsonString); + + if (responseDoc != null && responseDoc.Type == JTokenType.Object) + { + result = DeserializeJObject(responseDoc as JObject); + } + } + catch + { + if (throwExceptionOnFailure) + { + throw; + } + result = null; + } + return result; + } + + private static Dictionary DeserializeJObject(JObject jsonObject) + { + Dictionary result = new Dictionary(); + if (jsonObject == null || jsonObject.Type == JTokenType.Null) + { + return result; + } + foreach (var property in jsonObject) + { + if (property.Value.Type == JTokenType.Object) + { + result[property.Key] = DeserializeJObject(property.Value as JObject); + } + else if (property.Value.Type == JTokenType.Array) + { + result[property.Key] = DeserializeJArray(property.Value as JArray); + } + else + { + result[property.Key] = DeserializeJValue(property.Value as JValue); + } + } + return result; + } + + private static List DeserializeJArray(JArray jsonArray) + { + List result = new List(); + if (jsonArray == null || jsonArray.Type == JTokenType.Null) + { + return result; + } + foreach (var token in jsonArray) + { + if (token.Type == JTokenType.Object) + { + result.Add(DeserializeJObject(token as JObject)); + } + else if (token.Type == JTokenType.Array) + { + result.Add(DeserializeJArray(token as JArray)); + } + else + { + result.Add(DeserializeJValue(token as JValue)); + } + } + return result; + } + + private static object DeserializeJValue(JValue jsonObject) + { + if (jsonObject == null || jsonObject.Type == JTokenType.Null) + { + return null; + } + + return jsonObject.Value; + } + + public static string Patch(string originalJsonString, string patchJsonString) + { + if (string.IsNullOrWhiteSpace(originalJsonString)) + { + return patchJsonString; + } + else if (string.IsNullOrWhiteSpace(patchJsonString)) + { + return originalJsonString; + } + + JToken originalJson = JToken.Parse(originalJsonString); + JToken patchJson = JToken.Parse(patchJsonString); + + if (originalJson != null && originalJson.Type == JTokenType.Object && + patchJson != null && patchJson.Type == JTokenType.Object) + { + PatchJObject(originalJson as JObject, patchJson as JObject); + } + else if (originalJson != null && originalJson.Type == JTokenType.Array && + patchJson != null && patchJson.Type == JTokenType.Array) + { + originalJson = patchJson; + } + else if (originalJson != null && patchJson != null && originalJson.Type == patchJson.Type) + { + originalJson = patchJson; + } + else + { + throw new ArgumentException(string.Format(Resources.UnableToPatchJson, originalJson, patchJson)); + } + + return originalJson.ToString(Formatting.None); + } + + private static void PatchJObject(JObject originalJsonObject, JObject patchJsonObject) + { + foreach (var patchProperty in patchJsonObject) + { + if (originalJsonObject[patchProperty.Key] != null) + { + JToken originalJson = originalJsonObject[patchProperty.Key]; + JToken patchJson = patchProperty.Value; + + if (originalJson != null && originalJson.Type == JTokenType.Object && + patchJson != null && patchJson.Type == JTokenType.Object) + { + PatchJObject(originalJson as JObject, patchJson as JObject); + } + else if (originalJson != null && originalJson.Type == JTokenType.Array && + patchJson != null && patchJson.Type == JTokenType.Array) + { + originalJsonObject[patchProperty.Key] = patchJson; + } + else if (originalJson != null && patchJson != null && originalJson.Type == patchJson.Type) + { + originalJsonObject[patchProperty.Key] = patchJson; + } + else + { + throw new ArgumentException(string.Format(Resources.UnableToPatchJson, originalJson, patchJson)); + } + } + else + { + originalJsonObject[patchProperty.Key] = patchProperty.Value; + } + } + } + } +} diff --git a/src/Common/Commands.Common.Authentication/stuff/Utilities/XmlUtilities.cs b/src/Common/Commands.Common.Authentication/stuff/Utilities/XmlUtilities.cs new file mode 100644 index 000000000000..3fcca7780aad --- /dev/null +++ b/src/Common/Commands.Common.Authentication/stuff/Utilities/XmlUtilities.cs @@ -0,0 +1,129 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication.Properties; +using System; +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Serialization; + +namespace Microsoft.Azure.Common.Authentication +{ + public static class XmlUtilities + { + public static T DeserializeXmlFile(string fileName, string exceptionMessage = null) + { + // TODO: fix and uncomment. second parameter is wrong + // Validate.ValidateFileFull(fileName, string.Format(Resources.PathDoesNotExistForElement, string.Empty, fileName)); + + T item; + + XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); + using (TextReader reader = new StreamReader(FileUtilities.DataStore.ReadFileAsStream(fileName))) + { + try { item = (T)xmlSerializer.Deserialize(reader); } + catch + { + if (!String.IsNullOrEmpty(exceptionMessage)) + { + throw new InvalidOperationException(exceptionMessage); + } + else + { + throw; + } + } + } + + return item; + } + + public static void SerializeXmlFile(T obj, string fileName) + { + Validate.ValidatePathName(fileName, String.Format(Resources.PathDoesNotExistForElement, String.Empty, fileName)); + Validate.ValidateStringIsNullOrEmpty(fileName, String.Empty); + + XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); + StringBuilder sBuilder = new StringBuilder(); + using (StringWriter writer = new StringWriter(sBuilder)) + { + xmlSerializer.Serialize(writer, obj); + } + FileUtilities.DataStore.WriteFile(fileName, sBuilder.ToString(), Encoding.Unicode); + } + + public static string SerializeXmlString(T obj) + { + XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); + StringBuilder sBuilder = new StringBuilder(); + + using (StringWriter writer = new StringWriter(sBuilder)) + { + xmlSerializer.Serialize(writer, obj); + } + + return sBuilder.ToString(); + } + + /// + /// Formats the given XML into indented way. + /// + /// The input xml string + /// The formatted xml string + public static string TryFormatXml(string content) + { + try + { + XDocument doc = XDocument.Parse(content); + return doc.ToString(); + } + catch (Exception) + { + return content; + } + } + + /// + /// Formats given string into well formatted XML. + /// + /// The unformatted xml string + /// The formatted XML string + public static string Beautify(string unformattedXml) + { + string formattedXml = String.Empty; + if (!String.IsNullOrEmpty(unformattedXml)) + { + XmlDocument doc = new XmlDocument(); + doc.LoadXml(unformattedXml); + StringBuilder stringBuilder = new StringBuilder(); + XmlWriterSettings settings = new XmlWriterSettings() + { + Indent = true, + IndentChars = "\t", + NewLineChars = Environment.NewLine, + NewLineHandling = NewLineHandling.Replace + }; + using (XmlWriter writer = XmlWriter.Create(stringBuilder, settings)) + { + doc.Save(writer); + } + formattedXml = stringBuilder.ToString(); + } + + return formattedXml; + } + } +} diff --git a/src/Common/Commands.Common.Storage/AzureContextExtensions.cs b/src/Common/Commands.Common.Storage/AzureContextExtensions.cs index b6cd0c778715..bb3604da3d0b 100644 --- a/src/Common/Commands.Common.Storage/AzureContextExtensions.cs +++ b/src/Common/Commands.Common.Storage/AzureContextExtensions.cs @@ -12,16 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using ArmStorage = Microsoft.Azure.Management.Storage; using SmStorage = Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Storage; -using Microsoft.Azure.Common.Authentication; -using Microsoft.WindowsAzure.Storage.Auth; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj index b2e13eb797dc..ad442753231e 100644 --- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj +++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj @@ -55,10 +55,6 @@ False ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -95,8 +91,12 @@ False ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -130,10 +130,6 @@ False ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -190,6 +186,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs b/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs index c8e835b23261..b4656f889962 100644 --- a/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs +++ b/src/Common/Commands.Common.Storage/WindowsAzureSubscriptionExtensions.cs @@ -15,11 +15,11 @@ using System; using System.Collections.Generic; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Storage; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { diff --git a/src/Common/Commands.Common.Storage/packages.config b/src/Common/Commands.Common.Storage/packages.config index 68b1d030a408..44fd74ae3f2e 100644 --- a/src/Common/Commands.Common.Storage/packages.config +++ b/src/Common/Commands.Common.Storage/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/Common/Commands.Common/AzureDataCmdlet.cs b/src/Common/Commands.Common/AzureDataCmdlet.cs index 4bba1d50d197..9d615d2049a3 100644 --- a/src/Common/Commands.Common/AzureDataCmdlet.cs +++ b/src/Common/Commands.Common/AzureDataCmdlet.cs @@ -21,8 +21,8 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; using Microsoft.WindowsAzure.Commands.Common.Properties; @@ -31,7 +31,7 @@ namespace Microsoft.WindowsAzure.Commands.Common { public class AzureDataCmdlet : AzurePSCmdlet { - protected override Azure.Common.Authentication.Models.AzureContext DefaultContext + protected override AzureContext DefaultContext { get { @@ -119,7 +119,6 @@ protected override void PromptForDataCollectionProfileIfNotExists() SaveDataCollectionProfile(); } } - protected override void InitializeQosEvent() { } diff --git a/src/Common/Commands.Common/AzurePSCmdlet.cs b/src/Common/Commands.Common/AzurePSCmdlet.cs index 95c397af2936..9ac88c3f06aa 100644 --- a/src/Common/Commands.Common/AzurePSCmdlet.cs +++ b/src/Common/Commands.Common/AzurePSCmdlet.cs @@ -16,19 +16,17 @@ using System.Collections.Concurrent; using System.Diagnostics; using System.Management.Automation; -using System.Net.Http.Headers; using System.Reflection; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.Common; using Newtonsoft.Json; using System.IO; -using System.Management.Automation.Host; using System.Text; using System.Linq; -using System.Threading; -using Microsoft.Rest; +using System.Net.Http.Headers; using Microsoft.ApplicationInsights; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { @@ -37,22 +35,17 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Common /// public abstract class AzurePSCmdlet : PSCmdlet, IDisposable { - protected readonly ConcurrentQueue _debugMessages; + public ConcurrentQueue DebugMessages { get; private set; } private RecordingTracingInterceptor _httpTracingInterceptor; - - private DebugStreamTraceListener _adalListener; - - private ServiceClientTracingInterceptor _serviceClientTracingInterceptor; - protected static AzurePSDataCollectionProfile _dataCollectionProfile = null; protected static string _errorRecordFolderPath = null; protected static string _sessionId = Guid.NewGuid().ToString(); protected const string _fileTimeStampSuffixFormat = "yyyy-MM-dd-THH-mm-ss-fff"; protected string _clientRequestId = Guid.NewGuid().ToString(); protected MetricHelper _metricHelper; - - protected AzurePSQoSEvent QosEvent; + protected AzurePSQoSEvent _qosEvent; + protected DebugStreamTraceListener _adalListener; protected virtual bool IsUsageMetricEnabled { get { return true; } @@ -75,7 +68,8 @@ protected virtual bool IsErrorMetricEnabled protected string ModuleVersion { get { return Assembly.GetCallingAssembly().GetName().Version.ToString(); } } /// - /// Gets the default Azure context. + /// The context for management cmdlet requests - includes account, tenant, subscription, + /// and credential information for targeting and authorizing management calls. /// protected abstract AzureContext DefaultContext { get; } @@ -84,7 +78,7 @@ protected virtual bool IsErrorMetricEnabled /// public AzurePSCmdlet() { - _debugMessages = new ConcurrentQueue(); + DebugMessages = new ConcurrentQueue(); //TODO: Inject from CI server _metricHelper = new MetricHelper(); @@ -123,11 +117,13 @@ protected static void InitializeDataCollectionProfile() // If the environment value is null or empty, or not correctly set, try to read the setting from default file location. if (_dataCollectionProfile == null) { - string fileFullPath = Path.Combine(AzureSession.ProfileDirectory, AzurePSDataCollectionProfile.DefaultFileName); - if (File.Exists(fileFullPath)) + string fileFullPath = Path.Combine(AzurePowerShell.ProfileDirectory, + AzurePSDataCollectionProfile.DefaultFileName); + if(File.Exists(fileFullPath)) { string contents = File.ReadAllText(fileFullPath); - _dataCollectionProfile = JsonConvert.DeserializeObject(contents); + _dataCollectionProfile = + JsonConvert.DeserializeObject(contents); } } @@ -168,9 +164,8 @@ public static bool IsDataCollectionAllowed() } /// - /// Save the current data collection profile Json data into the default file path + /// Save the current data collection profile JSON data into the default file path /// - /// protected abstract void SaveDataCollectionProfile(); protected bool CheckIfInteractive() @@ -179,7 +174,8 @@ protected bool CheckIfInteractive() if (this.Host == null || this.Host.UI == null || this.Host.UI.RawUI == null || - Environment.GetCommandLineArgs().Any(s => s.Equals("-NonInteractive", StringComparison.OrdinalIgnoreCase))) + Environment.GetCommandLineArgs().Any(s => + s.Equals("-NonInteractive", StringComparison.OrdinalIgnoreCase))) { interactive = false; } @@ -205,60 +201,83 @@ protected bool CheckIfInteractive() /// /// Prompt for the current data collection profile /// - /// protected abstract void PromptForDataCollectionProfileIfNotExists(); - /// - /// Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile - /// - protected override void BeginProcessing() + protected virtual void LogCmdletStartInvocationInfo() { - PromptForDataCollectionProfileIfNotExists(); - InitializeQosEvent(); if (string.IsNullOrEmpty(ParameterSetName)) { - WriteDebugWithTimestamp(string.Format("{0} begin processing without ParameterSet.", this.GetType().Name)); + WriteDebugWithTimestamp(string.Format("{0} begin processing " + + "without ParameterSet.", this.GetType().Name)); } else { - WriteDebugWithTimestamp(string.Format("{0} begin processing with ParameterSet '{1}'.", this.GetType().Name, ParameterSetName)); + WriteDebugWithTimestamp(string.Format("{0} begin processing " + + "with ParameterSet '{1}'.", this.GetType().Name, ParameterSetName)); } + } - if (DefaultContext != null && DefaultContext.Account != null && DefaultContext.Account.Id != null) - { - WriteDebugWithTimestamp(string.Format("using account id '{0}'...", DefaultContext.Account.Id)); - } + protected virtual void LogCmdletEndInvocationInfo() + { + string message = string.Format("{0} end processing.", this.GetType().Name); + WriteDebugWithTimestamp(message); + } - _httpTracingInterceptor = _httpTracingInterceptor ?? new RecordingTracingInterceptor(_debugMessages); - _adalListener = _adalListener ?? new DebugStreamTraceListener(_debugMessages); - _serviceClientTracingInterceptor = _serviceClientTracingInterceptor ?? new ServiceClientTracingInterceptor(_debugMessages); + protected virtual void SetupDebuggingTraces() + { + _httpTracingInterceptor = _httpTracingInterceptor ?? new + RecordingTracingInterceptor(DebugMessages); + _adalListener = _adalListener ?? new DebugStreamTraceListener(DebugMessages); RecordingTracingInterceptor.AddToContext(_httpTracingInterceptor); DebugStreamTraceListener.AddAdalTracing(_adalListener); - ServiceClientTracing.AddTracingInterceptor(_serviceClientTracingInterceptor); + } + protected virtual void TearDownDebuggingTraces() + { + RecordingTracingInterceptor.RemoveFromContext(_httpTracingInterceptor); + DebugStreamTraceListener.RemoveAdalTracing(_adalListener); + FlushDebugMessages(); + } + + + protected virtual void SetupHttpClientPipeline() + { ProductInfoHeaderValue userAgentValue = new ProductInfoHeaderValue( ModuleName, string.Format("v{0}", ModuleVersion)); AzureSession.ClientFactory.UserAgents.Add(userAgentValue); - AzureSession.ClientFactory.AddHandler(new CmdletInfoHandler(this.CommandRuntime.ToString(), this.ParameterSetName, this._clientRequestId)); + AzureSession.ClientFactory.AddHandler( + new CmdletInfoHandler(this.CommandRuntime.ToString(), + this.ParameterSetName, this._clientRequestId)); + + } + + protected virtual void TearDownHttpClientPipeline() + { + AzureSession.ClientFactory.UserAgents.RemoveWhere(u => u.Product.Name == ModuleName); + AzureSession.ClientFactory.RemoveHandler(typeof(CmdletInfoHandler)); + } + /// + /// Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile + /// + protected override void BeginProcessing() + { + PromptForDataCollectionProfileIfNotExists(); + InitializeQosEvent(); + LogCmdletStartInvocationInfo(); + SetupDebuggingTraces(); + SetupHttpClientPipeline(); base.BeginProcessing(); } /// - /// End processing. Flush messages in tracing interceptor and save profile and removes user agent. + /// Perform end of pipeline processing. /// protected override void EndProcessing() { LogQosEvent(); - string message = string.Format("{0} end processing.", this.GetType().Name); - WriteDebugWithTimestamp(message); - - RecordingTracingInterceptor.RemoveFromContext(_httpTracingInterceptor); - DebugStreamTraceListener.RemoveAdalTracing(_adalListener); - ServiceClientTracingInterceptor.RemoveTracingInterceptor(_serviceClientTracingInterceptor); - FlushDebugMessages(); - - AzureSession.ClientFactory.UserAgents.RemoveWhere(u => u.Product.Name == ModuleName); - AzureSession.ClientFactory.RemoveHandler(typeof(CmdletInfoHandler)); + LogCmdletEndInvocationInfo(); + TearDownDebuggingTraces(); + TearDownHttpClientPipeline(); base.EndProcessing(); } @@ -273,17 +292,18 @@ protected string CurrentPath() protected bool IsVerbose() { - bool verbose = MyInvocation.BoundParameters.ContainsKey("Verbose") && ((SwitchParameter)MyInvocation.BoundParameters["Verbose"]).ToBool(); + bool verbose = MyInvocation.BoundParameters.ContainsKey("Verbose") + && ((SwitchParameter)MyInvocation.BoundParameters["Verbose"]).ToBool(); return verbose; } protected new void WriteError(ErrorRecord errorRecord) { FlushDebugMessages(IsDataCollectionAllowed()); - if (QosEvent != null && errorRecord != null) + if (_qosEvent != null && errorRecord != null) { - QosEvent.Exception = errorRecord.Exception; - QosEvent.IsSuccess = false; + _qosEvent.Exception = errorRecord.Exception; + _qosEvent.IsSuccess = false; } base.WriteError(errorRecord); @@ -400,7 +420,7 @@ private void FlushDebugMessages(bool record = false) } string message; - while (_debugMessages.TryDequeue(out message)) + while (DebugMessages.TryDequeue(out message)) { base.WriteDebug(message); } @@ -411,9 +431,11 @@ private void FlushDebugMessages(bool record = false) private void RecordDebugMessages() { // Create 'ErrorRecords' folder under profile directory, if not exists - if (string.IsNullOrEmpty(_errorRecordFolderPath) || !Directory.Exists(_errorRecordFolderPath)) + if (string.IsNullOrEmpty(_errorRecordFolderPath) + || !Directory.Exists(_errorRecordFolderPath)) { - _errorRecordFolderPath = Path.Combine(AzureSession.ProfileDirectory, "ErrorRecords"); + _errorRecordFolderPath = Path.Combine(AzurePowerShell.ProfileDirectory, + "ErrorRecords"); Directory.CreateDirectory(_errorRecordFolderPath); } @@ -437,12 +459,12 @@ private void RecordDebugMessages() sb.AppendLine(); - foreach (var content in _debugMessages) + foreach (var content in DebugMessages) { sb.AppendLine(content); } - AzureSession.DataStore.WriteFile(filePath, sb.ToString()); + AzureSession.DataStore.WriteFile(filePath, sb.ToString()); } /// @@ -450,14 +472,14 @@ private void RecordDebugMessages() /// protected void LogQosEvent() { - if (QosEvent == null) + if (_qosEvent == null) { return; } - QosEvent.FinishQosEvent(); + _qosEvent.FinishQosEvent(); - if (!IsUsageMetricEnabled && (!IsErrorMetricEnabled || QosEvent.IsSuccess)) + if (!IsUsageMetricEnabled && (!IsErrorMetricEnabled || _qosEvent.IsSuccess)) { return; } @@ -467,11 +489,11 @@ protected void LogQosEvent() return; } - WriteDebug(QosEvent.ToString()); + WriteDebug(_qosEvent.ToString()); try { - _metricHelper.LogQoSEvent(QosEvent, IsUsageMetricEnabled, IsErrorMetricEnabled); + _metricHelper.LogQoSEvent(_qosEvent, IsUsageMetricEnabled, IsErrorMetricEnabled); _metricHelper.FlushMetric(); WriteDebug("Finish sending metric."); } @@ -492,18 +514,18 @@ protected void LogQosEvent() /// The action code protected void ConfirmAction(bool force, string actionMessage, string processMessage, string target, Action action) { - if (QosEvent != null) + if (_qosEvent != null) { - QosEvent.PauseQoSTimer(); + _qosEvent.PauseQoSTimer(); } if (force || ShouldContinue(actionMessage, "")) { if (ShouldProcess(target, processMessage)) { - if (QosEvent != null) + if (_qosEvent != null) { - QosEvent.ResumeQosTimer(); + _qosEvent.ResumeQosTimer(); } action(); } @@ -530,19 +552,21 @@ protected override void ProcessRecord() protected virtual void Dispose(bool disposing) { - if (_adalListener != null) + try + { + FlushDebugMessages(); + } + catch { } + if (disposing && _adalListener != null) { _adalListener.Dispose(); + _adalListener = null; } + } public void Dispose() { - try - { - FlushDebugMessages(); - } - catch { } Dispose(true); GC.SuppressFinalize(this); } diff --git a/src/Common/Commands.Common/AzurePSDataCollectionProfile.cs b/src/Common/Commands.Common/AzurePSDataCollectionProfile.cs index cd8c9694c967..8e1880306378 100644 --- a/src/Common/Commands.Common/AzurePSDataCollectionProfile.cs +++ b/src/Common/Commands.Common/AzurePSDataCollectionProfile.cs @@ -12,10 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.IO; using Newtonsoft.Json; -using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common { @@ -35,5 +32,6 @@ public AzurePSDataCollectionProfile(bool enable) [JsonProperty(PropertyName = "enableAzureDataCollection")] public bool? EnableAzureDataCollection { get; set; } + } } diff --git a/src/Common/Commands.Common/AzurePowerShell.cs b/src/Common/Commands.Common/AzurePowerShell.cs index ca6942e92c28..96d80f1b46fe 100644 --- a/src/Common/Commands.Common/AzurePowerShell.cs +++ b/src/Common/Commands.Common/AzurePowerShell.cs @@ -15,7 +15,6 @@ using System; using System.IO; using System.Net.Http.Headers; -using Microsoft.Azure.Common.Authentication.Properties; namespace Microsoft.WindowsAzure.Commands.Common { @@ -45,6 +44,6 @@ public class AzurePowerShell public static string ProfileDirectory = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), - Resources.AzureDirectoryName); + "Windows Azure PowerShell"); } } diff --git a/src/Common/Commands.Common/AzureRmProfileProvider.cs b/src/Common/Commands.Common/AzureRmProfileProvider.cs index fddf65d662a4..4899e4fa2068 100644 --- a/src/Common/Commands.Common/AzureRmProfileProvider.cs +++ b/src/Common/Commands.Common/AzureRmProfileProvider.cs @@ -12,8 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common { diff --git a/src/Common/Commands.Common/AzureSMProfileProvder.cs b/src/Common/Commands.Common/AzureSMProfileProvder.cs index b9d6efd86463..638c4774bacb 100644 --- a/src/Common/Commands.Common/AzureSMProfileProvder.cs +++ b/src/Common/Commands.Common/AzureSMProfileProvder.cs @@ -14,8 +14,8 @@ using System; using System.IO; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -68,9 +68,11 @@ private AzureSMProfile InitializeDefaultProfile() try { GeneralUtilities.EnsureDefaultProfileDirectoryExists(); - _defaultDiskTokenCache = new ProtectedFileTokenCache(Path.Combine(AzureSession.ProfileDirectory, + _defaultDiskTokenCache = new ProtectedFileTokenCache( + Path.Combine(AzureSession.ProfileDirectory, AzureSession.TokenCacheFile)); - return new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)); + return new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, + AzureSession.ProfileFile)); } catch { diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index fa86ffe6fbdb..4ce96d6c4039 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -62,10 +62,6 @@ False ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - False ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -74,16 +70,19 @@ False ..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - + False ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - False ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -102,10 +101,6 @@ False ..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll - - ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll True @@ -148,18 +143,16 @@ - + - True True Resources.resx - @@ -168,12 +161,10 @@ - - @@ -189,6 +180,11 @@ Designer - + + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + + \ No newline at end of file diff --git a/src/Common/Commands.Common/ConcurrentQueueExtensions.cs b/src/Common/Commands.Common/ConcurrentQueueExtensions.cs index 8d47736950a2..7107947cc3e5 100644 --- a/src/Common/Commands.Common/ConcurrentQueueExtensions.cs +++ b/src/Common/Commands.Common/ConcurrentQueueExtensions.cs @@ -12,11 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Collections.Concurrent; namespace Microsoft.WindowsAzure.Commands.Common diff --git a/src/Common/Commands.Common/Constants.cs b/src/Common/Commands.Common/Constants.cs index 65543c7b00df..3dafaae07c6e 100644 --- a/src/Common/Commands.Common/Constants.cs +++ b/src/Common/Commands.Common/Constants.cs @@ -17,19 +17,13 @@ namespace Microsoft.WindowsAzure.Commands.Common public static class ApiConstants { public const string AuthorizationHeaderName = "Authorization"; - public const string BasicAuthorization = "Basic"; - public const string UserAgentHeaderName = "User-Agent"; - - public const string UserAgentHeaderValue = "AzurePowershell/v" + AzurePowerShell.AssemblyVersion; - + public const string UserAgentHeaderValue = "AzurePowershell/v" + + AzurePowerShell.AssemblyVersion; public const string VSDebuggerCausalityDataHeaderName = "VSDebuggerCausalityData"; - public const string OperationTrackingIdHeader = "x-ms-request-id"; - public const string VersionHeaderContentLatest = "2013-08-01"; - public const string VersionHeaderName = "x-ms-version"; } @@ -42,15 +36,10 @@ public static class StorSimpleConstants public class SDKVersion { public const string Version180 = "1.8.0"; - public const string Version200 = "2.0.0"; - public const string Version220 = "2.2.0"; - public const string Version230 = "2.3.0"; - public const string Version240 = "2.4.0"; - public const string Version250 = "2.5.0"; } diff --git a/src/Common/Commands.Common/ContextExtensions.cs b/src/Common/Commands.Common/ContextExtensions.cs index 5ea74714e8a9..9a22b05499e6 100644 --- a/src/Common/Commands.Common/ContextExtensions.cs +++ b/src/Common/Commands.Common/ContextExtensions.cs @@ -12,12 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common { diff --git a/src/Common/Commands.Common/ConversionUtilities.cs b/src/Common/Commands.Common/ConversionUtilities.cs index 270b4153b08a..57904f59fc4a 100644 --- a/src/Common/Commands.Common/ConversionUtilities.cs +++ b/src/Common/Commands.Common/ConversionUtilities.cs @@ -24,7 +24,8 @@ namespace Microsoft.WindowsAzure.Commands.Common { public static class ConversionUtilities { - public static Dictionary ToDictionary(this Hashtable hashtable, bool addValueLayer) + public static Dictionary ToDictionary(this Hashtable hashtable, + bool addValueLayer) { if (hashtable == null) { @@ -39,7 +40,8 @@ public static Dictionary ToDictionary(this Hashtable hashtable, if (valueAsHashtable != null) { - dictionary[(string)entry.Key] = valueAsHashtable.ToDictionary(addValueLayer); + dictionary[(string)entry.Key] = + valueAsHashtable.ToDictionary(addValueLayer); } else { @@ -85,7 +87,9 @@ public static Hashtable ToHashtable(this IDictionary dictionary) /// The array into string representation public static string ArrayToString(this T[] array, string delimiter) { - return (array == null) ? null : (array.Length == 0) ? String.Empty : array.Skip(1).Aggregate(new StringBuilder(array[0].ToString()), (s, i) => s.Append(delimiter).Append(i), s => s.ToString()); + return (array == null) ? null : (array.Length == 0) ? String.Empty + : array.Skip(1).Aggregate(new StringBuilder(array[0].ToString()), + (s, i) => s.Append(delimiter).Append(i), s => s.ToString()); } public static string SecureStringToString(SecureString secureString) diff --git a/src/Common/Commands.Common/GeneralUtilities.cs b/src/Common/Commands.Common/GeneralUtilities.cs index ccf454082b35..9675dc827ace 100644 --- a/src/Common/Commands.Common/GeneralUtilities.cs +++ b/src/Common/Commands.Common/GeneralUtilities.cs @@ -24,11 +24,15 @@ using System.Security.Cryptography.X509Certificates; using System.ServiceModel.Channels; using System.Text; -using System.Xml; +using System.Xml.Linq; using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.Common; +using Newtonsoft.Json; +using Formatting = System.Xml.Formatting; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { @@ -51,7 +55,11 @@ private static bool TryFindCertificatesInStore(string thumbprint, public static X509Certificate2 GetCertificateFromStore(string thumbprint) { - Validate.ValidateStringIsNullOrEmpty(thumbprint, "certificate thumbprint"); + if (string.IsNullOrWhiteSpace(thumbprint)) + { + throw new ArgumentNullException("certificate thumbprint"); + } + X509Certificate2Collection certificates; if (TryFindCertificatesInStore(thumbprint, StoreLocation.CurrentUser, out certificates) || TryFindCertificatesInStore(thumbprint, StoreLocation.LocalMachine, out certificates)) @@ -61,7 +69,8 @@ public static X509Certificate2 GetCertificateFromStore(string thumbprint) else { throw new ArgumentException(string.Format( - Microsoft.Azure.Common.Authentication.Properties.Resources.CertificateNotFoundInStore, + "Certificate {0} was not found in the certificate store. Please ensure the referenced " + + "certificate exists in the the LocalMachine\\My or CurrentUser\\My store", thumbprint)); } } @@ -83,24 +92,6 @@ public static bool TryEquals(string leftHandSide, string rightHandSide) return false; } - public static string ReadMessageBody(ref Message originalMessage) - { - StringBuilder strBuilder = new StringBuilder(); - - using (MessageBuffer messageBuffer = originalMessage.CreateBufferedCopy(int.MaxValue)) - { - Message message = messageBuffer.CreateMessage(); - XmlWriter writer = XmlWriter.Create(strBuilder); - using (XmlDictionaryWriter dictionaryWriter = XmlDictionaryWriter.CreateDictionaryWriter(writer)) - { - message.WriteBodyContents(dictionaryWriter); - } - - originalMessage = messageBuffer.CreateMessage(); - } - - return XmlUtilities.Beautify(strBuilder.ToString()); - } public static string GetConfiguration(string configurationPath) { @@ -298,7 +289,8 @@ public static string GetHttpRequestLog(string method, string requestUri, HttpHea public static string GetLog(HttpResponseMessage response) { - string body = response.Content == null ? string.Empty : FormatString(response.Content.ReadAsStringAsync().Result); + string body = response.Content == null ? string.Empty + : FormatString(response.Content.ReadAsStringAsync().Result); return GetHttpResponseLog( response.StatusCode.ToString(), @@ -308,7 +300,8 @@ public static string GetLog(HttpResponseMessage response) public static string GetLog(HttpRequestMessage request) { - string body = request.Content == null ? string.Empty : FormatString(request.Content.ReadAsStringAsync().Result); + string body = request.Content == null ? string.Empty + : FormatString(request.Content.ReadAsStringAsync().Result); return GetHttpRequestLog( request.Method.ToString(), @@ -321,11 +314,11 @@ public static string FormatString(string content) { if (CloudException.IsXml(content)) { - return XmlUtilities.TryFormatXml(content); + return TryFormatXml(content); } else if (CloudException.IsJson(content)) { - return JsonUtilities.TryFormatJson(content); + return TryFormatJson(content); } else { @@ -333,6 +326,34 @@ public static string FormatString(string content) } } + private static string TryFormatJson(string str) + { + try + { + object parsedJson = JsonConvert.DeserializeObject(str); + return JsonConvert.SerializeObject(parsedJson, + Newtonsoft.Json.Formatting.Indented); + } + catch + { + // can't parse JSON, return the original string + return str; + } + } + + private static string TryFormatXml(string content) + { + try + { + XDocument doc = XDocument.Parse(content); + return doc.ToString(); + } + catch (Exception) + { + return content; + } + } + private static WebHeaderCollection ConvertHttpHeadersToWebHeaderCollection(HttpHeaders headers) { WebHeaderCollection webHeaders = new WebHeaderCollection(); @@ -400,6 +421,12 @@ public static string DownloadFile(string uri) return contents; } + /// + /// Pad a string using the given separator string + /// + /// The number of repetitions of the separator + /// The separator string to use + /// A string containing the given number of repetitions of the separator string public static string GenerateSeparator(int amount, string separator) { StringBuilder result = new StringBuilder(); @@ -422,7 +449,7 @@ public static void EnsureDefaultProfileDirectoryExists() /// Clear the current storage account from the context - guarantees that only one storage account will be active /// at a time. /// - /// Whenter to clear the service management context. + /// Whether to clear the service management context. public static void ClearCurrentStorageAccount(bool clearSMContext = false) { var RMProfile = AzureRmProfileProvider.Instance.Profile; diff --git a/src/Common/Commands.Common/IFileSystem.cs b/src/Common/Commands.Common/IFileSystem.cs new file mode 100644 index 000000000000..7d5eacf1ae00 --- /dev/null +++ b/src/Common/Commands.Common/IFileSystem.cs @@ -0,0 +1,28 @@ + // ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.WindowsAzure.Commands.Common +{ + public interface IFileSystem + { + string ReadFile(string path); + void WriteFile(string path, string contents); + } +} diff --git a/src/Common/Commands.Common/IProfileProvider.cs b/src/Common/Commands.Common/IProfileProvider.cs index a0e163e7e63e..df359fa10fc2 100644 --- a/src/Common/Commands.Common/IProfileProvider.cs +++ b/src/Common/Commands.Common/IProfileProvider.cs @@ -12,13 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common { diff --git a/src/Common/Commands.Common/RecordingTracingInterceptor.cs b/src/Common/Commands.Common/RecordingTracingInterceptor.cs index 3bce7d23a45f..447a9b168b9d 100644 --- a/src/Common/Commands.Common/RecordingTracingInterceptor.cs +++ b/src/Common/Commands.Common/RecordingTracingInterceptor.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Common; -namespace Microsoft.Azure.Common.Authentication.Models +namespace Microsoft.Azure.ServiceManagemenet.Common.Models { public class RecordingTracingInterceptor : Hyak.Common.ICloudTracingInterceptor { diff --git a/src/Common/Commands.Common/ServiceClientTracingInterceptor.cs b/src/Common/Commands.Common/ServiceClientTracingInterceptor.cs index f31983f778c7..3f23d99c23e2 100644 --- a/src/Common/Commands.Common/ServiceClientTracingInterceptor.cs +++ b/src/Common/Commands.Common/ServiceClientTracingInterceptor.cs @@ -12,68 +12,68 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Rest; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace Microsoft.WindowsAzure.Commands.Common -{ - class ServiceClientTracingInterceptor : IServiceClientTracingInterceptor - { - public ServiceClientTracingInterceptor(ConcurrentQueue queue) - { - MessageQueue = queue; - } +//using Microsoft.Rest; +//using System; +//using System.Collections.Concurrent; +//using System.Collections.Generic; +//using System.Diagnostics; +//using System.Linq; +//using System.Text; +//using System.Threading.Tasks; +//namespace Microsoft.WindowsAzure.Commands.Common +//{ +// class ServiceClientTracingInterceptor : IServiceClientTracingInterceptor +// { +// public ServiceClientTracingInterceptor(ConcurrentQueue queue) +// { +// MessageQueue = queue; +// } - public ConcurrentQueue MessageQueue { get; private set; } +// public ConcurrentQueue MessageQueue { get; private set; } - public void Configuration(string source, string name, string value) - { - // Ignore - } +// public void Configuration(string source, string name, string value) +// { +// // Ignore +// } - public void EnterMethod(string invocationId, object instance, string method, IDictionary parameters) - { - // Ignore - } +// public void EnterMethod(string invocationId, object instance, string method, IDictionary parameters) +// { +// // Ignore +// } - public void ExitMethod(string invocationId, object returnValue) - { - // Ignore - } +// public void ExitMethod(string invocationId, object returnValue) +// { +// // Ignore +// } - public void Information(string message) - { - MessageQueue.CheckAndEnqueue(message); - } +// public void Information(string message) +// { +// MessageQueue.CheckAndEnqueue(message); +// } - public void ReceiveResponse(string invocationId, System.Net.Http.HttpResponseMessage response) - { - string responseAsString = response == null ? string.Empty : response.AsFormattedString(); - MessageQueue.CheckAndEnqueue(responseAsString); - } +// public void ReceiveResponse(string invocationId, System.Net.Http.HttpResponseMessage response) +// { +// string responseAsString = response == null ? string.Empty : response.AsFormattedString(); +// MessageQueue.CheckAndEnqueue(responseAsString); +// } - public void SendRequest(string invocationId, System.Net.Http.HttpRequestMessage request) - { - string requestAsString = request == null ? string.Empty : request.AsFormattedString(); - MessageQueue.CheckAndEnqueue(requestAsString); - } +// public void SendRequest(string invocationId, System.Net.Http.HttpRequestMessage request) +// { +// string requestAsString = request == null ? string.Empty : request.AsFormattedString(); +// MessageQueue.CheckAndEnqueue(requestAsString); +// } - public void TraceError(string invocationId, Exception exception) - { - // Ignore - } +// public void TraceError(string invocationId, Exception exception) +// { +// // Ignore +// } - public static void RemoveTracingInterceptor(ServiceClientTracingInterceptor interceptor) - { - if (interceptor != null) - { - ServiceClientTracing.RemoveTracingInterceptor(interceptor); - } - } - } -} +// public static void RemoveTracingInterceptor(ServiceClientTracingInterceptor interceptor) +// { +// if (interceptor != null) +// { +// ServiceClientTracing.RemoveTracingInterceptor(interceptor); +// } +// } +// } +//} diff --git a/src/Common/Commands.Common/packages.config b/src/Common/Commands.Common/packages.config index 55769d13f483..223468584f83 100644 --- a/src/Common/Commands.Common/packages.config +++ b/src/Common/Commands.Common/packages.config @@ -4,7 +4,6 @@ - @@ -12,8 +11,8 @@ - - + + \ No newline at end of file diff --git a/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj b/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj index c4beb96b1544..892fd91b3b22 100644 --- a/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj +++ b/src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj @@ -46,10 +46,6 @@ ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -71,8 +67,12 @@ False ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -95,10 +95,6 @@ False ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - ..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - @@ -168,6 +164,10 @@ {cff09e81-1e31-444e-b4d4-a21e946c29e2} Commands.ServiceManagement.Common + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs b/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs index dbbb9ee006a8..7b45c5eeeff5 100644 --- a/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs +++ b/src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Test; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; @@ -26,6 +26,7 @@ using System.IO; using System.Management.Automation; using System.Security.Cryptography.X509Certificates; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.ScenarioTest { diff --git a/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessToken.cs b/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessToken.cs index 4acccb09d00f..991e0fd72cab 100644 --- a/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessToken.cs +++ b/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessToken.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessTokenProvider.cs b/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessTokenProvider.cs index e94b91ba1538..7746be8a7416 100644 --- a/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessTokenProvider.cs +++ b/src/Common/Commands.ScenarioTests.Common/Mocks/MockAccessTokenProvider.cs @@ -13,9 +13,9 @@ // ---------------------------------------------------------------------------------- using System.Security; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/Common/Commands.ScenarioTests.Common/Mocks/MockCertificateAuthenticationFactory.cs b/src/Common/Commands.ScenarioTests.Common/Mocks/MockCertificateAuthenticationFactory.cs index 1ac58bb181b8..784f19f446d2 100644 --- a/src/Common/Commands.ScenarioTests.Common/Mocks/MockCertificateAuthenticationFactory.cs +++ b/src/Common/Commands.ScenarioTests.Common/Mocks/MockCertificateAuthenticationFactory.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using System.Security; using System.Security.Cryptography.X509Certificates; diff --git a/src/Common/Commands.ScenarioTests.Common/Mocks/MockClientFactory.cs b/src/Common/Commands.ScenarioTests.Common/Mocks/MockClientFactory.cs index 8859ddc765d2..ff7d51d781db 100644 --- a/src/Common/Commands.ScenarioTests.Common/Mocks/MockClientFactory.cs +++ b/src/Common/Commands.ScenarioTests.Common/Mocks/MockClientFactory.cs @@ -24,11 +24,12 @@ using Hyak.Common; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.Azure.Common; -using Microsoft.Azure.Common.Authentication.Factories; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/Common/Commands.ScenarioTests.Common/Mocks/MockTokenAuthenticationFactory.cs b/src/Common/Commands.ScenarioTests.Common/Mocks/MockTokenAuthenticationFactory.cs index 8186ff38635f..20ec0ee62904 100644 --- a/src/Common/Commands.ScenarioTests.Common/Mocks/MockTokenAuthenticationFactory.cs +++ b/src/Common/Commands.ScenarioTests.Common/Mocks/MockTokenAuthenticationFactory.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Rest; using System; using System.Security; diff --git a/src/Common/Commands.ScenarioTests.Common/SMTestBase.cs b/src/Common/Commands.ScenarioTests.Common/SMTestBase.cs index 49a3179f5cca..4722f1cdcf05 100644 --- a/src/Common/Commands.ScenarioTests.Common/SMTestBase.cs +++ b/src/Common/Commands.ScenarioTests.Common/SMTestBase.cs @@ -15,9 +15,10 @@ using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/Common/Commands.ScenarioTests.Common/packages.config b/src/Common/Commands.ScenarioTests.Common/packages.config index 17d0c605e03e..7c7ea25a2c34 100644 --- a/src/Common/Commands.ScenarioTests.Common/packages.config +++ b/src/Common/Commands.ScenarioTests.Common/packages.config @@ -2,7 +2,6 @@ - @@ -12,8 +11,8 @@ - - + + diff --git a/src/Common/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs b/src/Common/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs index 8733daf01b70..a4d1d6572b77 100644 --- a/src/Common/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs +++ b/src/Common/Storage/Commands.Storage.Test/Blob/StorageBlobTestBase.cs @@ -19,8 +19,8 @@ using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Storage.Test.Service; using Microsoft.WindowsAzure.Storage.Blob; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Storage.Test.Blob { diff --git a/src/Common/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj b/src/Common/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj index b2035fe5f5a4..752da81ad8b3 100644 --- a/src/Common/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj +++ b/src/Common/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj @@ -57,10 +57,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -76,6 +72,7 @@ ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -96,12 +93,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -259,6 +256,10 @@ {cff09e81-1e31-444e-b4d4-a21e946c29e2} Commands.ServiceManagement.Common + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {08cf7da7-0392-4a19-b79b-e1ff67cdb81a} Commands.Storage diff --git a/src/Common/Storage/Commands.Storage.Test/Common/StorageCloudCmdletBaseTest.cs b/src/Common/Storage/Commands.Storage.Test/Common/StorageCloudCmdletBaseTest.cs index 36de52969df7..808c9dc52a9e 100644 --- a/src/Common/Storage/Commands.Storage.Test/Common/StorageCloudCmdletBaseTest.cs +++ b/src/Common/Storage/Commands.Storage.Test/Common/StorageCloudCmdletBaseTest.cs @@ -107,7 +107,7 @@ public void ShouldInitServiceChannelTest() CloudStorageAccount account = CloudStorageAccount.DevelopmentStorageAccount; command.Context = new AzureStorageContext(account); string toss; - Assert.IsFalse(command.TryGetStorageAccount(command.RMProfile, out toss)); + Assert.IsFalse(command.TryGetStorageAccount(command.SMProfile, out toss)); } } } diff --git a/src/Common/Storage/Commands.Storage.Test/packages.config b/src/Common/Storage/Commands.Storage.Test/packages.config index a7c1e9ddc0d9..68a497dfa732 100644 --- a/src/Common/Storage/Commands.Storage.Test/packages.config +++ b/src/Common/Storage/Commands.Storage.Test/packages.config @@ -2,7 +2,7 @@ - + @@ -15,8 +15,8 @@ - - + + diff --git a/src/Common/Storage/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs b/src/Common/Storage/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs index 92f8e15d74a6..6277a992c1e1 100644 --- a/src/Common/Storage/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs +++ b/src/Common/Storage/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs @@ -12,6 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; + namespace Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet { using System; @@ -29,7 +31,7 @@ namespace Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet using Microsoft.WindowsAzure.Storage.Blob; using Microsoft.WindowsAzure.Storage.DataMovement; using Microsoft.WindowsAzure.Storage.File; - using Microsoft.Azure.Common.Authentication; + using Azure.ServiceManagemenet.Common; using System.Reflection; [Cmdlet(VerbsLifecycle.Start, StorageNouns.CopyBlob, ConfirmImpact = ConfirmImpact.High, DefaultParameterSetName = ContainerNameParameterSet), @@ -600,8 +602,8 @@ public void OnImport() { try { - System.Management.Automation.PowerShell invoker = null; - invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace); + PowerShell invoker = null; + invoker = PowerShell.Create(RunspaceMode.CurrentRunspace); invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath( Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AzureStorageStartup.ps1"))); diff --git a/src/Common/Storage/Commands.Storage/Commands.Storage.csproj b/src/Common/Storage/Commands.Storage/Commands.Storage.csproj index de06b915084c..2d40ef1dcba0 100644 --- a/src/Common/Storage/Commands.Storage/Commands.Storage.csproj +++ b/src/Common/Storage/Commands.Storage/Commands.Storage.csproj @@ -49,10 +49,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -85,12 +81,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -281,6 +277,14 @@ {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common + + {cff09e81-1e31-444e-b4d4-a21e946c29e2} + Commands.ServiceManagement.Common + + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + diff --git a/src/Common/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs b/src/Common/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs index 2a13b7213800..2d916f777492 100644 --- a/src/Common/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs +++ b/src/Common/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs @@ -16,13 +16,14 @@ using System.Globalization; using System.Management.Automation; using System.Security.Permissions; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet { diff --git a/src/Common/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs b/src/Common/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs index ba329a65caee..4d6b1db45093 100644 --- a/src/Common/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs +++ b/src/Common/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs @@ -20,13 +20,12 @@ using System.Net; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Storage.File; using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using Microsoft.WindowsAzure.Storage.File; @@ -244,7 +243,7 @@ internal AzureStorageContext GetCmdletStorageContext(AzureStorageContext context string storageAccount; try { - if (TryGetStorageAccount(RMProfile, out storageAccount) + if (TryGetStorageAccount(RMProfile, out storageAccount) || TryGetStorageAccount(SMProfile, out storageAccount) || TryGetStorageAccountFromEnvironmentVariable(out storageAccount)) { diff --git a/src/Common/Storage/Commands.Storage/packages.config b/src/Common/Storage/Commands.Storage/packages.config index bfe594a9d55b..53fd826d967a 100644 --- a/src/Common/Storage/Commands.Storage/packages.config +++ b/src/Common/Storage/Commands.Storage/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ResourceManager.ForRefactoringOnly.sln b/src/ResourceManager.ForRefactoringOnly.sln index 6f25d1494f02..8aea0bdc591a 100644 --- a/src/ResourceManager.ForRefactoringOnly.sln +++ b/src/ResourceManager.ForRefactoringOnly.sln @@ -135,13 +135,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.DataLakeStore.Test EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.DataLakeAnalytics.Test", "ResourceManager\DataLakeAnalytics\Commands.DataLakeAnalytics.Test\Commands.DataLakeAnalytics.Test.csproj", "{E6122DB1-1466-47EE-8BA0-73F9CA90F826}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Intune", "ResourceManager\Intune\Commands.Intune\Commands.Intune.csproj", "{189B40C3-7505-410A-9E55-7E7671BB2E14}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Intune.Test", "ResourceManager\Intune\Commands.Intune.Test\Commands.Intune.Test.csproj", "{CA5F571B-550B-4BE3-9BA3-06442DF52768}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.LogicApp", "ResourceManager\LogicApp\Commands.LogicApp\Commands.LogicApp.csproj", "{FFE4E475-B32C-4F89-9D52-F7CEBF709C74}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.LogicApp.Test", "ResourceManager\LogicApp\Commands.LogicApp.Test\Commands.LogicApp.Test.csproj", "{F1F11BB1-592B-45A3-844C-7F8A585AD107}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureStackAdmin", "ResourceManager\AzureStackAdmin\Commands.AzureStackAdmin\Commands.AzureStackAdmin.csproj", "{0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}" EndProject @@ -403,22 +397,10 @@ Global {E6122DB1-1466-47EE-8BA0-73F9CA90F826}.Debug|Any CPU.Build.0 = Debug|Any CPU {E6122DB1-1466-47EE-8BA0-73F9CA90F826}.Release|Any CPU.ActiveCfg = Release|Any CPU {E6122DB1-1466-47EE-8BA0-73F9CA90F826}.Release|Any CPU.Build.0 = Release|Any CPU - {189B40C3-7505-410A-9E55-7E7671BB2E14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {189B40C3-7505-410A-9E55-7E7671BB2E14}.Debug|Any CPU.Build.0 = Debug|Any CPU - {189B40C3-7505-410A-9E55-7E7671BB2E14}.Release|Any CPU.ActiveCfg = Release|Any CPU - {189B40C3-7505-410A-9E55-7E7671BB2E14}.Release|Any CPU.Build.0 = Release|Any CPU - {CA5F571B-550B-4BE3-9BA3-06442DF52768}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CA5F571B-550B-4BE3-9BA3-06442DF52768}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CA5F571B-550B-4BE3-9BA3-06442DF52768}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CA5F571B-550B-4BE3-9BA3-06442DF52768}.Release|Any CPU.Build.0 = Release|Any CPU - {FFE4E475-B32C-4F89-9D52-F7CEBF709C74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FFE4E475-B32C-4F89-9D52-F7CEBF709C74}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FFE4E475-B32C-4F89-9D52-F7CEBF709C74}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FFE4E475-B32C-4F89-9D52-F7CEBF709C74}.Release|Any CPU.Build.0 = Release|Any CPU - {F1F11BB1-592B-45A3-844C-7F8A585AD107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F1F11BB1-592B-45A3-844C-7F8A585AD107}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1F11BB1-592B-45A3-844C-7F8A585AD107}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F1F11BB1-592B-45A3-844C-7F8A585AD107}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Debug|Any CPU.Build.0 = Debug|Any CPU {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -463,8 +445,6 @@ Global {EA66BF2C-4E5F-42FE-912C-B62AEB588308} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {B0D03ECF-9F25-499A-BE25-D668E0D208AA} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {E6122DB1-1466-47EE-8BA0-73F9CA90F826} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} - {CA5F571B-550B-4BE3-9BA3-06442DF52768} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} - {F1F11BB1-592B-45A3-844C-7F8A585AD107} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {53ED0604-8774-4B46-BB26-6AA5A6327A7C} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} EndGlobalSection EndGlobal diff --git a/src/ResourceManager/ApiManagement/ApiManagement.sln b/src/ResourceManager/ApiManagement/ApiManagement.sln index 733aa0b7732b..5551f56475ea 100644 --- a/src/ResourceManager/ApiManagement/ApiManagement.sln +++ b/src/ResourceManager/ApiManagement/ApiManagement.sln @@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -100,6 +102,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs index 044d713654c8..6f61b2cd293b 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement { using System; @@ -24,8 +27,8 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement using System.Text.RegularExpressions; using AutoMapper; using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using ServiceManagemenet.Common; + using ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.ApiManagement; using Microsoft.Azure.Management.ApiManagement.SmapiModels; using Newtonsoft.Json; diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj index 9f2b1c647b40..ff40cad72bba 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj @@ -59,10 +59,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -90,6 +86,14 @@ False ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + False ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -104,14 +108,6 @@ False ..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - False ..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll @@ -229,6 +225,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65C3A86A-716D-4E7D-AB67-1DB00B3BF72D} Commands.Common.Storage diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config index a338a30cc6b2..a490781ab585 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config @@ -3,7 +3,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj index 1eb498de04c4..70164a9d0e01 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj @@ -43,10 +43,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -87,12 +83,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -165,6 +161,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.cs b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.cs index 0d68de164628..ba56c90dd228 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.cs +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.cs @@ -13,10 +13,11 @@ // limitations under the License. using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.ApiManagement.Test.ScenarioTests { - using Microsoft.Azure.Common.Authentication; + using ServiceManagemenet.Common; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config index 2dc8bcec3cf9..8ee8f6102e38 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement/ApiManagementClient.cs b/src/ResourceManager/ApiManagement/Commands.ApiManagement/ApiManagementClient.cs index a177ab397f47..333dc9f87e91 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement/ApiManagementClient.cs +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement/ApiManagementClient.cs @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.ApiManagement { using System; @@ -19,11 +22,9 @@ namespace Microsoft.Azure.Commands.ApiManagement using System.IO; using System.Linq; using AutoMapper; - using Microsoft.Azure.Commands.ApiManagement.Models; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; - using Microsoft.Azure.Management.ApiManagement; - using Microsoft.Azure.Management.ApiManagement.Models; + using Models; + using Management.ApiManagement; + using Management.ApiManagement.Models; public class ApiManagementClient { diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj b/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj index e92a5fdb3261..27d3d6a22d63 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands.ApiManagement.csproj @@ -58,13 +58,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - - - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll - ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True @@ -97,12 +90,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -198,6 +191,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65C3A86A-716D-4E7D-AB67-1DB00B3BF72D} Commands.Common.Storage diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config b/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config index a338a30cc6b2..a490781ab585 100644 --- a/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config +++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement/packages.config @@ -3,7 +3,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj index bf82d7f01a3d..f657f447a6a2 100644 --- a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj +++ b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Commands.ApiManagement.ServiceManagement.Test.csproj @@ -43,10 +43,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -87,12 +83,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -167,6 +163,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/ScenarioTests/ApiManagementTests.cs b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/ScenarioTests/ApiManagementTests.cs index 44f30a92c004..153541f6ac58 100644 --- a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/ScenarioTests/ApiManagementTests.cs +++ b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/ScenarioTests/ApiManagementTests.cs @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Microsoft.Azure.Commands.Common.Authentication; + namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Test.ScenarioTests { - using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.ApiManagement; using Microsoft.Azure.Management.Authorization; diff --git a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/packages.config b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/packages.config index b1c9545debb6..31d7e4395696 100644 --- a/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/packages.config +++ b/src/ResourceManager/ApiManagement/Commands.SMAPI.Test/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/Automation/Automation.sln b/src/ResourceManager/Automation/Automation.sln index 32414bfee661..c114058a4753 100644 --- a/src/ResourceManager/Automation/Automation.sln +++ b/src/ResourceManager/Automation/Automation.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +48,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj b/src/ResourceManager/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj index 3f3bf45d50de..ee5a4c6c8359 100644 --- a/src/ResourceManager/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj +++ b/src/ResourceManager/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj @@ -56,10 +56,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -78,6 +74,7 @@ False ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -85,12 +82,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -133,9 +130,8 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll - - ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True + + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True ..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll @@ -194,6 +190,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AutomationScenarioTestsBase.cs b/src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AutomationScenarioTestsBase.cs index dff81da7fca9..28b186f11d72 100644 --- a/src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AutomationScenarioTestsBase.cs +++ b/src/ResourceManager/Automation/Commands.Automation.Test/ScenarioTests/AutomationScenarioTestsBase.cs @@ -12,9 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Management.Resources; -using Microsoft.Azure.Subscriptions; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.Azure.Test; using Microsoft.Azure.Management.Automation; diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/packages.config b/src/ResourceManager/Automation/Commands.Automation.Test/packages.config index e61d719b61b7..0a0c989983f8 100644 --- a/src/ResourceManager/Automation/Commands.Automation.Test/packages.config +++ b/src/ResourceManager/Automation/Commands.Automation.Test/packages.config @@ -2,7 +2,6 @@ - @@ -12,8 +11,8 @@ - - + + diff --git a/src/ResourceManager/Automation/Commands.Automation/Commands.Automation.csproj b/src/ResourceManager/Automation/Commands.Automation/Commands.Automation.csproj index 62bddbcb4b13..d975c5b84217 100644 --- a/src/ResourceManager/Automation/Commands.Automation/Commands.Automation.csproj +++ b/src/ResourceManager/Automation/Commands.Automation/Commands.Automation.csproj @@ -59,10 +59,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Management.Automation.2.0.0\lib\portable-net45+wp8+wpa81+win\Microsoft.Azure.Management.Automation.dll @@ -71,6 +67,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -83,6 +80,14 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + False ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -99,14 +104,6 @@ False ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -272,6 +269,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs b/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs index 22194c7c10a4..2ec0d85159a3 100644 --- a/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs +++ b/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs @@ -26,11 +26,10 @@ using Microsoft.Azure.Commands.Automation.Properties; using Microsoft.Azure.Management.Automation; using Microsoft.Azure.Management.Automation.Models; -using Microsoft.Azure.Common.Authentication.Models; using Newtonsoft.Json; -using Microsoft.Azure.Common.Authentication; using Hyak.Common; - +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using AutomationManagement = Microsoft.Azure.Management.Automation; using AutomationAccount = Microsoft.Azure.Commands.Automation.Model.AutomationAccount; using Module = Microsoft.Azure.Commands.Automation.Model.Module; diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs b/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs index 704bccf7a9d1..83f5fab55b4a 100644 --- a/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs +++ b/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs @@ -16,10 +16,9 @@ using System.IO; using System.Collections; using System.Collections.Generic; -using System.Runtime.CompilerServices; using System.Security; using Microsoft.Azure.Commands.Automation.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Automation.Common { diff --git a/src/ResourceManager/Automation/Commands.Automation/packages.config b/src/ResourceManager/Automation/Commands.Automation/packages.config index bff955a853b5..6ec3abbf6edc 100644 --- a/src/ResourceManager/Automation/Commands.Automation/packages.config +++ b/src/ResourceManager/Automation/Commands.Automation/packages.config @@ -2,7 +2,6 @@ - @@ -11,8 +10,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/AzureBackup/AzureBackup.sln b/src/ResourceManager/AzureBackup/AzureBackup.sln index d1c207d2c9fe..71dea1fd7989 100644 --- a/src/ResourceManager/AzureBackup/AzureBackup.sln +++ b/src/ResourceManager/AzureBackup/AzureBackup.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +48,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj index 5a772b6b7d44..a300c1e4e808 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj @@ -36,10 +36,6 @@ 4 - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.5-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll @@ -71,12 +67,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -150,6 +146,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3436a126-edc9-4060-8952-9a1be34cdd95} Commands.ScenarioTests.ResourceManager.Common diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTestBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTestBase.cs index 325b7ae0a2ee..d806949e3339 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTestBase.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/ScenarioTests/AzureBackupTestBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Management.BackupServices; using Microsoft.Azure.Test; using Microsoft.Azure.Test.HttpRecorder; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config index 2be57c5b59d0..54146b6027dd 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackUpRestoreBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackUpRestoreBase.cs index 5cbce720bd25..cf291f8b5ae6 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackUpRestoreBase.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackUpRestoreBase.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/AzureBackupClientAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/AzureBackupClientAdapter.cs index fe67781f9d65..9c44394634e9 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/AzureBackupClientAdapter.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/AzureBackupClientAdapter.cs @@ -12,12 +12,12 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Management.BackupServices; using Microsoft.Azure.Management.BackupServices.Models; using System; using System.Net; using System.Threading; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.AzureBackup.ClientAdapter { diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ContainerAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ContainerAdapter.cs index 83559355b0a4..19a6e5bc5cb3 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ContainerAdapter.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ContainerAdapter.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ItemAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ItemAdapter.cs index 0fd442e799c4..83214b03c841 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ItemAdapter.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/ItemAdapter.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/JobAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/JobAdapter.cs index ee8b2d02208c..df15e3ba0ead 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/JobAdapter.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/JobAdapter.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/OperationStatusAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/OperationStatusAdapter.cs index fb3077e5b805..7ac9f099b59f 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/OperationStatusAdapter.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/OperationStatusAdapter.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/PolicyAdapter.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/PolicyAdapter.cs index df17ca032313..70b23ff7a7cf 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/PolicyAdapter.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupClientAdapter/PolicyAdapter.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs index 2b888e17731a..4bc4db9ee510 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs @@ -16,19 +16,18 @@ using Microsoft.Azure.Commands.AzureBackup.ClientAdapter; using Microsoft.Azure.Commands.AzureBackup.Models; using Microsoft.Azure.Commands.AzureBackup.Properties; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.BackupServices; using Microsoft.Azure.Management.BackupServices.Models; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.Scheduler; using System; using System.Collections.Generic; using System.Management.Automation; using System.Net; -using System.Threading; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using CmdletModel = Microsoft.Azure.Commands.AzureBackup.Models; using Microsoft.Azure.Commands.ResourceManager.Common; +using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets { diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs index 8a70d8635362..f631eebe59e6 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupContainerCmdletBase.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupDSCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupDSCmdletBase.cs index 55a426458cc0..3fb70592c0ab 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupDSCmdletBase.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupDSCmdletBase.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupItemCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupItemCmdletBase.cs index fdad61ff1125..35c3b42d557e 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupItemCmdletBase.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupItemCmdletBase.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupPolicyCmdletBase.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupPolicyCmdletBase.cs index fd3448384205..8ff6b254a992 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupPolicyCmdletBase.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupPolicyCmdletBase.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj index 869841b46df9..f760e0c830ef 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj @@ -49,10 +49,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -72,6 +68,14 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -97,14 +101,6 @@ Cmdlets\VaultCredentials\Security.Cryptography.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -197,7 +193,7 @@ AzureRM.Backup.psd1 PreserveNewest - + Never Designer @@ -225,6 +221,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs index b0fa09138368..c1003c1bb12c 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ProtectionPolicyHelpers.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ProtectionPolicyHelpers.cs index 9980dfcdf7a5..def8c1659b68 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ProtectionPolicyHelpers.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ProtectionPolicyHelpers.cs @@ -17,8 +17,8 @@ using System.Collections.Generic; using System.Xml; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Threading; using Hyak.Common; using Microsoft.Azure.Commands.AzureBackup.Properties; diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config b/src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config index 754e1cbf9af1..843ab83f79dd 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config @@ -2,7 +2,6 @@ - @@ -11,8 +10,8 @@ - - + + diff --git a/src/ResourceManager/AzureBatch/AzureBatch.sln b/src/ResourceManager/AzureBatch/AzureBatch.sln index 344a94efde20..4f20e898953b 100644 --- a/src/ResourceManager/AzureBatch/AzureBatch.sln +++ b/src/ResourceManager/AzureBatch/AzureBatch.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj index 9534e6642241..73b44af1af56 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj +++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -98,12 +94,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -655,6 +651,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchController.cs b/src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchController.cs index 86ccfbb2ecbf..1daa64b3a5f5 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchController.cs +++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchController.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Batch; @@ -23,6 +22,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.Batch.Test.ScenarioTests { diff --git a/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config b/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config index cfdc08ff5d2a..00af38fe7ab0 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config +++ b/src/ResourceManager/AzureBatch/Commands.Batch.Test/packages.config @@ -3,7 +3,6 @@ - @@ -20,8 +19,8 @@ - - + + diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/BatchCmdletBase.cs b/src/ResourceManager/AzureBatch/Commands.Batch/BatchCmdletBase.cs index 11115f81bd97..e64e406846a2 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch/BatchCmdletBase.cs +++ b/src/ResourceManager/AzureBatch/Commands.Batch/BatchCmdletBase.cs @@ -15,12 +15,10 @@ using Microsoft.Azure.Batch.Common; using Microsoft.Azure.Batch.Protocol.Models; using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.WindowsAzure; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; using System; using System.Text; +using Microsoft.Azure.Commands.Common.Authentication; using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient; using Microsoft.Azure.Commands.ResourceManager.Common; diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj index 752352fe3a0c..326ee27a2bd9 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj +++ b/src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -64,6 +60,7 @@ ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -84,6 +81,14 @@ False ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + False ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -112,14 +117,6 @@ False ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -344,6 +341,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.cs b/src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.cs index ee40e7a0d6e7..17b344fed277 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.cs +++ b/src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.cs @@ -12,11 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Batch; using Microsoft.Azure.Management.Resources; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Batch.Models { diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/packages.config b/src/ResourceManager/AzureBatch/Commands.Batch/packages.config index 6acc16624739..e5bfcaa3f139 100644 --- a/src/ResourceManager/AzureBatch/Commands.Batch/packages.config +++ b/src/ResourceManager/AzureBatch/Commands.Batch/packages.config @@ -3,7 +3,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/AzureStackAdmin/AzureStackAdmin.sln b/src/ResourceManager/AzureStackAdmin/AzureStackAdmin.sln index 02e822dc775a..517129c839ae 100644 --- a/src/ResourceManager/AzureStackAdmin/AzureStackAdmin.sln +++ b/src/ResourceManager/AzureStackAdmin/AzureStackAdmin.sln @@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureStackAdmin", "Commands.AzureStackAdmin\Commands.AzureStackAdmin.csproj", "{0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -32,6 +34,10 @@ Global {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Debug|Any CPU.Build.0 = Debug|Any CPU {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Release|Any CPU.ActiveCfg = Release|Any CPU {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/AdminApiCmdlet.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/AdminApiCmdlet.cs index a140d5b1a842..59d4ceb08c09 100644 --- a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/AdminApiCmdlet.cs +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/AdminApiCmdlet.cs @@ -19,8 +19,8 @@ namespace Microsoft.AzureStack.Commands using System.Net; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.Azure.Commands.ResourceManager.Common; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure; using Microsoft.AzureStack.Management; diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Commands.AzureStackAdmin.csproj b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Commands.AzureStackAdmin.csproj index 004af72f4fc7..e7c94c5617d3 100644 --- a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Commands.AzureStackAdmin.csproj +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Commands.AzureStackAdmin.csproj @@ -47,6 +47,7 @@ false + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -55,6 +56,18 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + + + ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + True + @@ -80,25 +93,17 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - + False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll - - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/packages.config b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/packages.config index 00c10cb245c9..c30e7289f5f6 100644 --- a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/packages.config +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/packages.config @@ -1,11 +1,12 @@  + - - - - + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/AzureStackStorage.sln b/src/ResourceManager/AzureStackStorage/AzureStackStorage.sln index fd05c633c061..7c34fe6e0274 100644 --- a/src/ResourceManager/AzureStackStorage/AzureStackStorage.sln +++ b/src/ResourceManager/AzureStackStorage/AzureStackStorage.sln @@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -70,6 +72,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Commands.AzureStackStorage.Test.csproj b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Commands.AzureStackStorage.Test.csproj index da50a0fe7d96..0fe3bd7b5a00 100644 --- a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Commands.AzureStackStorage.Test.csproj +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Commands.AzureStackStorage.Test.csproj @@ -52,10 +52,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -75,6 +71,7 @@ False ..\..\..\packages\Microsoft.AzureStack.Management.Storage.0.9.2-preview\lib\net45\Microsoft.AzureStack.Management.Storage.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -87,8 +84,9 @@ False ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True False @@ -126,13 +124,14 @@ + False ..\..\..\packages\System.Spatial.5.6.2\lib\net40\System.Spatial.dll + - ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True ..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll @@ -161,6 +160,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TestsController.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TestsController.cs index 07e41b0a1902..55cbbbed0eb8 100644 --- a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TestsController.cs +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TestsController.cs @@ -40,7 +40,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.Azure.Test; using System; diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/packages.config b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/packages.config index ce325597d4d7..ad34fec832df 100644 --- a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/packages.config +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/packages.config @@ -2,7 +2,6 @@ - @@ -16,7 +15,7 @@ - + diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminCmdlet.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminCmdlet.cs index feb3bda45a9d..a7e2a99d295e 100644 --- a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminCmdlet.cs +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminCmdlet.cs @@ -18,8 +18,8 @@ using System.Net.Security; using Microsoft.Azure; using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.AzureStack.Management.StorageAdmin; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Commands.AzureStackStorage.csproj b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Commands.AzureStackStorage.csproj index 8f5a235bba32..2d8abb91db26 100644 --- a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Commands.AzureStackStorage.csproj +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Commands.AzureStackStorage.csproj @@ -54,8 +54,13 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -93,14 +98,6 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll @@ -111,13 +108,14 @@ ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True - + + False ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll @@ -224,6 +222,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/packages.config b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/packages.config index a2089ea273b6..afa7365cda98 100644 --- a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/packages.config +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/packages.config @@ -2,8 +2,8 @@ - + @@ -14,11 +14,10 @@ + + - - - \ No newline at end of file diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs index af313131569a..917012819b7e 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs @@ -14,7 +14,7 @@ using System; using System.Linq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.ResourceManager.Common { diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs index 238c054030c1..adc3a8611093 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs @@ -19,13 +19,15 @@ using System.Management.Automation.Host; using System.Threading; using Microsoft.Azure.Commands.ResourceManager.Common.Properties; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Internal.Resources; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; using System.Globalization; +using System.Net.Http.Headers; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Rest; namespace Microsoft.Azure.Commands.ResourceManager.Common { @@ -34,6 +36,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Common /// public abstract class AzureRMCmdlet : AzurePSCmdlet { + protected ServiceClientTracingInterceptor _serviceClientTracingInterceptor; /// /// Static constructor for AzureRMCmdlet. /// @@ -55,7 +58,7 @@ public AzureRMCmdlet() () => new ResourceManagementClient( AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(DefaultContext, AzureEnvironment.Endpoint.ResourceManager), DefaultContext.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager)), - s => _debugMessages.Enqueue(s))); + s => DebugMessages.Enqueue(s))); } /// @@ -150,7 +153,7 @@ protected override void InitializeQosEvent() commandAlias = this.MyInvocation.MyCommand.Name; } - QosEvent = new AzurePSQoSEvent() + _qosEvent = new AzurePSQoSEvent() { CommandName = commandAlias, ModuleName = this.GetType().Assembly.GetName().Name, @@ -162,7 +165,7 @@ protected override void InitializeQosEvent() if (this.MyInvocation != null && this.MyInvocation.BoundParameters != null) { - QosEvent.Parameters = string.Join(" ", + _qosEvent.Parameters = string.Join(" ", this.MyInvocation.BoundParameters.Keys.Select( s => string.Format(CultureInfo.InvariantCulture, "-{0} ***", s))); } @@ -172,12 +175,56 @@ protected override void InitializeQosEvent() this.DefaultProfile.Context.Account != null && this.DefaultProfile.Context.Account.Id != null) { - QosEvent.Uid = MetricHelper.GenerateSha256HashString( + _qosEvent.Uid = MetricHelper.GenerateSha256HashString( this.DefaultProfile.Context.Account.Id.ToString()); } else { - QosEvent.Uid = "defaultid"; + _qosEvent.Uid = "defaultid"; + } + } + + protected override void LogCmdletStartInvocationInfo() + { + base.LogCmdletStartInvocationInfo(); + if (DefaultContext != null && DefaultContext.Account != null + && DefaultContext.Account.Id != null) + { + WriteDebugWithTimestamp(string.Format("using account id '{0}'...", + DefaultContext.Account.Id)); + } + } + + protected override void LogCmdletEndInvocationInfo() + { + base.LogCmdletEndInvocationInfo(); + string message = string.Format("{0} end processing.", this.GetType().Name); + WriteDebugWithTimestamp(message); + } + + protected override void SetupDebuggingTraces() + { + base.SetupDebuggingTraces(); + _serviceClientTracingInterceptor = _serviceClientTracingInterceptor + ?? new ServiceClientTracingInterceptor(DebugMessages); + ServiceClientTracing.AddTracingInterceptor(_serviceClientTracingInterceptor); + } + + protected override void TearDownDebuggingTraces() + { + ServiceClientTracingInterceptor.RemoveTracingInterceptor(_serviceClientTracingInterceptor); + _serviceClientTracingInterceptor = null; + base.TearDownDebuggingTraces(); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (disposing && _serviceClientTracingInterceptor != null) + { + ServiceClientTracingInterceptor.RemoveTracingInterceptor(_serviceClientTracingInterceptor); + _serviceClientTracingInterceptor = null; + AzureSession.ClientFactory.RemoveHandler(typeof(RPRegistrationDelegatingHandler)); } } } diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs index e2dc5eed060c..eddf56819c24 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs @@ -13,12 +13,8 @@ // ---------------------------------------------------------------------------------- using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.ResourceManager.Common.Properties; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Azure.Commands.ResourceManager.Common diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRmProfileProvider.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRmProfileProvider.cs new file mode 100644 index 000000000000..46cd4fd11acb --- /dev/null +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRmProfileProvider.cs @@ -0,0 +1,54 @@ +////// ---------------------------------------------------------------------------------- +//// +//// Copyright Microsoft Corporation +//// Licensed under the Apache License, Version 2.0 (the "License"); +//// you may not use this file except in compliance with the License. +//// You may obtain a copy of the License at +//// http://www.apache.org/licenses/LICENSE-2.0 +//// Unless required by applicable law or agreed to in writing, software +//// distributed under the License is distributed on an "AS IS" BASIS, +//// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//// See the License for the specific language governing permissions and +//// limitations under the License. +//// ---------------------------------------------------------------------------------- + +//using Microsoft.Azure.Commands.Common.Authentication; +//using Microsoft.Azure.Commands.Common.Authentication.Models; + +//namespace Microsoft.WindowsAzure.Commands.Common +//{ +// public class AzureRmProfileProvider : IProfileProvider +// { +// private AzureRMProfile _profile; + +// static AzureRmProfileProvider() +// { +// Instance = new AzureRmProfileProvider(); +// } + +// private AzureRmProfileProvider() +// { +// _profile = new AzureRMProfile(); +// } + +// public static AzureRmProfileProvider Instance { get; private set; } +// public AzureRMProfile Profile +// { +// get { return _profile; } +// set +// { +// _profile = value; +// } +// } + +// public void SetTokenCacheForProfile(AzureRMProfile profile) +// { + +// } + +// public void ResetDefaultProfile() +// { +// _profile = new AzureRMProfile(); +// } +// } +//} diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj index 688a606e40a6..c0e1d49926b4 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj @@ -60,10 +60,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -76,8 +72,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -96,10 +96,6 @@ False ..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll True @@ -276,6 +272,7 @@ Resources.resx + Designer @@ -289,6 +286,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/DebugStreamTraceListener.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/DebugStreamTraceListener.cs new file mode 100644 index 000000000000..32750300e184 --- /dev/null +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/DebugStreamTraceListener.cs @@ -0,0 +1,51 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Collections.Concurrent; +using System.Diagnostics; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.WindowsAzure.Commands.Common; + +namespace Microsoft.Azure.Commands.ResourceManager.Common +{ + public class DebugStreamTraceListener : TraceListener + { + public DebugStreamTraceListener(ConcurrentQueue queue) + { + Messages = queue; + } + + public static void AddAdalTracing(DebugStreamTraceListener listener) + { + AdalTrace.TraceSource.Listeners.Add(listener); + AdalTrace.TraceSource.Switch.Level = SourceLevels.All; + } + + public ConcurrentQueue Messages; + public override void Write(string message) + { + Messages.CheckAndEnqueue(message); + } + + public override void WriteLine(string message) + { + Write(message + "\n"); + } + + public static void RemoveAdalTracing(DebugStreamTraceListener listener) + { + AdalTrace.TraceSource.Listeners.Remove(listener); + } + } +} diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/FileSystemAdapter.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/FileSystemAdapter.cs new file mode 100644 index 000000000000..20454c573027 --- /dev/null +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/FileSystemAdapter.cs @@ -0,0 +1,36 @@ + // ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Azure.Commands.Common.Authentication; + +namespace Microsoft.WindowsAzure.Commands.Common +{ + public class FileSystemAdapter : IFileSystem + { + public string ReadFile(string path) + { + return AzureSession.DataStore.ReadFileAsText(path); + } + + public void WriteFile(string path, string contents) + { + AzureSession.DataStore.WriteFile(path, contents); + } + } +} diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs index 62e6f4e8cdca..1eeae98c8b5b 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs @@ -22,7 +22,7 @@ using Microsoft.Azure.Management.Internal.Resources.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -namespace Microsoft.Azure.Common.Authentication.Models +namespace Microsoft.Azure.Commands.Common.Authentication.Models { public class RPRegistrationDelegatingHandler : DelegatingHandler, ICloneable { diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/ServiceClientTracingInterceptor.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/ServiceClientTracingInterceptor.cs new file mode 100644 index 000000000000..9bdb0565cbe7 --- /dev/null +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/ServiceClientTracingInterceptor.cs @@ -0,0 +1,76 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Rest; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using Microsoft.WindowsAzure.Commands.Common; +namespace Microsoft.Azure.Commands.ResourceManager.Common +{ + public class ServiceClientTracingInterceptor : IServiceClientTracingInterceptor + { + public ServiceClientTracingInterceptor(ConcurrentQueue queue) + { + MessageQueue = queue; + } + + public ConcurrentQueue MessageQueue { get; private set; } + + public void Configuration(string source, string name, string value) + { + // Ignore + } + + public void EnterMethod(string invocationId, object instance, string method, IDictionary parameters) + { + // Ignore + } + + public void ExitMethod(string invocationId, object returnValue) + { + // Ignore + } + + public void Information(string message) + { + MessageQueue.CheckAndEnqueue(message); + } + + public void ReceiveResponse(string invocationId, System.Net.Http.HttpResponseMessage response) + { + string responseAsString = response == null ? string.Empty : response.AsFormattedString(); + MessageQueue.CheckAndEnqueue(responseAsString); + } + + public void SendRequest(string invocationId, System.Net.Http.HttpRequestMessage request) + { + string requestAsString = request == null ? string.Empty : request.AsFormattedString(); + MessageQueue.CheckAndEnqueue(requestAsString); + } + + public void TraceError(string invocationId, Exception exception) + { + // Ignore + } + + public static void RemoveTracingInterceptor(ServiceClientTracingInterceptor interceptor) + { + if (interceptor != null) + { + ServiceClientTracing.RemoveTracingInterceptor(interceptor); + } + } + } +} diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config b/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config index d377f32fdab6..64093cf24cf1 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config @@ -4,15 +4,14 @@ - - - + + \ No newline at end of file diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj index e1232eeaf97c..dbd224c0999b 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj @@ -46,10 +46,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -72,12 +68,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -167,14 +163,23 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common + + {cff09e81-1e31-444e-b4d4-a21e946c29e2} + Commands.ServiceManagement.Common + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} Commands.ResourceManager.Common + \ No newline at end of file diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs index 7f8997c82a52..9ffaf56104bd 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs @@ -13,9 +13,6 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Test; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; @@ -29,6 +26,9 @@ using System.Management.Automation; using System.Reflection; using System.Security.Cryptography.X509Certificates; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.ScenarioTest diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs index 47bf4b27e527..7e5f47d499ad 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessToken.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessTokenProvider.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessTokenProvider.cs index e94b91ba1538..fdf696ffb4c2 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessTokenProvider.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockAccessTokenProvider.cs @@ -13,9 +13,9 @@ // ---------------------------------------------------------------------------------- using System.Security; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.Azure.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { @@ -42,9 +42,16 @@ public IAccessToken GetAccessToken(AdalConfiguration config, ShowDialog promptBe return this.accessToken; } + IAccessToken ITokenProvider.GetAccessTokenWithCertificate(AdalConfiguration config, string principalId, string certificateThumbprint, + AzureAccount.AccountType credentialType) + { + return GetAccessTokenWithCertificate(config, principalId, certificateThumbprint, credentialType); + } + public IAccessToken GetAccessTokenWithCertificate(AdalConfiguration config, string principalId, string certificateThumbprint, AzureAccount.AccountType credentialType) { return this.accessToken; } + } } \ No newline at end of file diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockCertificateAuthenticationFactory.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockCertificateAuthenticationFactory.cs index 925cb99cea8e..cf366a7b3fe8 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockCertificateAuthenticationFactory.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockCertificateAuthenticationFactory.cs @@ -13,10 +13,10 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using System.Security; using System.Security.Cryptography.X509Certificates; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockClientFactory.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockClientFactory.cs index a50fbbfcd090..7541d4ba702f 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockClientFactory.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockClientFactory.cs @@ -23,12 +23,12 @@ using System.Threading.Tasks; using Hyak.Common; using Microsoft.Azure.Test.HttpRecorder; -using Microsoft.Azure.Common; -using Microsoft.Azure.Common.Authentication.Factories; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication; using Microsoft.Azure; using System.IO; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs index 96e05c53f3ee..255e57e4a6ea 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockTokenAuthenticationFactory.cs @@ -13,11 +13,11 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Rest; using System; using System.Security; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common.Test.Mocks { diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/ProfileClient.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/ProfileClient.cs new file mode 100644 index 000000000000..2c93654794db --- /dev/null +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/ProfileClient.cs @@ -0,0 +1,1133 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Security; +using System.Security.Cryptography.X509Certificates; +using Hyak.Common; +using Microsoft.Azure; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.WindowsAzure.Commands.Common.Properties; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.WindowsAzure.Subscriptions; + +namespace Microsoft.WindowsAzure.Commands.ScenarioTest +{ + /// + /// Convenience client for azure profile and subscriptions. + /// + public class ProfileClient + { + public AzureSMProfile Profile { get; private set; } + + public Action WarningLog; + + public Action DebugLog; + + private void WriteDebugMessage(string message) + { + if (DebugLog != null) + { + DebugLog(message); + } + } + + private void WriteWarningMessage(string message) + { + if (WarningLog != null) + { + WarningLog(message); + } + } + + private void UpgradeProfile() + { + string oldProfileFilePath = Path.Combine(AzureSession.ProfileDirectory, AzureSession.OldProfileFile); + string oldProfileFilePathBackup = Path.Combine(AzureSession.ProfileDirectory, AzureSession.OldProfileFileBackup); + string newProfileFilePath = Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile); + if (AzureSession.DataStore.FileExists(oldProfileFilePath)) + { + string oldProfilePath = Path.Combine(AzureSession.ProfileDirectory, + AzureSession.OldProfileFile); + + try + { + // Try to backup old profile + try + { + AzureSession.DataStore.CopyFile(oldProfilePath, oldProfileFilePathBackup); + } + catch + { + // Ignore any errors here + } + + AzureSMProfile oldProfile = new AzureSMProfile(oldProfilePath); + + if (AzureSession.DataStore.FileExists(newProfileFilePath)) + { + // Merge profile files + AzureSMProfile newProfile = new AzureSMProfile(newProfileFilePath); + foreach (var environment in newProfile.Environments.Values) + { + oldProfile.Environments[environment.Name] = environment; + } + foreach (var subscription in newProfile.Subscriptions.Values) + { + oldProfile.Subscriptions[subscription.Id] = subscription; + } + AzureSession.DataStore.DeleteFile(newProfileFilePath); + } + + // If there were no load errors - delete backup file + if (oldProfile.ProfileLoadErrors.Count == 0) + { + try + { + AzureSession.DataStore.DeleteFile(oldProfileFilePathBackup); + } + catch + { + // Give up + } + } + + // Save the profile to the disk + oldProfile.Save(); + + // Rename WindowsAzureProfile.xml to WindowsAzureProfile.json + AzureSession.DataStore.RenameFile(oldProfilePath, newProfileFilePath); + + } + catch + { + // Something really bad happened - try to delete the old profile + try + { + AzureSession.DataStore.DeleteFile(oldProfilePath); + } + catch + { + // Ignore any errors + } + } + + // In case that we changed a disk profile, reload it + if (Profile != null && Profile.ProfilePath == newProfileFilePath) + { + Profile = new AzureSMProfile(Profile.ProfilePath); + } + } + } + + public ProfileClient(AzureSMProfile profile) + { + Profile = profile; + WarningLog = (s) => Debug.WriteLine(s); + + try + { + UpgradeProfile(); + } + catch + { + // Should never fail in constructor + } + } + + #region Profile management + + /// + /// Initializes AzureSMProfile using passed in certificate. The certificate + /// is imported into a certificate store. + /// + /// Environment object. + /// Subscription Id + /// Certificate to use with profile. + /// Storage account name (optional). + /// + public void InitializeProfile(AzureEnvironment environment, Guid subscriptionId, X509Certificate2 certificate, + string storageAccount) + { + if (environment == null) + { + throw new ArgumentNullException("environment"); + } + if (certificate == null) + { + throw new ArgumentNullException("certificate"); + } + + // Add environment if not public + if (!AzureEnvironment.PublicEnvironments.ContainsKey(environment.Name)) + { + AddOrSetEnvironment(environment); + } + + // Add account + var azureAccount = new AzureAccount + { + Id = certificate.Thumbprint, + Type = AzureAccount.AccountType.Certificate + }; + azureAccount.Properties[AzureAccount.Property.Subscriptions] = subscriptionId.ToString(); + ImportCertificate(certificate); + AddOrSetAccount(azureAccount); + + // Add subscription + var azureSubscription = new AzureSubscription + { + Id = subscriptionId, + Name = subscriptionId.ToString(), + Environment = environment.Name + }; + if (!string.IsNullOrEmpty(storageAccount)) + { + azureSubscription.Properties[AzureSubscription.Property.StorageAccount] = storageAccount; + } + azureSubscription.Properties[AzureSubscription.Property.Default] = "True"; + azureSubscription.Account = certificate.Thumbprint; + AddOrSetSubscription(azureSubscription); + } + + /// + /// Initializes AzureSMProfile using passed in access token. + /// + /// Environment object. + /// Subscription Id + /// AccessToken to use with profile. + /// AccountId for the new account. + /// Storage account name (optional). + /// + public void InitializeProfile(AzureEnvironment environment, Guid subscriptionId, string accessToken, + string accountId, string storageAccount) + { + if (environment == null) + { + throw new ArgumentNullException("environment"); + } + if (accessToken == null) + { + throw new ArgumentNullException("accessToken"); + } + + // Add environment if not public + if (!AzureEnvironment.PublicEnvironments.ContainsKey(environment.Name)) + { + AddOrSetEnvironment(environment); + } + + // Add account + var azureAccount = new AzureAccount + { + Id = accountId, + Type = AzureAccount.AccountType.AccessToken + }; + azureAccount.Properties[AzureAccount.Property.Subscriptions] = subscriptionId.ToString(); + azureAccount.Properties[AzureAccount.Property.AccessToken] = accessToken; + AddOrSetAccount(azureAccount); + + // Add subscription + var azureSubscription = new AzureSubscription + { + Id = subscriptionId, + Name = subscriptionId.ToString(), + Environment = environment.Name + }; + if (!string.IsNullOrEmpty(storageAccount)) + { + azureSubscription.Properties[AzureSubscription.Property.StorageAccount] = storageAccount; + } + azureSubscription.Properties[AzureSubscription.Property.Default] = "True"; + azureSubscription.Account = accountId; + AddOrSetSubscription(azureSubscription); + } + + /// + /// Initializes AzureSMProfile using passed in account and optional password. + /// + /// Environment object. + /// Subscription Id + /// Azure account with AD username and tenant. + /// AD password (optional). + /// Storage account name (optional). + /// + public void InitializeProfile(AzureEnvironment environment, Guid subscriptionId, AzureAccount account, + SecureString password, string storageAccount) + { + if (environment == null) + { + throw new ArgumentNullException("environment"); + } + if (account == null) + { + throw new ArgumentNullException("account"); + } + + // Add environment if not public + if (!AzureEnvironment.PublicEnvironments.ContainsKey(environment.Name)) + { + AddOrSetEnvironment(environment); + } + + // Add account + var azureAccount = AddAccountAndLoadSubscriptions(account, environment, password); + + // Add subscription + if (!azureAccount.HasSubscription(subscriptionId)) + { + throw new ArgumentException(string.Format(Resources.SubscriptionIdNotFoundMessage, subscriptionId)); + } + var azureSubscription = GetSubscription(subscriptionId); + if (!string.IsNullOrEmpty(storageAccount)) + { + azureSubscription.Properties[AzureSubscription.Property.StorageAccount] = storageAccount; + } + AddOrSetSubscription(azureSubscription); + } + #endregion + + #region Account management + + public AzureAccount AddAccountAndLoadSubscriptions(AzureAccount account, AzureEnvironment environment, SecureString password) + { + if (environment == null) + { + throw new ArgumentNullException("environment"); + } + + if (account == null) + { + throw new ArgumentNullException("account"); + } + + var subscriptionsFromServer = ListSubscriptionsFromServer( + account, + environment, + password, + password == null ? ShowDialog.Always : ShowDialog.Never).ToList(); + + // If account id is null the login failed + if (account.Id != null) + { + // Update back Profile.Subscriptions + foreach (var subscription in subscriptionsFromServer) + { + AddOrSetSubscription(subscription); + } + + if (Profile.DefaultSubscription == null) + { + var firstSubscription = Profile.Subscriptions.Values.FirstOrDefault(); + if (firstSubscription != null) + { + SetSubscriptionAsDefault(firstSubscription.Name, firstSubscription.Account); + } + } + + return Profile.Accounts[account.Id]; + } + else + { + return null; + } + } + + public AzureAccount AddOrSetAccount(AzureAccount account) + { + if (account == null) + { + throw new ArgumentNullException("account", Resources.AccountNeedsToBeSpecified); + } + + if (Profile.Accounts.ContainsKey(account.Id)) + { + Profile.Accounts[account.Id] = + MergeAccountProperties(account, Profile.Accounts[account.Id]); + } + else + { + Profile.Accounts[account.Id] = account; + } + + return Profile.Accounts[account.Id]; + } + + public AzureAccount GetAccountOrDefault(string accountName) + { + if (string.IsNullOrEmpty(accountName)) + { + return Profile.Context.Account; + } + else if (Profile.Accounts.ContainsKey(accountName)) + { + return Profile.Accounts[accountName]; + } + else + { + throw new ArgumentException(string.Format("Account with name '{0}' does not exist.", accountName), "accountName"); + } + } + + public AzureAccount GetAccountOrNull(string accountName) + { + if (string.IsNullOrEmpty(accountName)) + { + throw new ArgumentNullException("accountName"); + } + + if (Profile.Accounts.ContainsKey(accountName)) + { + return Profile.Accounts[accountName]; + } + else + { + return null; + } + } + + public AzureAccount GetAccount(string accountName) + { + var account = GetAccountOrNull(accountName); + + if (account == null) + { + throw new ArgumentException(string.Format("Account with name '{0}' does not exist.", accountName), "accountName"); + } + + return account; + } + + public IEnumerable ListAccounts(string accountName) + { + List accounts = new List(); + + if (!string.IsNullOrEmpty(accountName)) + { + if (Profile.Accounts.ContainsKey(accountName)) + { + accounts.Add(Profile.Accounts[accountName]); + } + } + else + { + accounts = Profile.Accounts.Values.ToList(); + } + + return accounts; + } + + public AzureAccount RemoveAccount(string accountId) + { + if (string.IsNullOrEmpty(accountId)) + { + throw new ArgumentNullException("accountId", Resources.UserNameNeedsToBeSpecified); + } + + if (!Profile.Accounts.ContainsKey(accountId)) + { + throw new ArgumentException(Resources.UserNameIsNotValid, "accountId"); + } + + AzureAccount account = Profile.Accounts[accountId]; + Profile.Accounts.Remove(account.Id); + + foreach (AzureSubscription subscription in account.GetSubscriptions(Profile).ToArray()) + { + if (string.Equals(subscription.Account, accountId, StringComparison.InvariantCultureIgnoreCase)) + { + AzureAccount remainingAccount = GetSubscriptionAccount(subscription.Id); + // There's no default account to use, remove the subscription. + if (remainingAccount == null) + { + // Warn the user if the removed subscription is the default one. + if (subscription.IsPropertySet(AzureSubscription.Property.Default)) + { + Debug.Assert(subscription.Equals(Profile.DefaultSubscription)); + WriteWarningMessage(Resources.RemoveDefaultSubscription); + } + + Profile.Subscriptions.Remove(subscription.Id); + } + else + { + subscription.Account = remainingAccount.Id; + AddOrSetSubscription(subscription); + } + } + } + + return account; + } + + private AzureAccount GetSubscriptionAccount(Guid subscriptionId) + { + List accounts = ListSubscriptionAccounts(subscriptionId); + AzureAccount account = accounts.FirstOrDefault(a => a.Type != AzureAccount.AccountType.Certificate); + + if (account != null) + { + // Found a non-certificate account. + return account; + } + + // Use certificate account if its there. + account = accounts.FirstOrDefault(); + + return account; + } + + #endregion + + #region Subscription management + + public AzureSubscription AddOrSetSubscription(AzureSubscription subscription) + { + if (subscription == null) + { + throw new ArgumentNullException("subscription", Resources.SubscriptionNeedsToBeSpecified); + } + if (subscription.Environment == null) + { + throw new ArgumentNullException("subscription.Environment", Resources.EnvironmentNeedsToBeSpecified); + } + // Validate environment + GetEnvironmentOrDefault(subscription.Environment); + + if (Profile.Subscriptions.ContainsKey(subscription.Id)) + { + Profile.Subscriptions[subscription.Id] = MergeSubscriptionProperties(subscription, Profile.Subscriptions[subscription.Id]); + } + else + { + Debug.Assert(!string.IsNullOrEmpty(subscription.Account)); + if (!Profile.Accounts.ContainsKey(subscription.Account)) + { + throw new KeyNotFoundException(string.Format("The specified account {0} does not exist in profile accounts", subscription.Account)); + } + + Profile.Subscriptions[subscription.Id] = subscription; + } + + return Profile.Subscriptions[subscription.Id]; + } + + public AzureSubscription RemoveSubscription(string name) + { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException("name", Resources.SubscriptionNameNeedsToBeSpecified); + } + + var subscription = Profile.Subscriptions.Values.FirstOrDefault(s => s.Name == name); + + if (subscription == null) + { + throw new ArgumentException(string.Format(Resources.SubscriptionNameNotFoundMessage, name), "name"); + } + else + { + return RemoveSubscription(subscription.Id); + } + } + + public AzureSubscription RemoveSubscription(Guid id) + { + if (!Profile.Subscriptions.ContainsKey(id)) + { + throw new ArgumentException(string.Format(Resources.SubscriptionIdNotFoundMessage, id), "id"); + } + + var subscription = Profile.Subscriptions[id]; + + if (subscription.IsPropertySet(AzureSubscription.Property.Default)) + { + Debug.Assert(Profile.DefaultSubscription == subscription); + WriteWarningMessage(Resources.RemoveDefaultSubscription); + } + + Profile.Subscriptions.Remove(id); + + // Remove this subscription from its associated AzureAccounts + List accounts = ListSubscriptionAccounts(id); + + foreach (AzureAccount account in accounts) + { + account.RemoveSubscription(id); + if (!account.IsPropertySet(AzureAccount.Property.Subscriptions)) + { + Profile.Accounts.Remove(account.Id); + } + } + + return subscription; + } + + public List RefreshSubscriptions(AzureEnvironment environment) + { + if (environment == null) + { + throw new ArgumentNullException("environment"); + } + + var subscriptionsFromServer = ListSubscriptionsFromServerForAllAccounts(environment); + + // Update back Profile.Subscriptions + foreach (var subscription in subscriptionsFromServer) + { + // Resetting back default account + if (Profile.Subscriptions.ContainsKey(subscription.Id)) + { + subscription.Account = Profile.Subscriptions[subscription.Id].Account; + } + AddOrSetSubscription(subscription); + } + + return Profile.Subscriptions.Values.ToList(); + } + + public AzureSubscription GetSubscription(Guid id) + { + if (Profile.Subscriptions.ContainsKey(id)) + { + return Profile.Subscriptions[id]; + } + else + { + throw new ArgumentException(string.Format(Resources.SubscriptionIdNotFoundMessage, id), "id"); + } + } + + public AzureSubscription GetSubscription(string name) + { + AzureSubscription subscription = Profile.Subscriptions.Values + .FirstOrDefault(s => s.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); + + if (subscription != null) + { + return subscription; + } + else + { + throw new ArgumentException(string.Format(Resources.SubscriptionNameNotFoundMessage, name), "name"); + } + } + + public AzureSubscription SetSubscriptionAsDefault(string name, string accountName) + { + if (name == null) + { + throw new ArgumentException(string.Format(Resources.InvalidSubscriptionName, name), "name"); + } + + var subscription = Profile.Subscriptions.Values.FirstOrDefault(s => s.Name == name); + + if (subscription == null) + { + throw new ArgumentException(string.Format(Resources.SubscriptionNameNotFoundMessage, name), "name"); + } + + return SetSubscriptionAsDefault(subscription.Id, accountName); + } + + public AzureSubscription SetSubscriptionAsDefault(Guid id, string accountName) + { + AzureSubscription subscription = GetSubscription(id); + + if (subscription != null) + { + if (subscription.IsPropertySet(AzureSubscription.Property.StorageAccount)) + { + subscription.SetProperty(AzureSubscription.Property.StorageAccount, null); + } + + Profile.DefaultSubscription = subscription; + Profile.DefaultSubscription.Account = accountName; + } + + return subscription; + } + + public void ClearAll() + { + Profile.Accounts.Clear(); + Profile.DefaultSubscription = null; + Profile.Environments.Clear(); + Profile.Subscriptions.Clear(); + Profile.Save(); + + AzureSession.TokenCache.Clear(); + } + + public void ClearDefaultSubscription() + { + Profile.DefaultSubscription = null; + } + + public void ImportCertificate(X509Certificate2 certificate) + { + AzureSession.DataStore.AddCertificate(certificate); + } + + public List ListSubscriptionAccounts(Guid subscriptionId) + { + return Profile.Accounts.Where(a => a.Value.HasSubscription(subscriptionId)) + .Select(a => a.Value).ToList(); + } + + private IEnumerable ListSubscriptionsFromServerForAllAccounts(AzureEnvironment environment) + { + // Get all AD accounts and iterate + var accountNames = Profile.Accounts.Keys; + + List subscriptions = new List(); + + foreach (var accountName in accountNames.ToArray()) + { + var account = Profile.Accounts[accountName]; + + if (account.Type != AzureAccount.AccountType.Certificate) + { + subscriptions.AddRange(ListSubscriptionsFromServer(account, environment, null, ShowDialog.Never)); + } + + AddOrSetAccount(account); + } + + if (subscriptions.Any()) + { + return subscriptions; + } + else + { + return new AzureSubscription[0]; + } + } + + private IEnumerable ListSubscriptionsFromServer(AzureAccount account, AzureEnvironment environment, SecureString password, ShowDialog promptBehavior) + { + string[] tenants = null; + try + { + if (!account.IsPropertySet(AzureAccount.Property.Tenants)) + { + tenants = LoadAccountTenants(account, environment, password, promptBehavior); + } + else + { + var storedTenants = account.GetPropertyAsArray(AzureAccount.Property.Tenants); + if (account.Type == AzureAccount.AccountType.User && storedTenants.Count() == 1) + { + TracingAdapter.Information(Resources.AuthenticatingForSingleTenant, account.Id, storedTenants[0]); + AzureSession.AuthenticationFactory.Authenticate(account, environment, storedTenants[0], password, + promptBehavior); + } + } + } + catch (AadAuthenticationException aadEx) + { + WriteOrThrowAadExceptionMessage(aadEx); + return new AzureSubscription[0]; + } + + try + { + tenants = tenants ?? account.GetPropertyAsArray(AzureAccount.Property.Tenants); + List rdfeSubscriptions = ListServiceManagementSubscriptions(account, environment, + password, ShowDialog.Never, tenants).ToList(); + + // Set user ID + foreach (var subscription in rdfeSubscriptions) + { + account.SetOrAppendProperty(AzureAccount.Property.Subscriptions, subscription.Id.ToString()); + } + + if (rdfeSubscriptions.Any()) + { + return rdfeSubscriptions; + } + else + { + return new AzureSubscription[0]; + } + } + catch (AadAuthenticationException aadEx) + { + WriteOrThrowAadExceptionMessage(aadEx); + return new AzureSubscription[0]; + } + } + + private string[] LoadAccountTenants(AzureAccount account, AzureEnvironment environment, SecureString password, ShowDialog promptBehavior) + { + var commonTenantToken = AzureSession.AuthenticationFactory.Authenticate(account, environment, + AuthenticationFactory.CommonAdTenant, password, promptBehavior); + + using (SubscriptionClient SubscriptionClient = AzureSession.ClientFactory + .CreateCustomClient( + new TokenCloudCredentials(commonTenantToken.AccessToken), + environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement))) + { + var subscriptionListResult = SubscriptionClient.Subscriptions.List(); + return subscriptionListResult.Subscriptions.Select(s => s.ActiveDirectoryTenantId).Distinct().ToArray(); + } + } + + private AzureSubscription MergeSubscriptionProperties(AzureSubscription subscription1, AzureSubscription subscription2) + { + if (subscription1 == null || subscription2 == null) + { + throw new ArgumentNullException("subscription1"); + } + if (subscription1.Id != subscription2.Id) + { + throw new ArgumentException("Subscription Ids do not match."); + } + AzureSubscription mergedSubscription = new AzureSubscription + { + Id = subscription1.Id, + Name = subscription1.Name, + Environment = subscription1.Environment, + State = (subscription1.State != null && + subscription1.State.Equals(subscription2.State, StringComparison.OrdinalIgnoreCase)) ? + subscription1.State: null, + Account = subscription1.Account ?? subscription2.Account + }; + + // Merge all properties + foreach (AzureSubscription.Property property in Enum.GetValues(typeof(AzureSubscription.Property))) + { + string propertyValue = subscription1.GetProperty(property) ?? subscription2.GetProperty(property); + if (propertyValue != null) + { + mergedSubscription.Properties[property] = propertyValue; + } + } + + // Merge RegisteredResourceProviders + var registeredProviders = subscription1.GetPropertyAsArray(AzureSubscription.Property.RegisteredResourceProviders) + .Union(subscription2.GetPropertyAsArray(AzureSubscription.Property.RegisteredResourceProviders), StringComparer.CurrentCultureIgnoreCase); + + mergedSubscription.SetProperty(AzureSubscription.Property.RegisteredResourceProviders, registeredProviders.ToArray()); + + // Merge Tenants + var tenants = subscription1.GetPropertyAsArray(AzureSubscription.Property.Tenants) + .Union(subscription2.GetPropertyAsArray(AzureSubscription.Property.Tenants), StringComparer.CurrentCultureIgnoreCase); + + mergedSubscription.SetProperty(AzureSubscription.Property.Tenants, tenants.ToArray()); + + return mergedSubscription; + } + + private AzureEnvironment MergeEnvironmentProperties(AzureEnvironment environment1, AzureEnvironment environment2) + { + if (environment1 == null || environment2 == null) + { + throw new ArgumentNullException("environment1"); + } + if (!string.Equals(environment1.Name, environment2.Name, StringComparison.InvariantCultureIgnoreCase)) + { + throw new ArgumentException("Environment names do not match."); + } + AzureEnvironment mergedEnvironment = new AzureEnvironment + { + Name = environment1.Name + }; + + // Merge all properties + foreach (AzureEnvironment.Endpoint property in Enum.GetValues(typeof(AzureEnvironment.Endpoint))) + { + string propertyValue = environment1.GetEndpoint(property) ?? environment2.GetEndpoint(property); + if (propertyValue != null) + { + mergedEnvironment.Endpoints[property] = propertyValue; + } + } + + return mergedEnvironment; + } + + private AzureAccount MergeAccountProperties(AzureAccount account1, AzureAccount account2) + { + if (account1 == null || account2 == null) + { + throw new ArgumentNullException("account1"); + } + if (!string.Equals(account1.Id, account2.Id, StringComparison.InvariantCultureIgnoreCase)) + { + throw new ArgumentException("Account Ids do not match."); + } + if (account1.Type != account2.Type) + { + throw new ArgumentException("Account1 types do not match."); + } + AzureAccount mergeAccount = new AzureAccount + { + Id = account1.Id, + Type = account1.Type + }; + + // Merge all properties + foreach (AzureAccount.Property property in Enum.GetValues(typeof(AzureAccount.Property))) + { + string propertyValue = account1.GetProperty(property) ?? account2.GetProperty(property); + if (propertyValue != null) + { + mergeAccount.Properties[property] = propertyValue; + } + } + + // Merge Tenants + var tenants = account1.GetPropertyAsArray(AzureAccount.Property.Tenants) + .Union(account2.GetPropertyAsArray(AzureAccount.Property.Tenants), StringComparer.CurrentCultureIgnoreCase); + + mergeAccount.SetProperty(AzureAccount.Property.Tenants, tenants.ToArray()); + + // Merge Subscriptions + var subscriptions = account1.GetPropertyAsArray(AzureAccount.Property.Subscriptions) + .Union(account2.GetPropertyAsArray(AzureAccount.Property.Subscriptions), StringComparer.CurrentCultureIgnoreCase); + + mergeAccount.SetProperty(AzureAccount.Property.Subscriptions, subscriptions.ToArray()); + + return mergeAccount; + } + + private void CopyAccount(AzureAccount sourceAccount, AzureAccount targetAccount) + { + targetAccount.Id = sourceAccount.Id; + targetAccount.Type = sourceAccount.Type; + } + + private IEnumerable ListServiceManagementSubscriptions(AzureAccount account, AzureEnvironment environment, SecureString password, ShowDialog promptBehavior, string[] tenants) + { + List result = new List(); + + if (!environment.IsEndpointSet(AzureEnvironment.Endpoint.ServiceManagement)) + { + return result; + } + + foreach (var tenant in tenants) + { + try + { + var tenantAccount = new AzureAccount(); + CopyAccount(account, tenantAccount); + var tenantToken = AzureSession.AuthenticationFactory.Authenticate(tenantAccount, environment, tenant, password, ShowDialog.Never); + if (string.Equals(tenantAccount.Id, account.Id, StringComparison.InvariantCultureIgnoreCase)) + { + tenantAccount = account; + } + + tenantAccount.SetOrAppendProperty(AzureAccount.Property.Tenants, new string[] { tenant }); + using (var subscriptionClient = AzureSession.ClientFactory.CreateCustomClient( + new TokenCloudCredentials(tenantToken.AccessToken), + environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement))) + { + var subscriptionListResult = subscriptionClient.Subscriptions.List(); + foreach (var subscription in subscriptionListResult.Subscriptions) + { + // only add the subscription if it's actually in this tenant + if (subscription.ActiveDirectoryTenantId == tenant) + { + AzureSubscription psSubscription = new AzureSubscription + { + Id = new Guid(subscription.SubscriptionId), + Name = subscription.SubscriptionName, + Environment = environment.Name + }; + psSubscription.SetProperty(AzureSubscription.Property.Tenants, + subscription.ActiveDirectoryTenantId); + psSubscription.Account = tenantAccount.Id; + tenantAccount.SetOrAppendProperty(AzureAccount.Property.Subscriptions, + new string[] { psSubscription.Id.ToString() }); + result.Add(psSubscription); + } + } + } + + AddOrSetAccount(tenantAccount); + } + catch (CloudException cEx) + { + WriteOrThrowAadExceptionMessage(cEx); + } + catch (AadAuthenticationException aadEx) + { + WriteOrThrowAadExceptionMessage(aadEx); + } + } + + return result; + } + + private void WriteOrThrowAadExceptionMessage(AadAuthenticationException aadEx) + { + if (aadEx is AadAuthenticationFailedWithoutPopupException) + { + WriteDebugMessage(aadEx.Message); + } + else if (aadEx is AadAuthenticationCanceledException) + { + WriteWarningMessage(aadEx.Message); + } + else + { + throw aadEx; + } + } + + private void WriteOrThrowAadExceptionMessage(CloudException aadEx) + { + WriteDebugMessage(aadEx.Message); + } + + #endregion + + #region Environment management + + public AzureEnvironment GetEnvironmentOrDefault(string name) + { + if (string.IsNullOrEmpty(name) && + Profile.DefaultSubscription == null) + { + return AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud]; + } + else if (string.IsNullOrEmpty(name) && + Profile.DefaultSubscription != null) + { + return Profile.Context.Environment; + } + else if (Profile.Environments.ContainsKey(name)) + { + return Profile.Environments[name]; + } + else + { + throw new ArgumentException(string.Format(Resources.EnvironmentNotFound, name)); + } + } + + public AzureEnvironment GetEnvironment(string name, string serviceEndpoint, string resourceEndpoint) + { + if (serviceEndpoint == null) + { + // Set to invalid value + serviceEndpoint = Guid.NewGuid().ToString(); + } + + if (resourceEndpoint == null) + { + // Set to invalid value + resourceEndpoint = Guid.NewGuid().ToString(); + } + + if (name != null) + { + if (Profile.Environments.ContainsKey(name)) + { + return Profile.Environments[name]; + } + else + { + return null; + } + } + else + { + return Profile.Environments.Values.FirstOrDefault(e => + e.IsEndpointSetToValue(AzureEnvironment.Endpoint.ServiceManagement, serviceEndpoint) || + e.IsEndpointSetToValue(AzureEnvironment.Endpoint.ResourceManager, resourceEndpoint)); + } + } + + public List ListEnvironments(string name) + { + if (string.IsNullOrEmpty(name)) + { + return Profile.Environments.Values.ToList(); + } + else if (Profile.Environments.ContainsKey(name)) + { + return new[] { Profile.Environments[name] }.ToList(); + } + else + { + return new AzureEnvironment[0].ToList(); + } + } + + public AzureEnvironment RemoveEnvironment(string name) + { + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentNullException("name", Resources.EnvironmentNameNeedsToBeSpecified); + } + if (AzureEnvironment.PublicEnvironments.ContainsKey(name)) + { + throw new ArgumentException(Resources.RemovingDefaultEnvironmentsNotSupported, "name"); + } + + if (Profile.Environments.ContainsKey(name)) + { + var environment = Profile.Environments[name]; + var subscriptions = Profile.Subscriptions.Values.Where(s => s.Environment == name).ToArray(); + foreach (var subscription in subscriptions) + { + RemoveSubscription(subscription.Id); + } + Profile.Environments.Remove(name); + return environment; + } + else + { + throw new ArgumentException(string.Format(Resources.EnvironmentNotFound, name), "name"); + } + } + + public AzureEnvironment AddOrSetEnvironment(AzureEnvironment environment) + { + if (environment == null) + { + throw new ArgumentNullException("environment", Resources.EnvironmentNeedsToBeSpecified); + } + + if (AzureEnvironment.PublicEnvironments.ContainsKey(environment.Name)) + { + throw new InvalidOperationException( + string.Format(Resources.ChangingDefaultEnvironmentNotSupported, "environment")); + } + + if (Profile.Environments.ContainsKey(environment.Name)) + { + Profile.Environments[environment.Name] = + MergeEnvironmentProperties(environment, Profile.Environments[environment.Name]); + } + else + { + Profile.Environments[environment.Name] = environment; + } + + return Profile.Environments[environment.Name]; + } + #endregion + } +} \ No newline at end of file diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/RMTestBase.cs b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/RMTestBase.cs index 4fed510affcf..73c734fce212 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/RMTestBase.cs +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/RMTestBase.cs @@ -14,14 +14,13 @@ using System; using System.Collections.Generic; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System.Threading; using System.IO; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config index 17d0c605e03e..7c7ea25a2c34 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config @@ -2,7 +2,6 @@ - @@ -12,8 +11,8 @@ - - + + diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj b/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj index caa4224bbfb4..4ec67785cabd 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj +++ b/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj @@ -50,10 +50,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -67,13 +63,12 @@ ..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll - - False - ..\..\..\packages\Microsoft.Azure.Management.Compute.11.1.1-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll + + ..\..\..\packages\Microsoft.Azure.Management.Compute.11.2.0-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll True - ..\..\..\packages\Microsoft.Azure.Management.Network.3.1.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll + ..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll True @@ -86,8 +81,8 @@ ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.4.0-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.0-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True @@ -98,19 +93,16 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.2.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll True @@ -192,6 +184,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} Commands.ResourceManager.Common @@ -392,9 +388,6 @@ Always - - Always - Always diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/Common/ComputeTestController.cs b/src/ResourceManager/Compute/Commands.Compute.Test/Common/ComputeTestController.cs index f9359ebd4aff..0b64df0253cc 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/Common/ComputeTestController.cs +++ b/src/ResourceManager/Compute/Commands.Compute.Test/Common/ComputeTestController.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using RestTestFramework = Microsoft.Rest.ClientRuntime.Azure.TestFramework; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.cs b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.cs index 77ce30232c0b..a70a2825153f 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.cs +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.cs @@ -152,7 +152,7 @@ public void TestVirtualMachineWithEmptyAuc() ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineWithEmptyAuc"); } - [Fact] + [Fact(Skip="TODO: Implement BYOL in Swagger")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestVirtualMachineWithBYOL() { diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/packages.config b/src/ResourceManager/Compute/Commands.Compute.Test/packages.config index d481f67438ee..fbd5062b2d5f 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/packages.config +++ b/src/ResourceManager/Compute/Commands.Compute.Test/packages.config @@ -2,25 +2,23 @@ - - - + + - + - - - - + + + diff --git a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj index b3b95b251d5d..caa005a9bddd 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj +++ b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj @@ -58,10 +58,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -80,13 +76,12 @@ ..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll True - - False - ..\..\..\packages\Microsoft.Azure.Management.Compute.11.1.1-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll + + ..\..\..\packages\Microsoft.Azure.Management.Compute.11.2.0-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll True - ..\..\..\packages\Microsoft.Azure.Management.Network.3.1.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll + ..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll True @@ -112,12 +107,16 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -142,10 +141,6 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -330,6 +325,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/ComputeClient.cs b/src/ResourceManager/Compute/Commands.Compute/Common/ComputeClient.cs index 7f0dd4707bcd..76ef9ac50c12 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Common/ComputeClient.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Common/ComputeClient.cs @@ -12,10 +12,10 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Compute; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Compute { diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/ComputeCloudException.cs b/src/ResourceManager/Compute/Commands.Compute/Common/ComputeCloudException.cs index 4a8c032283d6..3ad864bc49d1 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Common/ComputeCloudException.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Common/ComputeCloudException.cs @@ -54,7 +54,8 @@ protected static string GetErrorMessageWithRequestIdInfo(Rest.Azure.CloudExcepti if (cloudException.Response.StatusCode.Equals(HttpStatusCode.OK) && cloudException.Response.Content != null) { - var errorReturned = JsonConvert.DeserializeObject(cloudException.Response.Content.ReadAsStringAsync().Result); + var errorReturned = JsonConvert.DeserializeObject( + cloudException.Response.Content); sb.AppendLine().AppendFormat("StartTime: {0}", errorReturned.StartTime); sb.AppendLine().AppendFormat("EndTime: {0}", errorReturned.EndTime); @@ -73,7 +74,7 @@ protected static string GetErrorMessageWithRequestIdInfo(Rest.Azure.CloudExcepti sb.AppendLine().AppendFormat("StatusCode: {0}", cloudException.Response.StatusCode.GetHashCode()); sb.AppendLine().AppendFormat("ReasonPhrase: {0}", cloudException.Response.ReasonPhrase); if (cloudException.Response.Headers == null - || !cloudException.Response.Headers.Contains(RequestIdHeaderInResponse)) + || !cloudException.Response.Headers.ContainsKey(RequestIdHeaderInResponse)) { return sb.ToString(); } diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs b/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs index 91530f18e349..e20acf7ff1e6 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Common/DiagnosticsHelper.cs @@ -19,8 +19,8 @@ using System.Text; using System.Xml; using System.Xml.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Management.Storage.Models; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Storage; using Microsoft.Azure.Management.Storage.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs index a27a0c0b669f..875a4b8d34e5 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs @@ -16,8 +16,8 @@ using Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption; using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Commands.Compute.StorageServices; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using Microsoft.Azure.Management.Storage; @@ -32,6 +32,8 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Compute.Common; namespace Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/RemoveAzureVMBackup.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/RemoveAzureVMBackup.cs index 23e4a97ffeed..e3782ba6b214 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/RemoveAzureVMBackup.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/RemoveAzureVMBackup.cs @@ -18,8 +18,8 @@ using Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup; using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Commands.Compute.StorageServices; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using Microsoft.Azure.Management.Storage; diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/SetAzureVMBackupExtension.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/SetAzureVMBackupExtension.cs index b454aeef02f3..552546256e11 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/SetAzureVMBackupExtension.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/SetAzureVMBackupExtension.cs @@ -17,8 +17,8 @@ using Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup; using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Commands.Compute.StorageServices; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using Microsoft.Azure.Management.Storage; diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs index a98d03196d35..e689da6b7498 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; using Microsoft.Azure.Management.Compute; @@ -28,6 +28,7 @@ using System.Management.Automation; using System.Linq; using AutoMapper; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Compute { @@ -237,7 +238,7 @@ public override void ExecuteCmdlet() catch (Rest.Azure.CloudException ex) { var errorReturned = JsonConvert.DeserializeObject( - ex.Response.Content.ReadAsStringAsync().Result); + ex.Response.Content); WriteObject(errorReturned); } }); diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/PublishAzureVMDscConfigurationCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/PublishAzureVMDscConfigurationCommand.cs index 40ecd582b384..13b79542c93b 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/PublishAzureVMDscConfigurationCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/PublishAzureVMDscConfigurationCommand.cs @@ -1,10 +1,11 @@ using Microsoft.Azure.Commands.Compute.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.Common.Extensions.DSC; using Microsoft.WindowsAzure.Commands.Common.Extensions.DSC.Publish; using Microsoft.WindowsAzure.Storage.Auth; using System; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Compute.Extension.DSC { diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs index 482110c79a7a..45d20be6428a 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs @@ -1,7 +1,7 @@ using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using Microsoft.WindowsAzure.Commands.Common.Extensions.DSC; @@ -15,6 +15,7 @@ using System.IO; using System.Management.Automation; using System.Text.RegularExpressions; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Newtonsoft.Json; namespace Microsoft.Azure.Commands.Compute.Extension.DSC @@ -377,7 +378,8 @@ private void CreateConfiguration() } catch (Rest.Azure.CloudException ex) { - var errorReturned = JsonConvert.DeserializeObject(ex.Response.Content.ReadAsStringAsync().Result); + var errorReturned = JsonConvert.DeserializeObject( + ex.Response.Content); if (ComputeOperationStatus.Failed.Equals(errorReturned.Status) && errorReturned.Error != null && "InternalExecutionError".Equals(errorReturned.Error.Code)) diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/Diagnostics/SetAzureRmVMDiagnosticsExtension.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/Diagnostics/SetAzureRmVMDiagnosticsExtension.cs index 0658e2662210..51936e9ee50c 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/Diagnostics/SetAzureRmVMDiagnosticsExtension.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/Diagnostics/SetAzureRmVMDiagnosticsExtension.cs @@ -16,10 +16,12 @@ using System.Collections; using System.Management.Automation; using AutoMapper; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute.Models; using Microsoft.Azure.Management.Storage; using Microsoft.WindowsAzure.Commands.Common.Storage; diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs index 7b28fe28b8d9..c3f4e4f9857a 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs @@ -122,7 +122,7 @@ public override void ExecuteCmdlet() } catch (Rest.Azure.CloudException ex) { - var errorReturned = JsonConvert.DeserializeObject(ex.Response.Content.ReadAsStringAsync().Result); + var errorReturned = JsonConvert.DeserializeObject(ex.Response.Content); if (ComputeOperationStatus.Failed.Equals(errorReturned.Status) && errorReturned.Error != null && "InternalExecutionError".Equals(errorReturned.Error.Code)) diff --git a/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs b/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs index ecec4a3efaa2..c997bd005732 100644 --- a/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs @@ -14,12 +14,14 @@ using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.Sync.Download; using System; using System.IO; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Rsrc = Microsoft.Azure.Commands.Compute.Properties.Resources; using Microsoft.Azure.Management.Storage; using Microsoft.Azure.Commands.ResourceManager.Common; diff --git a/src/ResourceManager/Compute/Commands.Compute/StorageServices/SaveAzureVhdCommand.cs b/src/ResourceManager/Compute/Commands.Compute/StorageServices/SaveAzureVhdCommand.cs index 5f5bed8a0c7a..637e1554f2b9 100644 --- a/src/ResourceManager/Compute/Commands.Compute/StorageServices/SaveAzureVhdCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/StorageServices/SaveAzureVhdCommand.cs @@ -14,13 +14,15 @@ using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Storage; using Microsoft.WindowsAzure.Commands.Sync.Download; using System; using System.IO; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Compute.StorageServices { diff --git a/src/ResourceManager/Compute/Commands.Compute/StorageServices/StorageCredentialsFactory.cs b/src/ResourceManager/Compute/Commands.Compute/StorageServices/StorageCredentialsFactory.cs index 694f5de87f88..ddbbc00e184b 100644 --- a/src/ResourceManager/Compute/Commands.Compute/StorageServices/StorageCredentialsFactory.cs +++ b/src/ResourceManager/Compute/Commands.Compute/StorageServices/StorageCredentialsFactory.cs @@ -12,11 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Storage; using Microsoft.WindowsAzure.Commands.Sync.Download; using Microsoft.WindowsAzure.Storage.Auth; using System; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Rsrc = Microsoft.Azure.Commands.Compute.Properties.Resources; namespace Microsoft.Azure.Commands.Compute.StorageServices diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMBootDiagnosticsCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMBootDiagnosticsCommand.cs index eeb9384a9ca1..eb85519c27e8 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMBootDiagnosticsCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMBootDiagnosticsCommand.cs @@ -14,14 +14,16 @@ using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute.Models; using Microsoft.Azure.Management.Storage; using Microsoft.Azure.Management.Storage.Models; using System; using System.Globalization; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Compute { diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMBootDiagnosticsDataCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMBootDiagnosticsDataCommand.cs index 8f51b32a3688..2d6d9d0f5f6a 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMBootDiagnosticsDataCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMBootDiagnosticsDataCommand.cs @@ -14,8 +14,8 @@ using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Storage; using Microsoft.WindowsAzure.Commands.Sync.Download; @@ -26,6 +26,8 @@ using System.IO; using System.Management.Automation; using System.Text; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Compute { diff --git a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs index 3d09a10e7f8f..396bff402919 100644 --- a/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs +++ b/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs @@ -15,8 +15,8 @@ using AutoMapper; using Microsoft.Azure.Commands.Compute.Common; using Microsoft.Azure.Commands.Compute.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; using Microsoft.Azure.Management.Storage; @@ -26,6 +26,8 @@ using System.Linq; using System.Management.Automation; using System.Reflection; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Compute { diff --git a/src/ResourceManager/Compute/Commands.Compute/packages.config b/src/ResourceManager/Compute/Commands.Compute/packages.config index 5314816bb7bb..17746671ca14 100644 --- a/src/ResourceManager/Compute/Commands.Compute/packages.config +++ b/src/ResourceManager/Compute/Commands.Compute/packages.config @@ -3,14 +3,14 @@ - + - - + + @@ -20,9 +20,9 @@ - - - + + + diff --git a/src/ResourceManager/Compute/Compute.sln b/src/ResourceManager/Compute/Compute.sln index 4675b38ccd59..54a0bc59a45d 100644 --- a/src/ResourceManager/Compute/Compute.sln +++ b/src/ResourceManager/Compute/Compute.sln @@ -36,6 +36,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -106,6 +108,10 @@ Global {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj index 25178c3c91d2..2c5d4f038560 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj @@ -49,10 +49,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -106,12 +102,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -296,6 +292,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs index 783c5e6b0e7c..62dcbe9c6eea 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/ScenarioTests/DataFactoriesScenarioTestsBase.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.DataFactories; diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config index 719ce947edba..8d6ab31ddb44 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories.Test/packages.config @@ -2,7 +2,6 @@ - @@ -20,8 +19,8 @@ - - + + diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj index 848b1d1945db..bbcf54ceb05c 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -73,6 +69,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -97,12 +94,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -263,6 +260,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs b/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs index 57ca8b958e6f..c6cb8a84c724 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/DataFactoryCommonUtilities.cs @@ -17,11 +17,9 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.DataFactories.Properties; -using Microsoft.WindowsAzure; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; -using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.DataFactories { diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs b/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs index a178e687ac83..4a534bc290e0 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.cs @@ -14,14 +14,8 @@ using System.IO; using Microsoft.Azure.Management.DataFactories; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Commands.DataFactories.Properties; -using System; -using Microsoft.WindowsAzure.Storage.Blob; -using Microsoft.WindowsAzure.Storage; -using System.Net; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.DataFactories { diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config index 2c1116ac0c55..bd7faa8b4226 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/DataFactories/DataFactories.sln b/src/ResourceManager/DataFactories/DataFactories.sln index 776515232269..c11eef6254d6 100644 --- a/src/ResourceManager/DataFactories/DataFactories.sln +++ b/src/ResourceManager/DataFactories/DataFactories.sln @@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -70,6 +72,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj index 47587f9eb29d..c5b0048f4adb 100644 --- a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj +++ b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -98,12 +94,13 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True False @@ -173,6 +170,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3436a126-edc9-4060-8952-9a1be34cdd95} Commands.ScenarioTests.ResourceManager.Common diff --git a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaTestsBase.cs b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaTestsBase.cs index a3ab9325b50b..7cc6b36077ed 100644 --- a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaTestsBase.cs +++ b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/ScenarioTests/AdlaTestsBase.cs @@ -12,13 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Management.DataLake.AnalyticsCatalog; using Microsoft.Azure.Management.DataLake.AnalyticsJob; namespace Microsoft.Azure.Commands.DataLakeAnalytics.Test.ScenarioTests { using Microsoft.Azure; - using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Management.DataLake.Store; using Microsoft.Azure.Management.DataLake.Store.Models; using Microsoft.Azure.Management.Storage; diff --git a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/packages.config b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/packages.config index 8fb539484bf7..56b2af916f73 100644 --- a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/packages.config +++ b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/packages.config @@ -2,7 +2,6 @@ - @@ -17,8 +16,8 @@ - - + + diff --git a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands.DataLakeAnalytics.csproj b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands.DataLakeAnalytics.csproj index 18490685856f..cbaca38ab43e 100644 --- a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands.DataLakeAnalytics.csproj +++ b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands.DataLakeAnalytics.csproj @@ -42,10 +42,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -73,12 +69,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -174,6 +170,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Models/DataLakeAnalyticsClient.cs b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Models/DataLakeAnalyticsClient.cs index 0e6403fff37a..dd7a6b59b1b6 100644 --- a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Models/DataLakeAnalyticsClient.cs +++ b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Models/DataLakeAnalyticsClient.cs @@ -18,10 +18,10 @@ using System.Linq; using System.Net; using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; using Microsoft.Azure.Commands.Tags.Model; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.Properties; using Microsoft.Azure.Management.DataLake.Analytics; using Microsoft.Azure.Management.DataLake.Analytics.Models; using Microsoft.Azure.Management.DataLake.AnalyticsCatalog; diff --git a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/packages.config b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/packages.config index dcdcf6e1fa1d..5628b8ae6f9a 100644 --- a/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/packages.config +++ b/src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/DataLakeAnalytics/DataLakeAnalytics.sln b/src/ResourceManager/DataLakeAnalytics/DataLakeAnalytics.sln index 25f8f1efc2b3..2bd21448111a 100644 --- a/src/ResourceManager/DataLakeAnalytics/DataLakeAnalytics.sln +++ b/src/ResourceManager/DataLakeAnalytics/DataLakeAnalytics.sln @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,6 +54,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/Commands.DataLakeStore.Test.csproj b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/Commands.DataLakeStore.Test.csproj index 67fa5978818a..d51adf102123 100644 --- a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/Commands.DataLakeStore.Test.csproj +++ b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/Commands.DataLakeStore.Test.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -90,12 +86,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -166,6 +162,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3436a126-edc9-4060-8952-9a1be34cdd95} Commands.ScenarioTests.ResourceManager.Common diff --git a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/ScenarioTests/AdlsTestsBase.cs b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/ScenarioTests/AdlsTestsBase.cs index f1a2a8f48452..d4002dad1ba5 100644 --- a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/ScenarioTests/AdlsTestsBase.cs +++ b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/ScenarioTests/AdlsTestsBase.cs @@ -13,16 +13,16 @@ // ---------------------------------------------------------------------------------- using System.Reflection; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Management.DataLake.StoreFileSystem; namespace Microsoft.Azure.Commands.DataLakeStore.Test.ScenarioTests { using System; using Microsoft.WindowsAzure.Commands.ScenarioTest; - using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Microsoft.Azure.Management.DataLake.Store; - using Microsoft.Azure.Common.Authentication; + using ServiceManagemenet.Common; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; using System.Net; diff --git a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/packages.config b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/packages.config index d1936b0ee56c..775454178f45 100644 --- a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/packages.config +++ b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands.DataLakeStore.csproj b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands.DataLakeStore.csproj index de0fc1011a16..eb2469f28e4e 100644 --- a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands.DataLakeStore.csproj +++ b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands.DataLakeStore.csproj @@ -42,10 +42,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -73,13 +69,13 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True False @@ -189,6 +185,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreClient.cs b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreClient.cs index e7a641047599..7e163ce993d7 100644 --- a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreClient.cs +++ b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreClient.cs @@ -17,9 +17,9 @@ using System.Collections.Generic; using System.Net; using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.Properties; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; using Microsoft.Azure.Management.DataLake.Store; using Microsoft.Azure.Management.DataLake.Store.Models; using Microsoft.Azure.Commands.Tags.Model; diff --git a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreFileSystemClient.cs b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreFileSystemClient.cs index b3b8976cfb5f..b7d617360b3c 100644 --- a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreFileSystemClient.cs +++ b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreFileSystemClient.cs @@ -23,9 +23,9 @@ using System.Threading; using System.Threading.Tasks; using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.Properties; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; using Microsoft.Azure.Management.DataLake.StoreFileSystem; using Microsoft.Azure.Management.DataLake.StoreFileSystem.Models; using Microsoft.Azure.Management.DataLake.StoreUploader; diff --git a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/packages.config b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/packages.config index a378fd4fbcb8..de19739a30eb 100644 --- a/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/packages.config +++ b/src/ResourceManager/DataLakeStore/Commands.DataLakeStore/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/DataLakeStore/DataLakeStore.sln b/src/ResourceManager/DataLakeStore/DataLakeStore.sln index c5076ff1f44d..5d24df3d20b3 100644 --- a/src/ResourceManager/DataLakeStore/DataLakeStore.sln +++ b/src/ResourceManager/DataLakeStore/DataLakeStore.sln @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,6 +54,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj b/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj index f86af54d83ab..592524a7a219 100644 --- a/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj +++ b/src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj @@ -52,10 +52,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll @@ -82,12 +78,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -163,6 +159,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/DnsTestsBase.cs b/src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/DnsTestsBase.cs index 5d18408c3a28..66975b8dad3f 100644 --- a/src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/DnsTestsBase.cs +++ b/src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/DnsTestsBase.cs @@ -13,13 +13,14 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test.HttpRecorder; namespace Microsoft.Azure.Commands.ScenarioTest.DnsTests { using System; using System.Linq; - using Microsoft.Azure.Common.Authentication; + using ServiceManagemenet.Common; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/Dns/Commands.Dns.Test/packages.config b/src/ResourceManager/Dns/Commands.Dns.Test/packages.config index be162e8029b0..3a735387b737 100644 --- a/src/ResourceManager/Dns/Commands.Dns.Test/packages.config +++ b/src/ResourceManager/Dns/Commands.Dns.Test/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ResourceManager/Dns/Commands.Dns/Commands.Dns.csproj b/src/ResourceManager/Dns/Commands.Dns/Commands.Dns.csproj index 2a6225b5e2bf..2d8e724c8670 100644 --- a/src/ResourceManager/Dns/Commands.Dns/Commands.Dns.csproj +++ b/src/ResourceManager/Dns/Commands.Dns/Commands.Dns.csproj @@ -95,10 +95,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll True @@ -113,6 +109,7 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -130,12 +127,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -171,6 +168,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Dns/Commands.Dns/Models/DnsClient.cs b/src/ResourceManager/Dns/Commands.Dns/Models/DnsClient.cs index 90773f8a3c2c..d223ce89f512 100644 --- a/src/ResourceManager/Dns/Commands.Dns/Models/DnsClient.cs +++ b/src/ResourceManager/Dns/Commands.Dns/Models/DnsClient.cs @@ -16,14 +16,10 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Text; - -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.Dns; using Microsoft.Azure.Management.Dns.Models; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.WindowsAzure; using Microsoft.Azure.Commands.Tags.Model; namespace Microsoft.Azure.Commands.Dns.Models diff --git a/src/ResourceManager/Dns/Commands.Dns/packages.config b/src/ResourceManager/Dns/Commands.Dns/packages.config index 50800a64b0e9..0eef3ed320b6 100644 --- a/src/ResourceManager/Dns/Commands.Dns/packages.config +++ b/src/ResourceManager/Dns/Commands.Dns/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/Dns/Dns.sln b/src/ResourceManager/Dns/Dns.sln index 51bb234e88d0..9c1ca6dc88af 100644 --- a/src/ResourceManager/Dns/Dns.sln +++ b/src/ResourceManager/Dns/Dns.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Dns.Test", "Comman EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj index cc556e500809..8d1d321b696e 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj +++ b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj @@ -41,10 +41,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -96,12 +92,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -184,6 +180,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/ScenarioTests/HDInsightScenarioTestsBase.cs b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/ScenarioTests/HDInsightScenarioTestsBase.cs index 70fa46cafcb8..82bd9fd427f2 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/ScenarioTests/HDInsightScenarioTestsBase.cs +++ b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/ScenarioTests/HDInsightScenarioTestsBase.cs @@ -12,7 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Management.HDInsight; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.ScenarioTest; diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/packages.config b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/packages.config index ffd5f32e9657..2d5222cc3cf6 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight.Test/packages.config +++ b/src/ResourceManager/HDInsight/Commands.HDInsight.Test/packages.config @@ -2,7 +2,6 @@ - @@ -21,8 +20,8 @@ - - + + diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj b/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj index a819f7c80724..e4e5b9acc2e8 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj @@ -107,10 +107,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -129,6 +125,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -147,6 +144,14 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -168,14 +173,6 @@ False ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -186,6 +183,7 @@ False ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll + @@ -193,6 +191,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterCommand.cs b/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterCommand.cs index f12c1bb06170..ee72c7318697 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterCommand.cs +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterCommand.cs @@ -23,11 +23,13 @@ using Microsoft.Azure.Commands.HDInsight.Models.Management; using Microsoft.Azure.Management.HDInsight.Models; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Graph.RBAC.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using System.Diagnostics; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.HDInsight { diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Job/AzureHdInsightJobManagementClient.cs b/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Job/AzureHdInsightJobManagementClient.cs index 2cce7218df72..af2c5432f4d7 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Job/AzureHdInsightJobManagementClient.cs +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Job/AzureHdInsightJobManagementClient.cs @@ -12,13 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Threading.Tasks; using Hyak.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Management.HDInsight.Job; using Microsoft.Azure.Management.HDInsight.Job.Models; diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Management/AzureHdInsightManagementClient.cs b/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Management/AzureHdInsightManagementClient.cs index aaa75143cff8..224d693e697f 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Management/AzureHdInsightManagementClient.cs +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/Models/Management/AzureHdInsightManagementClient.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.HDInsight; using Microsoft.Azure.Management.HDInsight.Models; diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config b/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config index dafd25b62630..a3d69513e058 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/packages.config @@ -2,9 +2,9 @@ - + @@ -16,10 +16,9 @@ - - + + - \ No newline at end of file diff --git a/src/ResourceManager/HDInsight/HDInsight.sln b/src/ResourceManager/HDInsight/HDInsight.sln index b014fe0664c9..b1ba3c8306ec 100644 --- a/src/ResourceManager/HDInsight/HDInsight.sln +++ b/src/ResourceManager/HDInsight/HDInsight.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj index fb6a4a131ef5..ae5b71fe135a 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -73,14 +69,7 @@ False ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -93,6 +82,14 @@ False ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + False ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -133,12 +130,12 @@ + ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll - - ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True + + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True ..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll @@ -182,6 +179,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/TestsController.cs b/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/TestsController.cs index 5f5084c78205..a83b454372a6 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/TestsController.cs +++ b/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/TestsController.cs @@ -12,13 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Insights; using Microsoft.Azure.Management.Insights; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.Azure.Test; using System; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; namespace Microsoft.Azure.Commands.Insights.Test.ScenarioTests diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config index b0262f6d9f59..dbcbce5274bc 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config @@ -2,7 +2,6 @@ - @@ -17,8 +16,8 @@ - - + + diff --git a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj index 33a855c32677..175035bd8350 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj +++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj @@ -49,10 +49,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -63,6 +59,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -83,12 +80,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -109,6 +106,7 @@ + False ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll @@ -129,7 +127,7 @@ - + @@ -144,7 +142,7 @@ - + @@ -199,7 +197,7 @@ Designer Always - + Designer @@ -226,6 +224,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs index 3ddb95326a80..89e68ec505f0 100644 --- a/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs @@ -13,10 +13,9 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Insights; -using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.Insights { diff --git a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs index 14ec108f13bc..b41097f6058b 100644 --- a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.Insights; namespace Microsoft.Azure.Commands.Insights diff --git a/src/ResourceManager/Insights/Commands.Insights/packages.config b/src/ResourceManager/Insights/Commands.Insights/packages.config index e25264df01b4..9c7cd7c9951f 100644 --- a/src/ResourceManager/Insights/Commands.Insights/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights/packages.config @@ -2,9 +2,9 @@ - + @@ -14,10 +14,9 @@ - - + + - diff --git a/src/ResourceManager/Insights/Insights.sln b/src/ResourceManager/Insights/Insights.sln index 36d29f50e21d..806b57527702 100644 --- a/src/ResourceManager/Insights/Insights.sln +++ b/src/ResourceManager/Insights/Insights.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +48,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Intune/Commands.Intune.Test/Commands.Intune.Test.csproj b/src/ResourceManager/Intune/Commands.Intune.Test/Commands.Intune.Test.csproj index da8cd67ba497..4a6ad91f2313 100644 --- a/src/ResourceManager/Intune/Commands.Intune.Test/Commands.Intune.Test.csproj +++ b/src/ResourceManager/Intune/Commands.Intune.Test/Commands.Intune.Test.csproj @@ -48,10 +48,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll diff --git a/src/ResourceManager/Intune/Commands.Intune.Test/packages.config b/src/ResourceManager/Intune/Commands.Intune.Test/packages.config index aca1b894a317..acb11aef24de 100644 --- a/src/ResourceManager/Intune/Commands.Intune.Test/packages.config +++ b/src/ResourceManager/Intune/Commands.Intune.Test/packages.config @@ -2,7 +2,6 @@ - diff --git a/src/ResourceManager/Intune/Commands.Intune/Commands.Intune.csproj b/src/ResourceManager/Intune/Commands.Intune/Commands.Intune.csproj index 1255f4f46bf6..1315f3a149f5 100644 --- a/src/ResourceManager/Intune/Commands.Intune/Commands.Intune.csproj +++ b/src/ResourceManager/Intune/Commands.Intune/Commands.Intune.csproj @@ -48,10 +48,6 @@ ..\..\..\packages\Hyak.Common.1.0.3\lib\net45\Hyak.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Management.Intune.0.1.3-preview\lib\net45\Microsoft.Azure.Management.Intune.dll @@ -160,6 +156,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Intune/Commands.Intune/packages.config b/src/ResourceManager/Intune/Commands.Intune/packages.config index a1c9147bbe4f..a79d06768aec 100644 --- a/src/ResourceManager/Intune/Commands.Intune/packages.config +++ b/src/ResourceManager/Intune/Commands.Intune/packages.config @@ -2,7 +2,6 @@ - diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj index 0cbf5adfe342..6dc6ca8a9828 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj @@ -57,10 +57,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll @@ -94,6 +90,7 @@ ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -102,12 +99,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -145,7 +142,7 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll - + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True @@ -304,6 +301,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultEnvSetupHelper.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultEnvSetupHelper.cs index 3c1b6f05f3c2..88cb2d815c20 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultEnvSetupHelper.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultEnvSetupHelper.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Subscriptions; @@ -25,8 +25,10 @@ using Microsoft.Azure.Gallery; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Management.KeyVault; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultManagementController.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultManagementController.cs index b8733362ec22..3f3b1f63b943 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultManagementController.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultManagementController.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Subscriptions; @@ -21,6 +21,7 @@ using Microsoft.Azure.Test; using System; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Management.KeyVault; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config index 6c98559a29ea..09235c1ec664 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index 499d213e7ef9..9fb2f317ed78 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -119,10 +119,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -145,6 +141,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -162,12 +159,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -206,6 +203,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs index 213740acac54..d78756957fc8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DataServiceCredential.cs @@ -13,11 +13,11 @@ // ---------------------------------------------------------------------------------- using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using System; using System.Threading.Tasks; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.KeyVault.Models { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs index 231b02bed809..2b84095cfb63 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; using System.Net.Http; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.ResourceManager.Common; namespace Microsoft.Azure.Commands.KeyVault.Models diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index 1f80bf34c286..b95f49079ac6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -14,14 +14,14 @@ using Microsoft.Azure.KeyVault; using Microsoft.Azure.KeyVault.WebKey; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Http; using System.Security; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault.Models diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs index c900e851d375..23ce21ced09a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs @@ -18,15 +18,15 @@ using System.Linq; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Commands.Tags.Model; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; using PSKeyVaultModels = Microsoft.Azure.Commands.KeyVault.Models; using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; using PSResourceManagerModels = Microsoft.Azure.Commands.Resources.Models; using Microsoft.Azure.ActiveDirectory.GraphClient; -using Microsoft.Azure.Common.Authentication; using System.Threading.Tasks; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.KeyVault.Models; namespace Microsoft.Azure.Commands.KeyVault diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs index e5dee885bdc4..cc48291fafbb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs @@ -18,11 +18,11 @@ using System.Net; using Hyak.Common; using Microsoft.Azure.Commands.Tags.Model; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.KeyVault; using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.ActiveDirectory.GraphClient; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.KeyVault.Models { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config b/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config index 90d40181f61c..a5e7d48bf9cf 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/packages.config @@ -3,7 +3,6 @@ - @@ -18,8 +17,8 @@ - - + + diff --git a/src/ResourceManager/KeyVault/KeyVault.sln b/src/ResourceManager/KeyVault/KeyVault.sln index d0026ceedd50..7878944b5d30 100644 --- a/src/ResourceManager/KeyVault/KeyVault.sln +++ b/src/ResourceManager/KeyVault/KeyVault.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp.Test/Commands.LogicApp.Test.csproj b/src/ResourceManager/LogicApp/Commands.LogicApp.Test/Commands.LogicApp.Test.csproj index 5f20b516acd1..13b8adcc2638 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp.Test/Commands.LogicApp.Test.csproj +++ b/src/ResourceManager/LogicApp/Commands.LogicApp.Test/Commands.LogicApp.Test.csproj @@ -50,10 +50,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -69,11 +65,12 @@ False - ..\..\..\packages\Microsoft.Azure.Management.Logic.0.1.0-preview\lib\net45\Microsoft.Azure.Management.Logic.dll + ..\..\..\packages\Microsoft.Azure.Management.Logic.0.2.0-preview\lib\dotnet\Microsoft.Azure.Management.Logic.dll + True - + False - ..\..\..\packages\Microsoft.Azure.Management.WebSites.0.16.7-preview\lib\net45\Microsoft.Azure.Management.WebSites.dll + ..\..\..\packages\Microsoft.Azure.Management.WebSites.1.1.0-preview\lib\net45\Microsoft.Azure.Management.WebSites.dll False @@ -87,6 +84,7 @@ False ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.0-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -95,16 +93,17 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.2.0\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True - + False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.1.0.20\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.1.2.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True False @@ -118,6 +117,7 @@ + @@ -243,6 +243,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp.Test/ScenarioTests/WorkflowController.cs b/src/ResourceManager/LogicApp/Commands.LogicApp.Test/ScenarioTests/WorkflowController.cs index 1dbefbb6ca48..daf87f6260fa 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp.Test/ScenarioTests/WorkflowController.cs +++ b/src/ResourceManager/LogicApp/Commands.LogicApp.Test/ScenarioTests/WorkflowController.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Commands.LogicApp.Test.ScenarioTests using System; using System.Collections.Generic; using System.Linq; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp.Test/packages.config b/src/ResourceManager/LogicApp/Commands.LogicApp.Test/packages.config index 5e9e8fb3def1..c8491a660e22 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp.Test/packages.config +++ b/src/ResourceManager/LogicApp/Commands.LogicApp.Test/packages.config @@ -2,23 +2,20 @@ - - + - - - + - - - + + + diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp/Commands.LogicApp.csproj b/src/ResourceManager/LogicApp/Commands.LogicApp/Commands.LogicApp.csproj index f2433b0c2f42..5fb78e776b15 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp/Commands.LogicApp.csproj +++ b/src/ResourceManager/LogicApp/Commands.LogicApp/Commands.LogicApp.csproj @@ -58,40 +58,38 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - + False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + ..\..\..\packages\Microsoft.Azure.Management.Logic.0.2.0-preview\lib\dotnet\Microsoft.Azure.Management.Logic.dll + True - + False - ..\..\..\packages\Microsoft.Azure.Management.Logic.0.1.0-preview\lib\net45\Microsoft.Azure.Management.Logic.dll - - - False - ..\..\..\packages\Microsoft.Azure.Management.WebSites.0.16.7-preview\lib\net45\Microsoft.Azure.Management.WebSites.dll + ..\..\..\packages\Microsoft.Azure.Management.WebSites.1.1.0-preview\lib\net45\Microsoft.Azure.Management.WebSites.dll False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + True - + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + True - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.2.0\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True - + False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.1.0.20\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.0.9.3-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll @@ -113,7 +111,9 @@ + + @@ -167,6 +167,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClient.cs b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClient.cs index bd7cdf1e8ca3..f2922dddc846 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClient.cs +++ b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClient.cs @@ -18,8 +18,8 @@ namespace Microsoft.Azure.Commands.LogicApp.Utilities using System; using System.Management.Automation; using System.Globalization; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.Logic; using Microsoft.Azure.Management.Logic.Models; diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientAccessKeyOperations.cs b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientAccessKeyOperations.cs index b84f2fac9588..57b1ca9704a2 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientAccessKeyOperations.cs +++ b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientAccessKeyOperations.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Commands.LogicApp.Utilities { using Microsoft.Azure.Management.Logic.Models; using Microsoft.Azure.Management.Logic; - using Microsoft.Rest.Azure; using System; /// diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientRunOperations.cs b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientRunOperations.cs index 85deda045b36..c58f197a1c74 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientRunOperations.cs +++ b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientRunOperations.cs @@ -21,7 +21,6 @@ namespace Microsoft.Azure.Commands.LogicApp.Utilities using System.Threading.Tasks; using Microsoft.Azure.Management.Logic.Models; using Microsoft.Azure.Management.Logic; - using Microsoft.Rest.Azure; /// /// LogicApp client partial class for run operations diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientTriggerOperations.cs b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientTriggerOperations.cs index b700a77b4c1d..b3c55f4eca71 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientTriggerOperations.cs +++ b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/LogicAppClientTriggerOperations.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Commands.LogicApp.Utilities { using Microsoft.Azure.Management.Logic.Models; using Microsoft.Azure.Management.Logic; - using Microsoft.Rest.Azure; /// /// LogicApp client partial class for trigger operations diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/WebsitesClient.cs b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/WebsitesClient.cs index 2373c40f6c07..7ef63894a1cd 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/WebsitesClient.cs +++ b/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/WebsitesClient.cs @@ -16,8 +16,8 @@ namespace Microsoft.Azure.Commands.LogicApp.Utilities { using System; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.WebSites; using Microsoft.Azure.Management.WebSites.Models; diff --git a/src/ResourceManager/LogicApp/Commands.LogicApp/packages.config b/src/ResourceManager/LogicApp/Commands.LogicApp/packages.config index 87731414abed..a7b69909159c 100644 --- a/src/ResourceManager/LogicApp/Commands.LogicApp/packages.config +++ b/src/ResourceManager/LogicApp/Commands.LogicApp/packages.config @@ -2,19 +2,18 @@ - - + - + - - - + + + \ No newline at end of file diff --git a/src/ResourceManager/LogicApp/LogicApp.sln b/src/ResourceManager/LogicApp/LogicApp.sln index 33eaea6250b3..5416780bbead 100644 --- a/src/ResourceManager/LogicApp/LogicApp.sln +++ b/src/ResourceManager/LogicApp/LogicApp.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.LogicApp.Test", "C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj b/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj index 9908993b24df..fdf108d52df2 100644 --- a/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj +++ b/src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj @@ -50,10 +50,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -68,7 +64,7 @@ ..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll - ..\..\..\packages\Microsoft.Azure.Management.Network.3.1.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll + ..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll True @@ -77,8 +73,8 @@ ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.4.0-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.0-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True @@ -89,19 +85,16 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.2.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll True @@ -365,6 +358,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ResourceManager/Network/Commands.Network.Test/NetworkResourcesController.cs b/src/ResourceManager/Network/Commands.Network.Test/NetworkResourcesController.cs index 3e5139cd26cb..38a1df2c3f65 100644 --- a/src/ResourceManager/Network/Commands.Network.Test/NetworkResourcesController.cs +++ b/src/ResourceManager/Network/Commands.Network.Test/NetworkResourcesController.cs @@ -14,6 +14,7 @@ using System; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Network; @@ -21,7 +22,7 @@ using Microsoft.Azure.Subscriptions; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using RestTestFramework = Microsoft.Rest.ClientRuntime.Azure.TestFramework; using Microsoft.Azure.Test.HttpRecorder; diff --git a/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/ExpressRouteCircuitTests.cs b/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/ExpressRouteCircuitTests.cs index a74a8d91db2d..861ab5a509e9 100644 --- a/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/ExpressRouteCircuitTests.cs +++ b/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/ExpressRouteCircuitTests.cs @@ -33,7 +33,7 @@ public void TestExpressRouteCircuitPeeringCRUD() NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteCircuitPeeringCRUD"); } - [Fact] + [Fact(Skip = "Rerecord tests")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestExpressRouteCircuitAuthorizationCRUD() { diff --git a/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayTests.cs b/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayTests.cs index 2dd76f2e4994..7856915aa423 100644 --- a/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayTests.cs +++ b/src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayTests.cs @@ -19,7 +19,7 @@ namespace Commands.Network.Test.ScenarioTests { public class VirtualNetworkGatewayTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase { - [Fact] + [Fact(Skip = "Rerecord tests")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestVirtualNetworkGatewayCRUD() { diff --git a/src/ResourceManager/Network/Commands.Network.Test/packages.config b/src/ResourceManager/Network/Commands.Network.Test/packages.config index 6ef6d2b3bb39..88d65709b73b 100644 --- a/src/ResourceManager/Network/Commands.Network.Test/packages.config +++ b/src/ResourceManager/Network/Commands.Network.Test/packages.config @@ -2,24 +2,22 @@ - - + - + - - - - + + + diff --git a/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj b/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj index c4fe3e8d7089..228e26ae85a9 100644 --- a/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj +++ b/src/ResourceManager/Network/Commands.Network/Commands.Network.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -77,7 +73,7 @@ ..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll - ..\..\..\packages\Microsoft.Azure.Management.Network.3.1.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll + ..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll True @@ -100,16 +96,16 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -452,6 +448,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Network/Commands.Network/Common/NetworkClient.cs b/src/ResourceManager/Network/Commands.Network/Common/NetworkClient.cs index 43386d70b4ee..4e9212b18f21 100644 --- a/src/ResourceManager/Network/Commands.Network/Common/NetworkClient.cs +++ b/src/ResourceManager/Network/Commands.Network/Common/NetworkClient.cs @@ -14,8 +14,6 @@ using System; using Microsoft.Azure.Management.Network; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Management.Network.Models; using System.Threading.Tasks; using System.Threading; @@ -28,6 +26,8 @@ using System.Net.Http.Headers; using System.Net; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Network { diff --git a/src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/GenerateAzureVpnClientPackage.cs b/src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/GenerateAzureVpnClientPackage.cs index cc07b8172b98..0165ce50b528 100644 --- a/src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/GenerateAzureVpnClientPackage.cs +++ b/src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/GenerateAzureVpnClientPackage.cs @@ -26,7 +26,7 @@ using Microsoft.Rest.Azure; using Microsoft.Azure.Management.Network.Models; using Microsoft.Rest; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Newtonsoft.Json; using System.Text; using System.Net.Http.Headers; diff --git a/src/ResourceManager/Network/Commands.Network/packages.config b/src/ResourceManager/Network/Commands.Network/packages.config index ebfd14bf2d62..f87edbf264e5 100644 --- a/src/ResourceManager/Network/Commands.Network/packages.config +++ b/src/ResourceManager/Network/Commands.Network/packages.config @@ -3,13 +3,12 @@ - - + @@ -19,9 +18,9 @@ - - - + + + diff --git a/src/ResourceManager/Network/Network.sln b/src/ResourceManager/Network/Network.sln index 828d39e9f320..8b5cd9138a3a 100644 --- a/src/ResourceManager/Network/Network.sln +++ b/src/ResourceManager/Network/Network.sln @@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -70,6 +72,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/Commands.NotificationHubs.Test.csproj b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/Commands.NotificationHubs.Test.csproj index ff4e4de357ac..5cdc8152da91 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/Commands.NotificationHubs.Test.csproj +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/Commands.NotificationHubs.Test.csproj @@ -35,6 +35,10 @@ 4 + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3436a126-edc9-4060-8952-9a1be34cdd95} Commands.ScenarioTests.ResourceManager.Common @@ -51,10 +55,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll True - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll True @@ -88,12 +88,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/ScenarioTests/TestBaseClass.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/ScenarioTests/TestBaseClass.cs index d583578af40e..993c1dc9885b 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/ScenarioTests/TestBaseClass.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/ScenarioTests/TestBaseClass.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.NotificationHubs.Test.ScenarioTests using Microsoft.Azure.Test; using Microsoft.Azure.Management.NotificationHubs; using Microsoft.Azure.Management.Resources; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using System.Collections.Generic; diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/packages.config b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/packages.config index 565cd2327cca..2f718e77de14 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/packages.config +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands.NotificationHubs.csproj b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands.NotificationHubs.csproj index dd3e8ac247a9..083d448b5ded 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands.NotificationHubs.csproj +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands.NotificationHubs.csproj @@ -46,10 +46,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll True - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll True @@ -66,12 +62,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -92,6 +88,7 @@ + ..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll @@ -154,6 +151,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common @@ -177,4 +178,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/AzureNotificationHubsCmdletBase.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/AzureNotificationHubsCmdletBase.cs index f8b50877df5d..599a074e76a2 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/AzureNotificationHubsCmdletBase.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/AzureNotificationHubsCmdletBase.cs @@ -20,7 +20,7 @@ using Microsoft.Azure.Commands.ResourceManager.Common; using System.IO; using Newtonsoft.Json; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using System.Collections.Generic; using System.Collections; using System.Globalization; diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/Namespace/NewAzureNotificationHubsNamespaceAuthorizationRules.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/Namespace/NewAzureNotificationHubsNamespaceAuthorizationRules.cs index cdec9e932db9..da67e955b55b 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/Namespace/NewAzureNotificationHubsNamespaceAuthorizationRules.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/Namespace/NewAzureNotificationHubsNamespaceAuthorizationRules.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Commands.NotificationHubs.Models; using Microsoft.Azure.Management.NotificationHubs.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHub.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHub.cs index 6de19a06106f..b4fd426a2263 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHub.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHub.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Commands.NotificationHubs.Models; using Microsoft.Azure.Management.NotificationHubs.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHubAuthorizationRules.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHubAuthorizationRules.cs index 506ac2375e57..060e40f835ef 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHubAuthorizationRules.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/NewAzureNotificationHubAuthorizationRules.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Commands.NotificationHubs.Models; using Microsoft.Azure.Management.NotificationHubs.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHub.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHub.cs index ba436f037f65..ecc779592ac2 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHub.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHub.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Commands.NotificationHubs.Models; using Microsoft.Azure.Management.NotificationHubs.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHubAuthorizationRules.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHubAuthorizationRules.cs index 90ff198bf136..30b1cefec1db 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHubAuthorizationRules.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands/NotificationHub/SetAzureNotificationHubAuthorizationRules.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Commands.NotificationHubs.Models; using Microsoft.Azure.Management.NotificationHubs.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/NotificationHubsManagementClient.cs b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/NotificationHubsManagementClient.cs index 222fad5d40cd..1d6f3fa2c5e0 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/NotificationHubsManagementClient.cs +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/NotificationHubsManagementClient.cs @@ -13,18 +13,14 @@ // limitations under the License. using Microsoft.Azure.Commands.NotificationHubs.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.NotificationHubs; using Microsoft.Azure.Management.NotificationHubs.Models; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using System; -using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Management.Automation; -using System.Net; using System.Security.Cryptography; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.NotificationHubs { diff --git a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/packages.config b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/packages.config index 149ed223d4c0..418cc46c6836 100644 --- a/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/packages.config +++ b/src/ResourceManager/NotificationHubs/Commands.NotificationHubs/packages.config @@ -2,7 +2,6 @@ - @@ -10,7 +9,7 @@ - - + + diff --git a/src/ResourceManager/NotificationHubs/NotificationHubs.sln b/src/ResourceManager/NotificationHubs/NotificationHubs.sln index db3508bee465..1f6a6f3a4cc4 100644 --- a/src/ResourceManager/NotificationHubs/NotificationHubs.sln +++ b/src/ResourceManager/NotificationHubs/NotificationHubs.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources", "..\Re EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj index 6c2e8264e998..ac0c7f0b1241 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj @@ -48,10 +48,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -84,12 +80,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -150,6 +146,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/ScenarioTests/OperationalInsightsScenarioTestBase.cs b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/ScenarioTests/OperationalInsightsScenarioTestBase.cs index 01c8c250909a..2fba5ebf3032 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/ScenarioTests/OperationalInsightsScenarioTestBase.cs +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/ScenarioTests/OperationalInsightsScenarioTestBase.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.OperationalInsights; @@ -23,6 +22,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.OperationalInsights.Test { diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/packages.config b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/packages.config index 9ba0ededde23..6e58fbdde7e7 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/packages.config +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Client/OperationalInsightsClient.cs b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Client/OperationalInsightsClient.cs index 10f49eed9692..9e30db51381e 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Client/OperationalInsightsClient.cs +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Client/OperationalInsightsClient.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.OperationalInsights; namespace Microsoft.Azure.Commands.OperationalInsights.Client diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj index 26ba222b72e7..5bee5bc6c99a 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -77,12 +73,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -215,6 +211,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/packages.config b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/packages.config index 685228d3e44c..77d1cc585d19 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/packages.config +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/packages.config @@ -2,7 +2,6 @@ - @@ -11,8 +10,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/OperationalInsights/OperationalInsights.sln b/src/ResourceManager/OperationalInsights/OperationalInsights.sln index 713a3511a46d..d19dfe60c6b9 100644 --- a/src/ResourceManager/OperationalInsights/OperationalInsights.sln +++ b/src/ResourceManager/OperationalInsights/OperationalInsights.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs index 87a6e7ad1a4e..2c8397f4f707 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs @@ -12,8 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using System.Linq; using Xunit; using System; @@ -23,9 +21,10 @@ using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Commands.Common; -using Moq; using System.Collections.Concurrent; using System.Threading.Tasks; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile; using Microsoft.Azure.Commands.Profile.Models; diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/ClientFactoryTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/ClientFactoryTests.cs index a08d5154c589..f775c47ba5d7 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/ClientFactoryTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/ClientFactoryTests.cs @@ -16,13 +16,10 @@ using Xunit; using System; using System.Net.Http.Headers; -using Hyak.Common; -using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Rest.TransientFaultHandling; using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.Azure.Commands.ResourceManager.Profile.Test diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/Commands.Profile.Test.csproj b/src/ResourceManager/Profile/Commands.Profile.Test/Commands.Profile.Test.csproj index c6b75ca88a1f..0386e28e89c8 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/Commands.Profile.Test.csproj +++ b/src/ResourceManager/Profile/Commands.Profile.Test/Commands.Profile.Test.csproj @@ -57,10 +57,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -100,12 +96,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -234,10 +230,18 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common + + {cff09e81-1e31-444e-b4d4-a21e946c29e2} + Commands.ServiceManagement.Common + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} Commands.ResourceManager.Common @@ -253,4 +257,5 @@ + \ No newline at end of file diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/CommonDataCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/CommonDataCmdletTests.cs index 7c34dafdbd3e..0058e0b8c93a 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/CommonDataCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/CommonDataCmdletTests.cs @@ -12,14 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; -using System.Linq; using Xunit; using System; -using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/ContextCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/ContextCmdletTests.cs index 08878f8fbd46..297faf11cdbf 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/ContextCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/ContextCmdletTests.cs @@ -14,17 +14,13 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Profile; -using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using System.Linq; using Xunit; -using System; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.ResourceManager.Profile.Test { diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/EnvironmentCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/EnvironmentCmdletTests.cs index 3136ec9a73f6..692b979bdc01 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/EnvironmentCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/EnvironmentCmdletTests.cs @@ -15,11 +15,12 @@ using System; using System.Management.Automation; using System.Collections.Generic; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.ResourceManager.Common; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs index 6b1335eba893..9633c79c2c5d 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/LoginCmdletTests.cs @@ -13,20 +13,14 @@ // ---------------------------------------------------------------------------------- using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Commands.Profile; -using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using System.Linq; using Xunit; -using System; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Hyak.Common; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; using System.Reflection; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile.Test { diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/ProfileCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/ProfileCmdletTests.cs index 4b43d22d9998..f428d04ab202 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/ProfileCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/ProfileCmdletTests.cs @@ -14,14 +14,13 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Profile; -using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.ScenarioTest; using System.Linq; using Xunit; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/ProfileController.cs b/src/ResourceManager/Profile/Commands.Profile.Test/ProfileController.cs index 8f1107b2edb4..5cf4b94f4f49 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/ProfileController.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/ProfileController.cs @@ -14,7 +14,7 @@ using System; using System.Linq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Subscriptions; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/RPRegistrationDelegatingHandlerTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/RPRegistrationDelegatingHandlerTests.cs index b1c0ffe39a01..c893a6c30478 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/RPRegistrationDelegatingHandlerTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/RPRegistrationDelegatingHandlerTests.cs @@ -17,17 +17,15 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Internal.Resources; -using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Moq; using Xunit; using System.Linq; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Management.Internal.Resources.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile.Test { diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs index 6f12018f4a98..0214f00ca3bf 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/TenantCmdletTests.cs @@ -13,18 +13,11 @@ // ---------------------------------------------------------------------------------- using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Commands.Profile; -using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using System.Linq; using Xunit; -using System; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Hyak.Common; -using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.Azure.Commands.Profile.Test diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/TypeConversionTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/TypeConversionTests.cs index f710149c84f3..814855e88fff 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/TypeConversionTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/TypeConversionTests.cs @@ -1,13 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Newtonsoft.Json; using Xunit; using Xunit.Extensions; @@ -15,10 +9,264 @@ namespace Microsoft.Azure.Commands.Profile.Test { public class TypeConversionTests { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void CanConvertNullEnvironments() + { + Assert.Null((PSAzureEnvironment)null); + var environment = (PSAzureEnvironment) new AzureEnvironment(); + Assert.NotNull(environment); + Assert.Null(environment.ActiveDirectoryAuthority); + Assert.Null(environment.ActiveDirectoryServiceEndpointResourceId); + Assert.Null(environment.AdTenant); + Assert.Null(environment.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix); + Assert.Null(environment.AzureDataLakeStoreFileSystemEndpointSuffix); + Assert.Null(environment.AzureKeyVaultDnsSuffix); + Assert.Null(environment.AzureKeyVaultServiceEndpointResourceId); + Assert.False(environment.EnableAdfsAuthentication); + Assert.Null(environment.GalleryUrl); + Assert.Null(environment.GraphUrl); + Assert.Null(environment.GraphEndpointResourceId); + Assert.Null(environment.ManagementPortalUrl); + Assert.Null(environment.Name); + Assert.Null(environment.PublishSettingsFileUrl); + Assert.Null(environment.ResourceManagerUrl); + Assert.Null(environment.ServiceManagementUrl); + Assert.Null(environment.SqlDatabaseDnsSuffix); + Assert.Null(environment.StorageEndpointSuffix); + Assert.Null(environment.TrafficManagerDnsSuffix); + } + + [Theory] + [InlineData("TestAll", true, "https://login.microsoftonline.com","https://management.core.windows.net/", + "Common", "https://mangement.azure.com/dataLakeJobs", "https://management.azure.com/dataLakeFiles", + ".keyvault.azure.com", "https://keyvault.azure.com/", "https://gallery.azure.com", + "https://graph.windows.net", "https://graph.windows.net/", "https://manage.windowsazure.com", + "https://manage.windowsazure.com/publishsettings", "https://management.azure.com", + "https://management.core.windows.net", ".sql.azure.com", ".core.windows.net", + ".trafficmanager.windows.net")] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void CanConvertValidEnvironments(string name, bool onPremise, string activeDirectory, string serviceResource, + string adTenant, string dataLakeJobs, string dataLakeFiles, string kvDnsSuffix, + string kvResource, string gallery, string graph, string graphResource, string portal, + string publishSettings, string resourceManager, string serviceManagement, + string sqlSuffix, string storageSuffix, string trafficManagerSuffix) + { + AzureEnvironment azEnvironment = CreateEnvironment(name, onPremise, activeDirectory, + serviceResource, adTenant, dataLakeJobs, dataLakeFiles, kvDnsSuffix, + kvResource, gallery, graph, graphResource, portal, publishSettings, + resourceManager, serviceManagement, sqlSuffix, storageSuffix, + trafficManagerSuffix); + var environment = (PSAzureEnvironment) azEnvironment; + Assert.NotNull(environment); + CheckEndpoint(AzureEnvironment.Endpoint.ActiveDirectory, azEnvironment, + environment.ActiveDirectoryAuthority); + CheckEndpoint(AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, + azEnvironment, environment.ActiveDirectoryServiceEndpointResourceId); + CheckEndpoint(AzureEnvironment.Endpoint.AdTenant, azEnvironment, + environment.AdTenant); + CheckEndpoint(AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, azEnvironment, + environment.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, azEnvironment, + environment.AzureDataLakeStoreFileSystemEndpointSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, azEnvironment, + environment.AzureKeyVaultDnsSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, azEnvironment, + environment.AzureKeyVaultServiceEndpointResourceId); + CheckEndpoint(AzureEnvironment.Endpoint.Gallery, azEnvironment, + environment.GalleryUrl); + CheckEndpoint(AzureEnvironment.Endpoint.Graph, azEnvironment, + environment.GraphUrl); + CheckEndpoint(AzureEnvironment.Endpoint.GraphEndpointResourceId, azEnvironment, + environment.GraphEndpointResourceId); + CheckEndpoint(AzureEnvironment.Endpoint.ManagementPortalUrl, azEnvironment, + environment.ManagementPortalUrl); + CheckEndpoint(AzureEnvironment.Endpoint.PublishSettingsFileUrl, azEnvironment, + environment.PublishSettingsFileUrl); + CheckEndpoint(AzureEnvironment.Endpoint.ResourceManager, azEnvironment, + environment.ResourceManagerUrl); + CheckEndpoint(AzureEnvironment.Endpoint.ServiceManagement, azEnvironment, + environment.ServiceManagementUrl); + CheckEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, azEnvironment, + environment.SqlDatabaseDnsSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix, azEnvironment, + environment.StorageEndpointSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, azEnvironment, + environment.TrafficManagerDnsSuffix); + Assert.Equal(azEnvironment.Name, environment.Name); + Assert.Equal(azEnvironment.OnPremise, environment.EnableAdfsAuthentication); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void CanConvertNullPSEnvironments() + { + PSAzureEnvironment env = null; + Assert.Null((AzureEnvironment)env); + var environment = (AzureEnvironment) new PSAzureEnvironment(); + Assert.NotNull(environment); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.ActiveDirectory)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.AdTenant)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId)); + Assert.False(environment.OnPremise); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.Gallery)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.Graph)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.GraphEndpointResourceId)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.ManagementPortalUrl)); + Assert.Null(environment.Name); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.PublishSettingsFileUrl)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.ResourceManager)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.ServiceManagement)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.StorageEndpointSuffix)); + Assert.False(environment.IsEndpointSet(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix)); + } + [Theory] + [InlineData("TestAll", true, "https://login.microsoftonline.com","https://management.core.windows.net/", + "Common", "https://mangement.azure.com/dataLakeJobs", "https://management.azure.com/dataLakeFiles", + ".keyvault.azure.com", "https://keyvault.azure.com/", "https://gallery.azure.com", + "https://graph.windows.net", "https://graph.windows.net/", "https://manage.windowsazure.com", + "https://manage.windowsazure.com/publishsettings", "https://management.azure.com", + "https://management.core.windows.net", ".sql.azure.com", ".core.windows.net", + ".trafficmanager.windows.net")] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void CanConvertValidPSEnvironments(string name, bool onPremise, string activeDirectory, string serviceResource, + string adTenant, string dataLakeJobs, string dataLakeFiles, string kvDnsSuffix, + string kvResource, string gallery, string graph, string graphResource, string portal, + string publishSettings, string resourceManager, string serviceManagement, + string sqlSuffix, string storageSuffix, string trafficManagerSuffix) + { + PSAzureEnvironment environment = new PSAzureEnvironment + { + Name =name, + EnableAdfsAuthentication = onPremise, + ActiveDirectoryAuthority = activeDirectory, + ActiveDirectoryServiceEndpointResourceId = serviceResource, + AdTenant = adTenant, + AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix = dataLakeJobs, + AzureDataLakeStoreFileSystemEndpointSuffix = dataLakeFiles, + AzureKeyVaultDnsSuffix = kvDnsSuffix, + AzureKeyVaultServiceEndpointResourceId = kvResource, + GalleryUrl = gallery, + GraphUrl = graph, + GraphEndpointResourceId = graphResource, + ManagementPortalUrl = portal, + PublishSettingsFileUrl = publishSettings, + ResourceManagerUrl = resourceManager, + ServiceManagementUrl = serviceManagement, + SqlDatabaseDnsSuffix = sqlSuffix, + StorageEndpointSuffix = storageSuffix, + TrafficManagerDnsSuffix = trafficManagerSuffix + }; + var azEnvironment = (AzureEnvironment) environment; + Assert.NotNull(environment); + CheckEndpoint(AzureEnvironment.Endpoint.ActiveDirectory, azEnvironment, + environment.ActiveDirectoryAuthority); + CheckEndpoint(AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, + azEnvironment, environment.ActiveDirectoryServiceEndpointResourceId); + CheckEndpoint(AzureEnvironment.Endpoint.AdTenant, azEnvironment, + environment.AdTenant); + CheckEndpoint(AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, azEnvironment, + environment.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, azEnvironment, + environment.AzureDataLakeStoreFileSystemEndpointSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, azEnvironment, + environment.AzureKeyVaultDnsSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, azEnvironment, + environment.AzureKeyVaultServiceEndpointResourceId); + CheckEndpoint(AzureEnvironment.Endpoint.Gallery, azEnvironment, + environment.GalleryUrl); + CheckEndpoint(AzureEnvironment.Endpoint.Graph, azEnvironment, + environment.GraphUrl); + CheckEndpoint(AzureEnvironment.Endpoint.GraphEndpointResourceId, azEnvironment, + environment.GraphEndpointResourceId); + CheckEndpoint(AzureEnvironment.Endpoint.ManagementPortalUrl, azEnvironment, + environment.ManagementPortalUrl); + CheckEndpoint(AzureEnvironment.Endpoint.PublishSettingsFileUrl, azEnvironment, + environment.PublishSettingsFileUrl); + CheckEndpoint(AzureEnvironment.Endpoint.ResourceManager, azEnvironment, + environment.ResourceManagerUrl); + CheckEndpoint(AzureEnvironment.Endpoint.ServiceManagement, azEnvironment, + environment.ServiceManagementUrl); + CheckEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, azEnvironment, + environment.SqlDatabaseDnsSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix, azEnvironment, + environment.StorageEndpointSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, azEnvironment, + environment.TrafficManagerDnsSuffix); + Assert.Equal(azEnvironment.Name, environment.Name); + Assert.Equal(azEnvironment.OnPremise, environment.EnableAdfsAuthentication); + } + + + private AzureEnvironment CreateEnvironment(string name, bool onPremise, string activeDirectory, string serviceResource, + string adTenant, string dataLakeJobs, string dataLakeFiles, string kvDnsSuffix, + string kvResource, string gallery, string graph, string graphResource, string portal, + string publishSettings, string resourceManager, string serviceManagement, + string sqlSuffix, string storageSuffix, string trafficManagerSuffix) + { + var environment = new AzureEnvironment() {Name = name, OnPremise = onPremise}; + SetEndpoint(AzureEnvironment.Endpoint.ActiveDirectory, environment, activeDirectory); + CheckEndpoint(AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId, + environment, serviceResource); + CheckEndpoint(AzureEnvironment.Endpoint.AdTenant, environment, adTenant); + CheckEndpoint( + AzureEnvironment.Endpoint.AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix, + environment, + dataLakeJobs); + CheckEndpoint(AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix, + environment, + dataLakeFiles); + CheckEndpoint(AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, environment, + kvDnsSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, + environment, + kvResource); + CheckEndpoint(AzureEnvironment.Endpoint.Gallery, environment, gallery); + CheckEndpoint(AzureEnvironment.Endpoint.Graph, environment,graph); + CheckEndpoint(AzureEnvironment.Endpoint.GraphEndpointResourceId, environment, + graphResource); + CheckEndpoint(AzureEnvironment.Endpoint.ManagementPortalUrl, environment, portal); + CheckEndpoint(AzureEnvironment.Endpoint.PublishSettingsFileUrl, environment, + publishSettings); + CheckEndpoint(AzureEnvironment.Endpoint.ResourceManager, environment, + resourceManager); + CheckEndpoint(AzureEnvironment.Endpoint.ServiceManagement, environment, + serviceManagement); + CheckEndpoint(AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, environment, + sqlSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix, environment, + storageSuffix); + CheckEndpoint(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, environment, + trafficManagerSuffix); + + return environment; + + } + + private void SetEndpoint(AzureEnvironment.Endpoint endpoint, AzureEnvironment environment, string endpointValue) + { + if (!environment.IsEndpointSet(endpoint) && !string.IsNullOrEmpty(endpointValue)) + { + environment.Endpoints[endpoint] = endpointValue; + } + } + private void CheckEndpoint(AzureEnvironment.Endpoint endpoint, AzureEnvironment environment, string valueToCheck) + { + if (environment.IsEndpointSet(endpoint)) + { + Assert.Equal(environment.GetEndpoint(endpoint), valueToCheck); + } + } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void CanConvertNullAzureSubscriptions() - { + { Assert.Null((PSAzureSubscription)null); var subscription = (PSAzureSubscription) (new AzureSubscription()); Assert.NotNull(subscription); diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/packages.config b/src/ResourceManager/Profile/Commands.Profile.Test/packages.config index 1bbacafdfc26..13c36df51907 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/packages.config +++ b/src/ResourceManager/Profile/Commands.Profile.Test/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs b/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs index 0438f626fee6..38fd34222fa9 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs @@ -16,12 +16,12 @@ using System.Management.Automation; using System.Reflection; using System.Security; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Properties; namespace Microsoft.Azure.Commands.Profile @@ -116,7 +116,7 @@ protected override void BeginProcessing() base.BeginProcessing(); if (Environment == null && EnvironmentName == null) { - Environment = AzureEnvironment.PublicEnvironments[Microsoft.Azure.Common.Authentication.Models.EnvironmentName.AzureCloud]; + Environment = AzureEnvironment.PublicEnvironments[Common.Authentication.Models.EnvironmentName.AzureCloud]; } else if (Environment == null && EnvironmentName != null) { diff --git a/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj b/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj index 4b17e0a0f2fe..c405a5ba5d0a 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj +++ b/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj @@ -53,10 +53,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -66,6 +62,7 @@ + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -74,12 +71,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -187,6 +184,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs index b3479e084e3d..ad69a70c9bbc 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs @@ -12,15 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System.Collections.Generic; using System.Management.Automation; -using System.Linq; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.Azure.Commands.Profile.Properties; using System; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile { diff --git a/src/ResourceManager/Profile/Commands.Profile/Environment/AddAzureRMEnvironment.cs b/src/ResourceManager/Profile/Commands.Profile/Environment/AddAzureRMEnvironment.cs index 1dc61b3b9a81..052d361c2ca7 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Environment/AddAzureRMEnvironment.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Environment/AddAzureRMEnvironment.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile/Environment/SetAzureRMEnvironment.cs b/src/ResourceManager/Profile/Commands.Profile/Environment/SetAzureRMEnvironment.cs index b2a83c83de6b..c8abb83f1504 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Environment/SetAzureRMEnvironment.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Environment/SetAzureRMEnvironment.cs @@ -15,7 +15,7 @@ using System; using System.Globalization; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/ModelExtensions.cs b/src/ResourceManager/Profile/Commands.Profile/Models/ModelExtensions.cs index 2d94ac29923e..a2c3041e0790 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/ModelExtensions.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/ModelExtensions.cs @@ -14,9 +14,8 @@ using System; using System.Collections.Generic; -using System.Linq; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Subscriptions.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureContext.cs b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureContext.cs index 3f16dc9f0f7f..29f14ca96a6f 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureContext.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureContext.cs @@ -1,10 +1,18 @@ -using System; -using System.CodeDom; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile.Models { diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureEnvironment.cs b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureEnvironment.cs index 3ee09a89363d..7d7e2603aac8 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureEnvironment.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureEnvironment.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile.Models { @@ -54,12 +54,14 @@ public static implicit operator AzureEnvironment(PSAzureEnvironment environment) newEnvironment.Endpoints[AzureEnvironment.Endpoint.StorageEndpointSuffix] = environment.StorageEndpointSuffix; newEnvironment.Endpoints[AzureEnvironment.Endpoint.Graph] = environment.GraphUrl; + newEnvironment.Endpoints[AzureEnvironment.Endpoint.GraphEndpointResourceId] = environment.GraphEndpointResourceId; newEnvironment.Endpoints[AzureEnvironment.Endpoint.TrafficManagerDnsSuffix] = environment.TrafficManagerDnsSuffix; newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix] = environment.AzureKeyVaultDnsSuffix; newEnvironment.Endpoints[AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId] = environment.AzureKeyVaultServiceEndpointResourceId; + return newEnvironment; } @@ -147,6 +149,11 @@ public PSAzureEnvironment(AzureEnvironment environment) GraphUrl = environment.Endpoints[AzureEnvironment.Endpoint.Graph]; } + if (environment.IsEndpointSet(AzureEnvironment.Endpoint.GraphEndpointResourceId)) + { + GraphEndpointResourceId = + environment.Endpoints[AzureEnvironment.Endpoint.GraphEndpointResourceId]; + } if (environment.IsEndpointSet(AzureEnvironment.Endpoint.TrafficManagerDnsSuffix)) { TrafficManagerDnsSuffix = @@ -180,7 +187,7 @@ public PSAzureEnvironment(AzureEnvironment environment) public string Name { get; set; } /// - /// Gets or sets a value indicating whther ADFS authentication should be allowed . + /// Gets or sets a value indicating whether ADFS authentication should be allowed . /// Generally, this is only used in Azure Stack environments. /// public bool EnableAdfsAuthentication { get; set; } @@ -240,6 +247,11 @@ public PSAzureEnvironment(AzureEnvironment environment) /// public string GraphUrl { get; set; } + /// + /// Gets or sets the resource Id to use for contacting the Graph endpoint + /// + public string GraphEndpointResourceId { get; set; } + /// /// Gets or sets the domain name suffix for traffig manager services. /// diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureProfile.cs b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureProfile.cs index f8e6ab2e3088..941e362bdbec 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureProfile.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureProfile.cs @@ -1,10 +1,19 @@ -using System; -using System.CodeDom; +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.Profile.Models diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureRmAccount.cs b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureRmAccount.cs index d75ab0a17ce3..38eae3f91eba 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureRmAccount.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureRmAccount.cs @@ -14,10 +14,8 @@ using System; using System.Linq; -using System.Configuration; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.Utilities; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile.Models { diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureSubscription.cs b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureSubscription.cs index 0092864f16fe..d598f7d70a05 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureSubscription.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureSubscription.cs @@ -13,9 +13,8 @@ // ---------------------------------------------------------------------------------- using System; -using System.Configuration; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.Utilities; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Utilities; namespace Microsoft.Azure.Commands.Profile.Models { diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureTenant.cs b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureTenant.cs index 7fff1f875baf..cf6dbef47645 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureTenant.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/PSAzureTenant.cs @@ -13,9 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using System.Configuration; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.Utilities; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile.Models { diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs b/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs index 5d9d49006e81..9330d4fba078 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs @@ -13,19 +13,18 @@ // ---------------------------------------------------------------------------------- using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Factories; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.Properties; using Microsoft.Azure.Subscriptions; using Microsoft.IdentityModel.Clients.ActiveDirectory; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Management.Automation; using System.Security; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; +using Microsoft.Azure.Commands.Common.Authentication.Properties; namespace Microsoft.Azure.Commands.ResourceManager.Common diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/SimpleAccessToken.cs b/src/ResourceManager/Profile/Commands.Profile/Models/SimpleAccessToken.cs index 6872c3c0b6f7..683a480d0fd5 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/SimpleAccessToken.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/SimpleAccessToken.cs @@ -13,9 +13,9 @@ // ---------------------------------------------------------------------------------- using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Properties; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Profile.Models { diff --git a/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs b/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs index 28283caa57f2..dac739bf3e7f 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.Profile.Properties; using Microsoft.Azure.Commands.ResourceManager.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs b/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs index 0b08ec0474c7..e3b7fc5f598e 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.Profile.Properties; using Microsoft.Azure.Commands.ResourceManager.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs b/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs index d49384b0613f..5209e2e0d306 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Subscription/GetAzureRMSubscription.cs @@ -13,13 +13,13 @@ using System.Linq; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.Profile.Properties; using Microsoft.Azure.Commands.ResourceManager.Common; using System.Collections.Generic; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.Azure.Commands.Profile diff --git a/src/ResourceManager/Profile/Commands.Profile/packages.config b/src/ResourceManager/Profile/Commands.Profile/packages.config index f050b8000b55..2fd6ccc443c1 100644 --- a/src/ResourceManager/Profile/Commands.Profile/packages.config +++ b/src/ResourceManager/Profile/Commands.Profile/packages.config @@ -2,7 +2,6 @@ - @@ -10,8 +9,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/Profile/Profile.sln b/src/ResourceManager/Profile/Profile.sln index eeb568975b82..092610418b22 100644 --- a/src/ResourceManager/Profile/Profile.sln +++ b/src/ResourceManager/Profile/Profile.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj index b7c0fc157a56..58c08afdb20f 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj @@ -35,10 +35,6 @@ 4 - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll @@ -74,14 +70,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.9.3\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -153,6 +147,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs index 2a8198936a63..c32c94bc0e5f 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs @@ -22,9 +22,9 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.Azure.Management.RecoveryServices; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using System; using System.Net.Http; using System.Reflection; diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/packages.config b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/packages.config index 913e27ac45f7..3885d59fcc67 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/packages.config +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj index a9536cbf6d4b..08ee7778ff6b 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj @@ -43,10 +43,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -63,12 +59,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -150,6 +146,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Common/PSRecoveryServicesClient.cs b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Common/PSRecoveryServicesClient.cs index ff3fe03ae1ec..cb40ca24b3d4 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Common/PSRecoveryServicesClient.cs +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Common/PSRecoveryServicesClient.cs @@ -22,8 +22,8 @@ using System.Text; using System.Web.Script.Serialization; using System.Xml; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.RecoveryServices; using Microsoft.Azure.Management.RecoveryServices.Models; using Microsoft.Azure.Portal.RecoveryServices.Models.Common; diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRMRecoveryServicesVaultSettingsFile.cs b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRMRecoveryServicesVaultSettingsFile.cs index 2c952368f686..dc6008a06fba 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRMRecoveryServicesVaultSettingsFile.cs +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRMRecoveryServicesVaultSettingsFile.cs @@ -16,7 +16,7 @@ using System.Linq; using System.Management.Automation; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Portal.RecoveryServices.Models.Common; namespace Microsoft.Azure.Commands.RecoveryServices diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/packages.config b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/packages.config index 988638f65f1c..561a8495ffd2 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/packages.config +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/packages.config @@ -2,7 +2,6 @@ - @@ -10,7 +9,7 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/RecoveryServices/RecoveryServices.sln b/src/ResourceManager/RecoveryServices/RecoveryServices.sln index 170fa659804e..cffb1826ee60 100644 --- a/src/ResourceManager/RecoveryServices/RecoveryServices.sln +++ b/src/ResourceManager/RecoveryServices/RecoveryServices.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices.Test", "Commands.RecoveryServices.Test\Commands.RecoveryServices.Test.csproj", "{6C7D3D81-37AB-445E-8081-78A1FEC0A773}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -44,6 +46,10 @@ Global {6C7D3D81-37AB-445E-8081-78A1FEC0A773}.Debug|Any CPU.Build.0 = Debug|Any CPU {6C7D3D81-37AB-445E-8081-78A1FEC0A773}.Release|Any CPU.ActiveCfg = Release|Any CPU {6C7D3D81-37AB-445E-8081-78A1FEC0A773}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj index 470d307781a0..d12b7756e59e 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/Commands.RedisCache.Test.csproj @@ -50,10 +50,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -97,12 +93,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -188,6 +184,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs index 1417740f929e..d14be761f54d 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTestsBase.cs @@ -12,13 +12,14 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; + namespace Microsoft.Azure.Commands.RedisCache.Test.ScenarioTests { using System; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.Azure.Test; using Microsoft.Azure.Management.Redis; - using Microsoft.Azure.Common.Authentication; using WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.Azure.Management.Insights; using Microsoft.Azure.Management.Internal.Resources; diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config index 6d5d0dca6aa6..10eedfdaa7de 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/packages.config @@ -2,7 +2,6 @@ - @@ -18,8 +17,8 @@ - - + + diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj index 03d35a51a510..e3127c9728de 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands.RedisCache.csproj @@ -52,10 +52,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -91,12 +87,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -195,6 +191,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs b/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs index 9d17b508de01..fff294c7cf41 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Models/RedisCacheClient.cs @@ -12,20 +12,21 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.RedisCache { using System.Collections; using System.Collections.Generic; using System.ComponentModel; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using ServiceManagemenet.Common; + using ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Insights; using Microsoft.Azure.Management.Insights.Models; using Microsoft.Azure.Management.Internal.Resources; using Microsoft.Azure.Management.Redis; using Microsoft.Azure.Management.Redis.Models; - using Microsoft.WindowsAzure; - using Microsoft.WindowsAzure.Commands.Common; public class RedisCacheClient { diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config b/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config index 0d6be3f88d9e..5c6e623bcb5e 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/RedisCache/RedisCache.sln b/src/ResourceManager/RedisCache/RedisCache.sln index 0f8569262a39..9810ed258034 100644 --- a/src/ResourceManager/RedisCache/RedisCache.sln +++ b/src/ResourceManager/RedisCache/RedisCache.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +48,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj index 79b1059a1dd0..a0f9d9db6781 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj @@ -54,10 +54,7 @@ False ..\..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - + ..\..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -66,12 +63,12 @@ ..\..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -86,6 +83,7 @@ + @@ -192,6 +190,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ApiVersionHelper.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ApiVersionHelper.cs index 2f8bc6a02508..b58e78923081 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ApiVersionHelper.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ApiVersionHelper.cs @@ -12,6 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components { using System; @@ -20,10 +22,8 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components using System.Runtime.Caching; using System.Threading; using System.Threading.Tasks; - using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; - using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Providers; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using Extensions; + using Entities.Providers; using System.Collections.Generic; /// diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ResourceManagerClientHelper.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ResourceManagerClientHelper.cs index 03bf6143615a..101a0de7690d 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ResourceManagerClientHelper.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/ResourceManagerClientHelper.cs @@ -12,13 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components { using System; - using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; using System.Collections.Generic; /// diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs index e8b9a7797aa1..338ad8ae6d56 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions using System.Management.Automation; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Resources; - using Microsoft.Azure.Common.Authentication; + using ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs index 1f6fe448a2f1..462cb1e8d861 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Resources; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; - using Microsoft.Azure.Common.Authentication; + using ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs index 80cc1c35e683..7ab1e0b730b5 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs @@ -12,6 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; + namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { using System.IO; @@ -20,7 +22,6 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Resources; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; - using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs index eb16de99d3d4..6f048287165d 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; - using Microsoft.Azure.Common.Authentication; + using ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs index ed58a246aa05..24fc04f2722d 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs @@ -12,6 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; + namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { using System.IO; @@ -20,7 +22,6 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; - using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs index 316f7f3e96e6..f22aa0dcc7dc 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs @@ -12,6 +12,9 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { using System; @@ -26,8 +29,6 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients; using Common; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; using Newtonsoft.Json.Linq; using System.Collections.Generic; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config index 1510305a0e35..12e09556906c 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config @@ -2,15 +2,14 @@ - - - + + \ No newline at end of file diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj index 1822e4b96dcf..6cc721ced550 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj +++ b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -104,12 +100,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -232,6 +228,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs index 4fd392f84826..fe68c011da72 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs @@ -23,8 +23,9 @@ using System.Threading; using System.Threading.Tasks; using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Resources.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs index de07758fcda9..738aac324ff1 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs @@ -17,9 +17,10 @@ using System.Linq; using System.Net.Http; using System.Net.Http.Headers; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Gallery; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Insights; diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config index 8b5873d6e160..6537258f3d0c 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/packages.config +++ b/src/ResourceManager/Resources/Commands.Resources.Test/packages.config @@ -2,7 +2,6 @@ - @@ -20,8 +19,8 @@ - - + + diff --git a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj index f4843189ce2b..d83520f6dbf5 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj +++ b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -84,12 +80,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -237,6 +233,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs index 5408509c705a..87fc473d62dd 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ActiveDirectory/ActiveDirectoryClient.cs @@ -13,8 +13,6 @@ // ---------------------------------------------------------------------------------- using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Graph.RBAC.Models; using System; @@ -22,6 +20,8 @@ using System.Diagnostics; using System.Linq; using System.Net; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; namespace Microsoft.Azure.Commands.Resources.Models.ActiveDirectory diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs index af38ebe0a8a2..3d154ef171d9 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.Authorization/AuthorizationClient.cs @@ -17,9 +17,9 @@ using System.Collections.Generic; using System.Linq; using System.Net; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Resources.Models.ActiveDirectory; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Authorization.Models; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ProviderFeatures/ProviderFeatureClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ProviderFeatures/ProviderFeatureClient.cs index fa50de42c489..a25346b64486 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ProviderFeatures/ProviderFeatureClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ProviderFeatures/ProviderFeatureClient.cs @@ -12,13 +12,14 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.Resources.Models.ProviderFeatures { using System; using System.Collections.Generic; using System.Linq; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs index 51043c6f6dfd..7eef9a008eb6 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/GalleryTemplatesClient.cs @@ -24,14 +24,12 @@ using System.Text.RegularExpressions; using Microsoft.Azure.Gallery; using Microsoft.Azure.Gallery.Models; -using Microsoft.WindowsAzure; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; -using Microsoft.Azure.Common.Authentication; using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Common.OData; namespace Microsoft.Azure.Commands.Resources.Models diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs index 365c29c5bacd..03f700dccda0 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs @@ -25,8 +25,6 @@ using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities; using Microsoft.Azure.Commands.Tags.Model; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Authorization.Models; using Microsoft.Azure.Management.Resources; @@ -36,6 +34,8 @@ using Newtonsoft.Json; using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources; using System.Net; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Resources.Models { diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs index e73980332c26..3461094a64db 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceWithParameterBaseCmdlet.cs @@ -22,8 +22,9 @@ using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Resources.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.Resources { diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs index 22436c6d34da..24ff69883c71 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesBaseCmdlet.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using System.IO; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Resources.Models { diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs index db970532816a..3fcdda06deb4 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs @@ -18,6 +18,7 @@ using System.Linq; using System.Reflection; using System.Text; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Tags.Model; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Resources.Models; @@ -25,7 +26,6 @@ using Newtonsoft.Json; using Microsoft.Azure.Commands.Resources.Models.Authorization; using Microsoft.Azure.Management.Authorization.Models; -using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.Resources.Models { diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs index 1b231c816f60..bbe6978c5970 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs @@ -17,7 +17,7 @@ using System.IO; using System.Management.Automation; using System.Reflection; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.Resources { diff --git a/src/ResourceManager/Resources/Commands.Resources/packages.config b/src/ResourceManager/Resources/Commands.Resources/packages.config index 07c00e2d7901..390071d6f989 100644 --- a/src/ResourceManager/Resources/Commands.Resources/packages.config +++ b/src/ResourceManager/Resources/Commands.Resources/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/Resources/Resources.sln b/src/ResourceManager/Resources/Resources.sln index 8fb07dab530d..ac460597ba0b 100644 --- a/src/ResourceManager/Resources/Resources.sln +++ b/src/ResourceManager/Resources/Resources.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj index b0fc61f82309..604178f37ada 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj @@ -35,10 +35,6 @@ 4 - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll @@ -70,14 +66,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -167,6 +161,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/ScenarioTests/SiteRecoveryTestsBase.cs b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/ScenarioTests/SiteRecoveryTestsBase.cs index 2e90131e616a..bdbef6de6ed7 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/ScenarioTests/SiteRecoveryTestsBase.cs +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/ScenarioTests/SiteRecoveryTestsBase.cs @@ -23,11 +23,11 @@ using Microsoft.Azure.Management.RecoveryServices; using Microsoft.Azure.Management.SiteRecovery; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Authentication; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using System; using System.Net.Http; using System.Reflection; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.SiteRecovery.Test.ScenarioTests { diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/packages.config b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/packages.config index a242f512dd32..9c7ed72efe34 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/packages.config +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Commands.SiteRecovery.csproj b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Commands.SiteRecovery.csproj index 70799f80d2c8..de6cab1001c4 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Commands.SiteRecovery.csproj +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Commands.SiteRecovery.csproj @@ -43,10 +43,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -63,12 +59,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -199,6 +195,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClient.cs b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClient.cs index d6519926b927..bdfb6a0557b0 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClient.cs +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClient.cs @@ -19,23 +19,18 @@ using System.Net; using System.Runtime.Serialization; using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; using System.Text; using System.Web.Script.Serialization; using System.Xml; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.RecoveryServices; using Microsoft.Azure.Management.RecoveryServices.Models; using Microsoft.Azure.Management.SiteRecovery; using Microsoft.Azure.Management.SiteRecovery.Models; using Microsoft.Azure.Portal.RecoveryServices.Models.Common; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Properties = Microsoft.Azure.Commands.SiteRecovery.Properties; using System.Configuration; -using System.Collections.Specialized; using System.Net.Security; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.SiteRecovery { diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClientHelper.cs b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClientHelper.cs index acbc0698444f..4df7589e30a9 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClientHelper.cs +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClientHelper.cs @@ -14,8 +14,8 @@ using System; using System.Collections.Generic; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.SiteRecovery; using Microsoft.Azure.Management.SiteRecovery.Models; using Microsoft.WindowsAzure.Commands.Common; diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Vault/GetAzureSiteRecoveryVaultSettingsFile.cs b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Vault/GetAzureSiteRecoveryVaultSettingsFile.cs index c087fefcb017..e890aa26f3fc 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Vault/GetAzureSiteRecoveryVaultSettingsFile.cs +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Vault/GetAzureSiteRecoveryVaultSettingsFile.cs @@ -16,9 +16,8 @@ using System.Linq; using System.Management.Automation; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Portal.RecoveryServices.Models.Common; -using Microsoft.Azure.Management.SiteRecovery.Models; namespace Microsoft.Azure.Commands.SiteRecovery { diff --git a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config index a504b61e1325..afdbb9ee7cca 100644 --- a/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config +++ b/src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config @@ -2,7 +2,6 @@ - @@ -10,7 +9,7 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/SiteRecovery/SiteRecovery.sln b/src/ResourceManager/SiteRecovery/SiteRecovery.sln index 2136cd6804f0..ec4d76195b8c 100644 --- a/src/ResourceManager/SiteRecovery/SiteRecovery.sln +++ b/src/ResourceManager/SiteRecovery/SiteRecovery.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +48,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj index 1684bb0dcf48..1e07954b91fb 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj +++ b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj @@ -48,10 +48,6 @@ ..\..\..\packages\Hyak.Common.1.0.3\lib\net45\Hyak.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True @@ -110,12 +106,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -262,6 +258,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs index 3013793b3620..593f82ae2646 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs @@ -15,9 +15,11 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Gallery; using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Management.Authorization; diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs index b2097ceb4cca..45ca7eace280 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs @@ -19,10 +19,11 @@ using Microsoft.WindowsAzure.Management.Storage; using Microsoft.Azure.Test; using Microsoft.Azure.Graph.RBAC; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Management.Authorization; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config index 46e04818ff22..7d84c250d1eb 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config @@ -2,7 +2,6 @@ - @@ -21,8 +20,8 @@ - - + + diff --git a/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseAuditingCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseAuditingCmdletBase.cs index 1fd9b17ee4c2..82b14b53443b 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseAuditingCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseAuditingCmdletBase.cs @@ -12,10 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Auditing.Model; using Microsoft.Azure.Commands.Sql.Auditing.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.Auditing.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseServerAuditingCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseServerAuditingCmdletBase.cs index addbc31aeb9e..3bbc8963310e 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseServerAuditingCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Auditing/Cmdlet/SqlDatabaseServerAuditingCmdletBase.cs @@ -13,10 +13,11 @@ // ---------------------------------------------------------------------------------- using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Auditing.Model; using Microsoft.Azure.Commands.Sql.Auditing.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.Auditing.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/AuditingEndpointsCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/AuditingEndpointsCommunicator.cs index 57c4d105cb86..78a4e5d9c769 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/AuditingEndpointsCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/AuditingEndpointsCommunicator.cs @@ -12,11 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.Auditing.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/SqlAuditAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/SqlAuditAdapter.cs index 05ade16d14bc..84b21748a911 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/SqlAuditAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Auditing/Services/SqlAuditAdapter.cs @@ -14,12 +14,13 @@ using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Auditing.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Database.Services; using Microsoft.Azure.Commands.Sql.Database.Model; diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj index 57beb11eb95a..891b05d7a809 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj +++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj @@ -270,10 +270,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -294,6 +290,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -314,12 +311,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -367,6 +364,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Sql/Commands.Sql/Common/AzureEndpointsCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Common/AzureEndpointsCommunicator.cs index 3b8bfdd3e0bb..9615ae803915 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Common/AzureEndpointsCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Common/AzureEndpointsCommunicator.cs @@ -18,11 +18,13 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Auditing.Model; using Microsoft.Azure.Commands.Sql.Auditing.Services; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; using Microsoft.Azure.Management.Sql; diff --git a/src/ResourceManager/Sql/Commands.Sql/Common/AzureSqlCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Common/AzureSqlCmdletBase.cs index 58d916721b9a..0d68284cc45f 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Common/AzureSqlCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Common/AzureSqlCmdletBase.cs @@ -13,9 +13,10 @@ // ---------------------------------------------------------------------------------- using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.Sql.Common diff --git a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingPolicyCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingPolicyCmdletBase.cs index 4107983c29df..c414c2dca5cf 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingPolicyCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingPolicyCmdletBase.cs @@ -12,10 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.DataMasking.Model; using Microsoft.Azure.Commands.Sql.DataMasking.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.DataMasking.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingRuleCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingRuleCmdletBase.cs index f84e2469d57c..d80cb4ebb1be 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingRuleCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingRuleCmdletBase.cs @@ -14,10 +14,11 @@ using Microsoft.Azure.Commands.Sql.DataMasking.Model; using Microsoft.Azure.Commands.Sql.DataMasking.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System.Collections.Generic; using System.Linq; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.DataMasking.Cmdlet diff --git a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/DataMaskingEndpointsCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/DataMaskingEndpointsCommunicator.cs index 90a9aab85015..f6de6c32d820 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/DataMaskingEndpointsCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/DataMaskingEndpointsCommunicator.cs @@ -12,12 +12,14 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.DataMasking.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/SqlDataMaskingAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/SqlDataMaskingAdapter.cs index e76a372ef87e..394e6e59abf2 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/SqlDataMaskingAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Data Masking/Services/SqlDataMaskingAdapter.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Sql.DataMasking.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; using System; using System.Collections.Generic; @@ -21,6 +21,7 @@ using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Server.Services; using System.Text.RegularExpressions; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Sql.DataMasking.Services { diff --git a/src/ResourceManager/Sql/Commands.Sql/Database Activation/Cmdlet/AzureSqlDatabaseActivationCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Database Activation/Cmdlet/AzureSqlDatabaseActivationCmdletBase.cs index 4de4a12d05ec..213271bb2f91 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database Activation/Cmdlet/AzureSqlDatabaseActivationCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database Activation/Cmdlet/AzureSqlDatabaseActivationCmdletBase.cs @@ -15,12 +15,12 @@ using System; using System.Collections.Generic; using System.Management.Automation; - +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.Database.Services; using Microsoft.Azure.Commands.Sql.DatabaseActivation.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.DatabaseActivation.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationAdapter.cs index 73d319d52509..969e892de331 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationAdapter.cs @@ -16,7 +16,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; - +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.Database.Services; @@ -24,7 +24,7 @@ using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationCommunicator.cs index 4ae44e29946a..ef6cf091a6ac 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database Activation/Services/SqlAzureDatabaseActivationCommunicator.cs @@ -14,9 +14,10 @@ using System; using System.Collections.Generic; - -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/Database Backup/Cmdlet/AzureSqlDatabaseRestorePointCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Database Backup/Cmdlet/AzureSqlDatabaseRestorePointCmdletBase.cs index da486f2d9216..717d3e5bc219 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database Backup/Cmdlet/AzureSqlDatabaseRestorePointCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database Backup/Cmdlet/AzureSqlDatabaseRestorePointCmdletBase.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Backup.Model; using Microsoft.Azure.Commands.Sql.Backup.Services; using Microsoft.Azure.Commands.Sql.Common; @@ -50,7 +51,7 @@ public abstract class AzureSqlDatabaseRestorePointCmdletBase /// /// /// - protected override AzureSqlDatabaseBackupAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlDatabaseBackupAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlDatabaseBackupAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs index 57482f2b1497..b0a9816a63ed 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs @@ -16,7 +16,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; - +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Backup.Model; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Database.Model; @@ -25,7 +25,7 @@ using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupCommunicator.cs index 8ab4e2c57b6f..e9d1a89260be 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupCommunicator.cs @@ -14,9 +14,10 @@ using System; using System.Collections.Generic; - -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseActivityCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseActivityCmdletBase.cs index 33a0bd91d1b5..39ed1ef2f392 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseActivityCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseActivityCmdletBase.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.Database.Services; @@ -66,7 +67,7 @@ public abstract class AzureSqlDatabaseActivityCmdletBase /// /// /// - protected override AzureSqlDatabaseAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlDatabaseAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlDatabaseAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseCmdletBase.cs index c2bbb13685da..307d48fe7119 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/AzureSqlDatabaseCmdletBase.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.Database.Services; @@ -37,7 +38,7 @@ public abstract class AzureSqlDatabaseCmdletBase : AzureSqlCmdletBase /// /// - protected override AzureSqlDatabaseAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlDatabaseAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlDatabaseAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/GetAzureSqlDatabaseExpanded.cs b/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/GetAzureSqlDatabaseExpanded.cs index 91d26ddcaf2f..e7c5c8601162 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/GetAzureSqlDatabaseExpanded.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/GetAzureSqlDatabaseExpanded.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.Database.Services; @@ -49,7 +50,7 @@ public class GetAzureSqlDatabaseExpanded : AzureSqlCmdletBase /// /// - protected override AzureSqlDatabaseAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlDatabaseAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlDatabaseAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseAdapter.cs index e664a38b3ab3..f8fbad3db6d3 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseAdapter.cs @@ -16,12 +16,13 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.ElasticPool.Services; using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.Database.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseCommunicator.cs index 6c024cba0f7c..024a51a6451d 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseCommunicator.cs @@ -12,14 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using Microsoft.WindowsAzure.Management.Storage; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.Database.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolActivityCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolActivityCmdletBase.cs index a7a29b846457..0346ee6eea8c 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolActivityCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolActivityCmdletBase.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ElasticPool.Model; using Microsoft.Azure.Commands.Sql.ElasticPool.Services; @@ -47,7 +48,7 @@ public abstract class AzureSqlElasticPoolActivityCmdletBase : AzureSqlCmdletBase /// /// /// - protected override AzureSqlElasticPoolAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlElasticPoolAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlElasticPoolAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolCmdletBase.cs index 8c7a0ffc7ea9..6fcbdfd02e1c 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/AzureSqlElasticPoolCmdletBase.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ElasticPool.Model; using Microsoft.Azure.Commands.Sql.ElasticPool.Services; @@ -37,7 +38,7 @@ public abstract class AzureSqlElasticPoolCmdletBase : AzureSqlCmdletBase /// /// - protected override AzureSqlElasticPoolAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlElasticPoolAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlElasticPoolAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolAdapter.cs index 9abab3a5e7e8..eb3168324937 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolAdapter.cs @@ -15,12 +15,13 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.Database.Services; using Microsoft.Azure.Commands.Sql.ElasticPool.Model; using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.ElasticPool.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolCommunicator.cs index ad58b15d3ce2..c680dcba5965 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Services/AzureSqlElasticPoolCommunicator.cs @@ -12,14 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using Microsoft.WindowsAzure.Management.Storage; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.ElasticPool.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Cmdlet/AzureSqlServerFirewallRuleCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Cmdlet/AzureSqlServerFirewallRuleCmdletBase.cs index 67227f9bd1f8..bedfc8687982 100644 --- a/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Cmdlet/AzureSqlServerFirewallRuleCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Cmdlet/AzureSqlServerFirewallRuleCmdletBase.cs @@ -14,10 +14,11 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.FirewallRule.Adapter; using Microsoft.Azure.Commands.Sql.FirewallRule.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.FirewallRule.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleAdapter.cs index 48afa3159d05..319e9839326f 100644 --- a/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleAdapter.cs @@ -14,10 +14,11 @@ using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.FirewallRule.Model; using Microsoft.Azure.Commands.Sql.FirewallRule.Services; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.FirewallRule.Adapter diff --git a/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleCommunicator.cs index ad25bd6f7935..d65dbb27352f 100644 --- a/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/FirewallRule/Services/AzureSqlServerFirewallRuleCommunicator.cs @@ -14,9 +14,11 @@ using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/AzureSqlDatabaseExecuteIndexRecommendationCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/AzureSqlDatabaseExecuteIndexRecommendationCmdletBase.cs index 53a79634a870..399f7be2e53b 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/AzureSqlDatabaseExecuteIndexRecommendationCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/AzureSqlDatabaseExecuteIndexRecommendationCmdletBase.cs @@ -14,10 +14,11 @@ using System.Linq; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Model; using Microsoft.Azure.Commands.Sql.Service; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/GetAzureSqlDatabaseIndexRecommendations.cs b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/GetAzureSqlDatabaseIndexRecommendations.cs index 213110ca346a..7374cbad9726 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/GetAzureSqlDatabaseIndexRecommendations.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Cmdlet/GetAzureSqlDatabaseIndexRecommendations.cs @@ -15,10 +15,11 @@ using System.Collections.Generic; using System.Linq; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Model; using Microsoft.Azure.Commands.Sql.Service; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationAdapter.cs index 1991f77c34b8..c400e44ef249 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationAdapter.cs @@ -13,9 +13,10 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Model; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.Service { diff --git a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationCommunicator.cs index 50c65cd4e3f8..0ad2ed9f6e35 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Index Recommendations/Service/AzureSqlDatabaseIndexRecommendationCommunicator.cs @@ -16,10 +16,12 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Model; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesAdapter.cs index 49f3ab5feb42..a3a68697bd18 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesAdapter.cs @@ -14,9 +14,10 @@ using System; using System.Linq; using Microsoft.Azure; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Location_Capabilities.Model; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.Location_Capabilities.Services { diff --git a/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesCommunicator.cs index 774e7a8469ef..03d7c8bfefd9 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Location Capabilities/Services/AzureSqlCapabilitiesCommunicator.cs @@ -12,9 +12,11 @@ // ---------------------------------------------------------------------------------- using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Cmdlet/GetAzureSqlElasticPoolRecommendation.cs b/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Cmdlet/GetAzureSqlElasticPoolRecommendation.cs index 5da7e369712c..00ffc9539b4b 100644 --- a/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Cmdlet/GetAzureSqlElasticPoolRecommendation.cs +++ b/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Cmdlet/GetAzureSqlElasticPoolRecommendation.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.RecommendedElasticPools.Services; using Microsoft.Azure.Management.Sql.Models; @@ -40,7 +41,7 @@ public class GetAzureSqlElasticPoolRecommendation : AzureSqlCmdletBase /// /// - protected override AzureSqlElasticPoolRecommendationAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlElasticPoolRecommendationAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlElasticPoolRecommendationAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationAdapter.cs index 2b15c93701cc..64465283eff9 100644 --- a/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationAdapter.cs @@ -14,8 +14,9 @@ using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.RecommendedElasticPools.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationCommunicator.cs index 7e47e912fa1e..d09065d9cd5e 100644 --- a/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/RecommendedElasticPools/Services/AzureSqlElasticPoolRecommendationCommunicator.cs @@ -14,9 +14,11 @@ using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; namespace Microsoft.Azure.Commands.Sql.RecommendedElasticPools.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseCopyCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseCopyCmdletBase.cs index 8338e66a197d..dcc621459b5e 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseCopyCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseCopyCmdletBase.cs @@ -17,6 +17,7 @@ using Microsoft.Azure.Commands.Sql.ReplicationLink.Services; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Sql.Replication.Cmdlet { @@ -37,7 +38,7 @@ public abstract class AzureSqlDatabaseCopyCmdletBase : AzureSqlCmdletBase /// The Azure Subscription /// A replication Adapter object - protected override AzureSqlDatabaseReplicationAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlDatabaseReplicationAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlDatabaseReplicationAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseSecondaryCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseSecondaryCmdletBase.cs index 0e467bdebf1a..4c1b4ce1799d 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseSecondaryCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/AzureSqlDatabaseSecondaryCmdletBase.cs @@ -17,6 +17,7 @@ using Microsoft.Azure.Commands.Sql.ReplicationLink.Services; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Sql.Replication.Cmdlet { @@ -37,7 +38,7 @@ public abstract class AzureSqlDatabaseSecondaryCmdletBase : AzureSqlCmdletBase /// /// A replication Adapter object - protected override AzureSqlDatabaseReplicationAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlDatabaseReplicationAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlDatabaseReplicationAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationAdapter.cs index 0316ae83dc89..3bad7e3ab339 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationAdapter.cs @@ -21,13 +21,14 @@ using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Server.Services; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Sql.ReplicationLink.Services { diff --git a/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationCommunicator.cs index 698f6cc8e4e8..bff667b742bd 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Replication/Services/AzureSqlDatabaseReplicationCommunicator.cs @@ -13,14 +13,16 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Sql.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using Microsoft.WindowsAzure.Management.Storage; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Sql.ReplicationLink.Services { diff --git a/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Cmdlet/SqlDatabaseSecureConnectionCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Cmdlet/SqlDatabaseSecureConnectionCmdletBase.cs index df9906657e5f..3cd19b1666a9 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Cmdlet/SqlDatabaseSecureConnectionCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Cmdlet/SqlDatabaseSecureConnectionCmdletBase.cs @@ -12,10 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.SecureConnection.Model; using Microsoft.Azure.Commands.Sql.SecureConnection.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.SecureConnection.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SecureConnectionEndpointsCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SecureConnectionEndpointsCommunicator.cs index f6d0fe9aaab8..865e4abad700 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SecureConnectionEndpointsCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SecureConnectionEndpointsCommunicator.cs @@ -12,11 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.SecureConnection.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SqlSecureConnectionAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SqlSecureConnectionAdapter.cs index 0a57f130ab20..8b681aab82d5 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SqlSecureConnectionAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Secure Connection/Services/SqlSecureConnectionAdapter.cs @@ -14,9 +14,10 @@ using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.SecureConnection.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; using System; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Sql.SecureConnection.Services { diff --git a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/AzureSqlServerCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/AzureSqlServerCmdletBase.cs index 970d9527c683..68250d5d8ac5 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/AzureSqlServerCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/AzureSqlServerCmdletBase.cs @@ -13,10 +13,10 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Server.Model; -using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Sql.Server.Cmdlet { @@ -29,7 +29,7 @@ public abstract class AzureSqlServerCmdletBase : AzureSqlCmdletBaseThe server adapter protected override AzureSqlServerAdapter InitModelAdapter(AzureSubscription subscription) { - return new AzureSqlServerAdapter(DefaultProfile.Context); + return new AzureSqlServerAdapter(DefaultContext); } } } diff --git a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs index 7e0bebfd8d1b..c451a273015f 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs @@ -16,8 +16,9 @@ using System.IO; using System.Management.Automation; using System.Reflection; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Sql.Server.Model; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.Azure.Commands.Sql.Server.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerAdapter.cs index a1ef2d04967f..bd076b7ec1ea 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerAdapter.cs @@ -18,11 +18,12 @@ using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.Server.Model; using Microsoft.Azure.Commands.Sql.Server.Services; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; @@ -46,8 +47,7 @@ public class AzureSqlServerAdapter /// /// Constructs a server adapter /// - /// The current azure profile - /// The current azure subscription + /// The current azure profile public AzureSqlServerAdapter(AzureContext context) { Context = context; diff --git a/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerCommunicator.cs index 11d32f26ca2d..03330e083ba9 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Server/Services/AzureSqlServerCommunicator.cs @@ -12,14 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using Microsoft.WindowsAzure.Management.Storage; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.Server.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs index 428ef281d841..6670aa420109 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model; using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Services; @@ -38,7 +39,7 @@ public abstract class AzureSqlServerActiveDirectoryAdministratorCmdletBase : Azu /// /// /// - protected override AzureSqlServerActiveDirectoryAdministratorAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlServerActiveDirectoryAdministratorAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlServerActiveDirectoryAdministratorAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs index 9176486d5ee9..3dfc4bae03e2 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs @@ -17,15 +17,16 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model; using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using MicrosoftAzureCommandsResources::Microsoft.Azure.Commands.Resources.Models.ActiveDirectory; namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs index 2453f62263ea..f93bf77a6e45 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs @@ -14,9 +14,11 @@ using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Cmdlet/AzureSqlServerCommunicationLinkCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Cmdlet/AzureSqlServerCommunicationLinkCmdletBase.cs index 8db1b8be2fc8..64c13455ab63 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Cmdlet/AzureSqlServerCommunicationLinkCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Cmdlet/AzureSqlServerCommunicationLinkCmdletBase.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServerCommunicationLink.Model; using Microsoft.Azure.Commands.Sql.ServerCommunicationLink.Services; @@ -37,7 +38,7 @@ public abstract class AzureSqlServerCommunicationLinkCmdletBase : AzureSqlCmdlet /// /// The subscription /// Link adapter for ServerCommunicationLink - protected override AzureSqlServerCommunicationLinkAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + protected override AzureSqlServerCommunicationLinkAdapter InitModelAdapter(AzureSubscription subscription) { return new AzureSqlServerCommunicationLinkAdapter(DefaultProfile.Context); } diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkAdapter.cs index e9156fb5c540..a75b1e42e830 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkAdapter.cs @@ -15,12 +15,13 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Database.Model; using Microsoft.Azure.Commands.Sql.Database.Services; using Microsoft.Azure.Commands.Sql.ServerCommunicationLink.Model; using Microsoft.Azure.Commands.Sql.Server.Adapter; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.ServerCommunicationLink.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkCommunicator.cs index accd6cb70623..c0c4500aeb75 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkCommunicator.cs @@ -12,14 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using Microsoft.WindowsAzure.Management.Storage; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.ServerCommunicationLink.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Cmdlet/AzureSqlServerUpgradeCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Cmdlet/AzureSqlServerUpgradeCmdletBase.cs index 42fbe5a51486..28770663fc4b 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Cmdlet/AzureSqlServerUpgradeCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Cmdlet/AzureSqlServerUpgradeCmdletBase.cs @@ -14,9 +14,10 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServerUpgrade.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.ServerUpgrade.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeAdapter.cs index 7daccb1ae5b6..e868c8a3f082 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeAdapter.cs @@ -13,9 +13,10 @@ // ---------------------------------------------------------------------------------- using System; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.ServerUpgrade.Model; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.ServerUpgrade.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeCommunicator.cs index d631fcb4a0aa..656cea37e936 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServerUpgrade/Services/AzureSqlServerUpgradeCommunicator.cs @@ -15,10 +15,12 @@ using System; using System.Net; using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServerUpgrade.Model; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; @@ -52,8 +54,7 @@ public class AzureSqlServerUpgradeCommunicator /// /// Creates a communicator for Azure Sql Databases /// - /// - /// + /// public AzureSqlServerUpgradeCommunicator(AzureContext context) { Context = context; diff --git a/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Cmdlet/AzureSqlServerServiceObjectiveCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Cmdlet/AzureSqlServerServiceObjectiveCmdletBase.cs index 8a76daae9105..3b9327e01619 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Cmdlet/AzureSqlServerServiceObjectiveCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Cmdlet/AzureSqlServerServiceObjectiveCmdletBase.cs @@ -13,10 +13,11 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServiceObjective.Adapter; using Microsoft.Azure.Commands.Sql.ServiceObjective.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.ServiceObjective.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveAdapter.cs index 29b0e30d323f..dfc98b6518d1 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveAdapter.cs @@ -18,11 +18,12 @@ using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServiceObjective.Model; using Microsoft.Azure.Commands.Sql.ServiceObjective.Services; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveCommunicator.cs index dc6482731f7a..31d31277c30d 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServiceObjective/Service/AzureSqlServerServiceObjectiveCommunicator.cs @@ -12,14 +12,16 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using Microsoft.WindowsAzure.Management.Storage; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.ServiceObjective.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeDatabaseHint.cs b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeDatabaseHint.cs index e446b6e0c3d0..ddf6a9958239 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeDatabaseHint.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeDatabaseHint.cs @@ -14,9 +14,10 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Cmdlet diff --git a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeServerHint.cs b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeServerHint.cs index 179803015a24..d9be2775abea 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeServerHint.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Cmdlet/GetAzureSqlUpgradeServerHint.cs @@ -13,11 +13,12 @@ // ---------------------------------------------------------------------------------- using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.RecommendedElasticPools.Services; using Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Model; using Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorAdapter.cs index e81e63de2f18..49c01259b258 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorAdapter.cs @@ -14,8 +14,9 @@ using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; namespace Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorCommunicator.cs index dd74ebdbbb78..4b381a4fd6e2 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ServiceTierAdvisor/Services/AzureSqlServiceTierAdvisorCommunicator.cs @@ -14,9 +14,11 @@ using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; namespace Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Cmdlet/SqlDatabaseThreatDetectionCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Cmdlet/SqlDatabaseThreatDetectionCmdletBase.cs index e53f1926a48c..0ae708369ace 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Cmdlet/SqlDatabaseThreatDetectionCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Cmdlet/SqlDatabaseThreatDetectionCmdletBase.cs @@ -12,10 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.ThreatDetection.Model; using Microsoft.Azure.Commands.Sql.ThreatDetection.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.ThreatDetection.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/SqlThreatDetectionAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/SqlThreatDetectionAdapter.cs index 7ef6cac7e05a..ebe998793712 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/SqlThreatDetectionAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/SqlThreatDetectionAdapter.cs @@ -12,12 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Auditing.Model; using Microsoft.Azure.Commands.Sql.Auditing.Services; using Microsoft.Azure.Commands.Sql.Common; diff --git a/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/ThreatDetectionEndpointsCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/ThreatDetectionEndpointsCommunicator.cs index 76bf11e67b9b..42b5fb756626 100644 --- a/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/ThreatDetectionEndpointsCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/ThreatDetectionEndpointsCommunicator.cs @@ -12,11 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; using System; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; namespace Microsoft.Azure.Commands.Sql.ThreatDetection.Services diff --git a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionActivityCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionActivityCmdletBase.cs index 5d816281adc8..cfd2044ed1e0 100644 --- a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionActivityCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionActivityCmdletBase.cs @@ -14,10 +14,11 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Adapter; using Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionCmdletBase.cs index d3f8a80fe729..d6ed867ee7e1 100644 --- a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionCmdletBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Cmdlet/AzureSqlDatabaseTransparentDataEncryptionCmdletBase.cs @@ -14,10 +14,11 @@ using System.Collections.Generic; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Adapter; using Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Cmdlet { diff --git a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionAdapter.cs index 797090507571..5c44ddd12660 100644 --- a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionAdapter.cs +++ b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionAdapter.cs @@ -15,11 +15,12 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Sql.Common; using Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Model; using Microsoft.Azure.Commands.Sql.TransparentDataEncryption.Services; using Microsoft.Azure.Commands.Sql.Services; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionCommunicator.cs index 64d78f415e78..8937000bd405 100644 --- a/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionCommunicator.cs +++ b/src/ResourceManager/Sql/Commands.Sql/TransparentDataEncryption/Services/AzureSqlDatabaseTransparentDataEncryptionCommunicator.cs @@ -14,8 +14,10 @@ using System; using System.Collections.Generic; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Sql; using Microsoft.Azure.Management.Sql.Models; diff --git a/src/ResourceManager/Sql/Commands.Sql/packages.config b/src/ResourceManager/Sql/Commands.Sql/packages.config index e8cb4e3a1926..b0623f1a1ea6 100644 --- a/src/ResourceManager/Sql/Commands.Sql/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ResourceManager/Sql/Sql.sln b/src/ResourceManager/Sql/Sql.sln index 8dcf5b48785b..33f312fe6aa6 100644 --- a/src/ResourceManager/Sql/Sql.sln +++ b/src/ResourceManager/Sql/Sql.sln @@ -32,6 +32,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights", "..\Ins EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -94,6 +96,10 @@ Global {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj b/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj index 4bb8a2010c92..9b96dbcc44b9 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj +++ b/src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj @@ -41,10 +41,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -75,16 +71,16 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True False ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -135,6 +131,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3436a126-edc9-4060-8952-9a1be34cdd95} Commands.ScenarioTests.ResourceManager.Common diff --git a/src/ResourceManager/Storage/Commands.Management.Storage.Test/TestController.cs b/src/ResourceManager/Storage/Commands.Management.Storage.Test/TestController.cs index a17028781d2e..b340f5e84b56 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage.Test/TestController.cs +++ b/src/ResourceManager/Storage/Commands.Management.Storage.Test/TestController.cs @@ -15,7 +15,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; @@ -82,6 +82,8 @@ public void RunPsTestWorkflow( { Dictionary d = new Dictionary(); d.Add("Microsoft.Authorization", null); + d.Add("Microsoft.Storage", null); + HttpMockServer.Matcher = new PermissiveRecordMatcherWithApiExclusion(false, d); using (UndoContext context = UndoContext.Current) diff --git a/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config b/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config index 6263612efef3..98b4e1ce9a32 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config +++ b/src/ResourceManager/Storage/Commands.Management.Storage.Test/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj index 0377e5724117..a31fe3054228 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj +++ b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj @@ -53,10 +53,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -88,15 +84,15 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -172,6 +168,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/StorageManagementClient.cs b/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/StorageManagementClient.cs index 45b1307297f7..3fa53f64e691 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/StorageManagementClient.cs +++ b/src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/StorageManagementClient.cs @@ -13,8 +13,8 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.Storage; namespace Microsoft.Azure.Commands.Management.Storage diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/packages.config b/src/ResourceManager/Storage/Commands.Management.Storage/packages.config index 7a66eb206774..62fa0467fb0b 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/packages.config +++ b/src/ResourceManager/Storage/Commands.Management.Storage/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ResourceManager/Storage/Storage.sln b/src/ResourceManager/Storage/Storage.sln index 5a911f49a400..732453752896 100644 --- a/src/ResourceManager/Storage/Storage.sln +++ b/src/ResourceManager/Storage/Storage.sln @@ -26,6 +26,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -76,6 +78,10 @@ Global {8058D403-06E3-4BED-8924-D166CE303961}.Debug|Any CPU.Build.0 = Debug|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.ActiveCfg = Release|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj index f02811fca677..e8e1893959a2 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -48,10 +48,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -100,12 +96,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -175,6 +171,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs index 7fa1fc97e9ec..7c72a2e80393 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config index cf29232eed64..ebffe627d5f7 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config @@ -2,7 +2,6 @@ - @@ -19,8 +18,8 @@ - - + + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index 10bdca9a79ee..7f5fb8048b57 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -93,12 +89,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -224,6 +220,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs index 045121b801f7..f5c2278a1cdc 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs @@ -13,10 +13,9 @@ // ---------------------------------------------------------------------------------- using System.IO; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.StreamAnalytics; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.StreamAnalytics.Models { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs index df745c2a5e7d..7817aeec85db 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs @@ -17,10 +17,9 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.StreamAnalytics.Properties; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; -using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.StreamAnalytics { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config index 9df41525bf19..4e38d37a1677 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ResourceManager/StreamAnalytics/StreamAnalytics.sln b/src/ResourceManager/StreamAnalytics/StreamAnalytics.sln index 9d241c5dc78e..7bd69765947d 100644 --- a/src/ResourceManager/StreamAnalytics/StreamAnalytics.sln +++ b/src/ResourceManager/StreamAnalytics/StreamAnalytics.sln @@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -82,6 +84,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj index 545a6fc545a7..71f42ae15d12 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj +++ b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -73,12 +69,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -161,6 +157,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs b/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs index 3c9d66e3c0ad..376fef3f8b01 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs +++ b/src/ResourceManager/Tags/Commands.Tags/Model/TagsClient.cs @@ -15,13 +15,12 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Tags.Properties; using Microsoft.Azure.Management.Resources; using Microsoft.Azure.Management.Resources.Models; -using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.Tags.Model { diff --git a/src/ResourceManager/Tags/Commands.Tags/packages.config b/src/ResourceManager/Tags/Commands.Tags/packages.config index 377dbc50a2f5..053452276ede 100644 --- a/src/ResourceManager/Tags/Commands.Tags/packages.config +++ b/src/ResourceManager/Tags/Commands.Tags/packages.config @@ -2,7 +2,6 @@ - @@ -10,8 +9,8 @@ - - + + \ No newline at end of file diff --git a/src/ResourceManager/Tags/Tags.sln b/src/ResourceManager/Tags/Tags.sln index d4527bd8a3d9..9b83adc467af 100644 --- a/src/ResourceManager/Tags/Tags.sln +++ b/src/ResourceManager/Tags/Tags.sln @@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "Commands.T EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,6 +28,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager.Test.csproj b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager.Test.csproj index 6f855ca30a6b..d209d93111c0 100644 --- a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager.Test.csproj +++ b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager.Test.csproj @@ -45,10 +45,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -76,6 +72,7 @@ False ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -83,12 +80,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -104,7 +101,9 @@ False + + @@ -156,6 +155,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/TestController.cs b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/TestController.cs index f8f894c3a1bb..22be15d816b3 100644 --- a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/TestController.cs +++ b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/TestController.cs @@ -13,13 +13,13 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test.HttpRecorder; namespace Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests { using System; using System.Linq; - using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/packages.config b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/packages.config index a12ac64d64d4..4932e3d2a910 100644 --- a/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/packages.config +++ b/src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Commands.TrafficManager.csproj b/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Commands.TrafficManager.csproj index 61e14de3ef50..0ab7ae1a975e 100644 --- a/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Commands.TrafficManager.csproj +++ b/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Commands.TrafficManager.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Management.TrafficManager.1.0.0\lib\portable-net45+sl50+wp80+win\Microsoft.Azure.Management.TrafficManager.dll @@ -65,6 +61,15 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + False ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll @@ -77,19 +82,13 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - + + @@ -124,6 +123,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Utilities/TrafficManagerClient.cs b/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Utilities/TrafficManagerClient.cs index 65746683a749..a957b3705b7b 100644 --- a/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Utilities/TrafficManagerClient.cs +++ b/src/ResourceManager/TrafficManager/Commands.TrafficManager2/Utilities/TrafficManagerClient.cs @@ -12,6 +12,9 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + namespace Microsoft.Azure.Commands.TrafficManager.Utilities { using System; @@ -19,12 +22,10 @@ namespace Microsoft.Azure.Commands.TrafficManager.Utilities using System.Collections.Generic; using System.Linq; using System.Net; - using Microsoft.Azure.Commands.Tags.Model; - using Microsoft.Azure.Commands.TrafficManager.Models; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; - using Microsoft.Azure.Management.TrafficManager; - using Microsoft.Azure.Management.TrafficManager.Models; + using Tags.Model; + using Models; + using Management.TrafficManager; + using Management.TrafficManager.Models; public class TrafficManagerClient { diff --git a/src/ResourceManager/TrafficManager/Commands.TrafficManager2/packages.config b/src/ResourceManager/TrafficManager/Commands.TrafficManager2/packages.config index 7cc84f7246b6..23ef0d812519 100644 --- a/src/ResourceManager/TrafficManager/Commands.TrafficManager2/packages.config +++ b/src/ResourceManager/TrafficManager/Commands.TrafficManager2/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ResourceManager/TrafficManager/TrafficManager.sln b/src/ResourceManager/TrafficManager/TrafficManager.sln index 86bd2ca81848..541eb88e351f 100644 --- a/src/ResourceManager/TrafficManager/TrafficManager.sln +++ b/src/ResourceManager/TrafficManager/TrafficManager.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Commands.UsageAggregates.Test.csproj b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Commands.UsageAggregates.Test.csproj index b45a02f80f27..d020df0706ee 100644 --- a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Commands.UsageAggregates.Test.csproj +++ b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Commands.UsageAggregates.Test.csproj @@ -47,10 +47,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll True - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll True @@ -71,12 +67,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -89,7 +85,9 @@ ..\..\..\packages\System.Management.Automation_PowerShell_3.0.6.3.9600.17400\lib\net40\System.Management.Automation.dll True + + @@ -118,6 +116,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} Commands.ResourceManager.Common diff --git a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Common/UsageAggregatesTestController.cs b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Common/UsageAggregatesTestController.cs index 728f1fac528a..3af1878dd57f 100644 --- a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Common/UsageAggregatesTestController.cs +++ b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/Common/UsageAggregatesTestController.cs @@ -17,7 +17,7 @@ using System; using System.Linq; using Microsoft.Azure.Commerce.UsageAggregates; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.UsageAggregates.Test.ScenarioTests { diff --git a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/packages.config b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/packages.config index 5465efef8053..251a96f733f4 100644 --- a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/packages.config +++ b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates.Test/packages.config @@ -3,7 +3,6 @@ - @@ -12,8 +11,8 @@ - - + + diff --git a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/Commands.UsageAggregates.csproj b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/Commands.UsageAggregates.csproj index 125b83993d95..307b0b65aa70 100644 --- a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/Commands.UsageAggregates.csproj +++ b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/Commands.UsageAggregates.csproj @@ -48,10 +48,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll True - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -63,6 +59,14 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -76,14 +80,6 @@ ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -119,6 +115,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/GetUsageAggregatesCommand.cs b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/GetUsageAggregatesCommand.cs index ea21798b839b..658708121308 100644 --- a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/GetUsageAggregatesCommand.cs +++ b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/GetUsageAggregatesCommand.cs @@ -13,14 +13,13 @@ // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commerce.UsageAggregates; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; namespace Microsoft.Azure.Commands.UsageAggregates { using Commerce.UsageAggregates.Models; - using WindowsAzure.Commands.Utilities.Common; using System; using System.Management.Automation; using ResourceManager.Common; diff --git a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/packages.config b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/packages.config index dfbd20cf1d2c..7342bc2ef421 100644 --- a/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/packages.config +++ b/src/ResourceManager/UsageAggregates/Commands.UsageAggregates/packages.config @@ -3,14 +3,13 @@ - - - + + \ No newline at end of file diff --git a/src/ResourceManager/UsageAggregates/UsageAggregates.sln b/src/ResourceManager/UsageAggregates/UsageAggregates.sln index 1f0626abd5e7..2b6b7326cd03 100644 --- a/src/ResourceManager/UsageAggregates/UsageAggregates.sln +++ b/src/ResourceManager/UsageAggregates/UsageAggregates.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +48,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj b/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj index acb32e0c3634..888fad7b9837 100644 --- a/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj +++ b/src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj @@ -48,10 +48,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -65,8 +61,7 @@ True - False - ..\..\..\packages\Microsoft.Azure.Management.Websites.1.0.2-preview\lib\net45\Microsoft.Azure.Management.Websites.dll + ..\..\..\packages\Microsoft.Azure.Management.Websites.1.1.0-preview\lib\net45\Microsoft.Azure.Management.Websites.dll True @@ -78,8 +73,9 @@ False ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.4.0-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.0-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + True False @@ -89,23 +85,16 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll True - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.2.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll True @@ -269,6 +258,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebsitesController.cs b/src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebsitesController.cs index a2ada540f1fd..f29834ec72a2 100644 --- a/src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebsitesController.cs +++ b/src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebsitesController.cs @@ -15,7 +15,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.Azure.Gallery; using Microsoft.Azure.Management.Authorization; using Microsoft.Azure.Management.Resources; diff --git a/src/ResourceManager/Websites/Commands.Websites.Test/packages.config b/src/ResourceManager/Websites/Commands.Websites.Test/packages.config index d74426bfa619..c39ea0dd9cda 100644 --- a/src/ResourceManager/Websites/Commands.Websites.Test/packages.config +++ b/src/ResourceManager/Websites/Commands.Websites.Test/packages.config @@ -2,23 +2,21 @@ - - + - + - - - - + + + diff --git a/src/ResourceManager/Websites/Commands.Websites/Commands.Websites.csproj b/src/ResourceManager/Websites/Commands.Websites/Commands.Websites.csproj index 0953e2ce74c8..8e7192cfb386 100644 --- a/src/ResourceManager/Websites/Commands.Websites/Commands.Websites.csproj +++ b/src/ResourceManager/Websites/Commands.Websites/Commands.Websites.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -75,7 +71,7 @@ True - ..\..\..\packages\Microsoft.Azure.Management.Websites.1.0.2-preview\lib\net45\Microsoft.Azure.Management.Websites.dll + ..\..\..\packages\Microsoft.Azure.Management.Websites.1.1.0-preview\lib\net45\Microsoft.Azure.Management.Websites.dll True @@ -91,17 +87,16 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - False - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.0.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -208,6 +203,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs b/src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs index 26f0ae41602b..93a3182bc835 100644 --- a/src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs +++ b/src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs @@ -20,8 +20,8 @@ using System.Xml.Linq; using Microsoft.Azure.Commands.Resources.Models; using Microsoft.Azure.Commands.WebApps.Models.WebApp; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.Resources.Models; using Microsoft.Azure.Management.WebSites; using Microsoft.Azure.Management.WebSites.Models; diff --git a/src/ResourceManager/Websites/Commands.Websites/packages.config b/src/ResourceManager/Websites/Commands.Websites/packages.config index bd1efd72c13e..1a8a5ceb792e 100644 --- a/src/ResourceManager/Websites/Commands.Websites/packages.config +++ b/src/ResourceManager/Websites/Commands.Websites/packages.config @@ -2,20 +2,19 @@ - - + - - - + + + \ No newline at end of file diff --git a/src/ResourceManager/Websites/WebSites.sln b/src/ResourceManager/Websites/WebSites.sln index e9c3057d83e7..ad7755c6200e 100644 --- a/src/ResourceManager/Websites/WebSites.sln +++ b/src/ResourceManager/Websites/WebSites.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj b/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj index 9c36c7630f16..061c5871dbb4 100644 --- a/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj +++ b/src/ServiceManagement/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj @@ -56,10 +56,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -71,6 +67,7 @@ ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -79,12 +76,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -125,6 +122,7 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True @@ -182,6 +180,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3b48a77b-5956-4a62-9081-92ba04b02b27} Commands.Common.Test diff --git a/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config b/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config index 579b7b14150a..62c3e7d2f9d3 100644 --- a/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config +++ b/src/ServiceManagement/Automation/Commands.Automation.Test/packages.config @@ -2,7 +2,6 @@ - @@ -11,8 +10,8 @@ - - + + diff --git a/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj b/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj index 740ad8b26bbb..1b1ced1fff8d 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj +++ b/src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj @@ -58,10 +58,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -69,6 +65,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -77,12 +74,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -221,6 +218,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs b/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs index 82184d13ffdc..0eef97cef3b6 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs @@ -26,7 +26,7 @@ using Microsoft.WindowsAzure.Management.Automation; using Microsoft.WindowsAzure.Management.Automation.Models; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Newtonsoft.Json; using Runbook = Microsoft.Azure.Commands.Automation.Model.Runbook; @@ -43,7 +43,7 @@ namespace Microsoft.Azure.Commands.Automation.Common { using AutomationManagement = WindowsAzure.Management.Automation; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; diff --git a/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs b/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs index c3340971401d..66c43f63cba8 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs +++ b/src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs @@ -17,7 +17,7 @@ using System.Collections.Generic; using System.Security; using Microsoft.Azure.Commands.Automation.Model; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.Azure.Commands.Automation.Common { diff --git a/src/ServiceManagement/Automation/Commands.Automation/packages.config b/src/ServiceManagement/Automation/Commands.Automation/packages.config index 2b7b2c57251a..8a9bbcdc1ee1 100644 --- a/src/ServiceManagement/Automation/Commands.Automation/packages.config +++ b/src/ServiceManagement/Automation/Commands.Automation/packages.config @@ -2,7 +2,6 @@ - @@ -10,8 +9,8 @@ - - + + diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Commands.Common.Test.csproj b/src/ServiceManagement/Common/Commands.Common.Test/Commands.Common.Test.csproj index 3d78379a4325..715a8f80e416 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Commands.Common.Test.csproj +++ b/src/ServiceManagement/Common/Commands.Common.Test/Commands.Common.Test.csproj @@ -57,10 +57,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -100,12 +96,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -216,6 +212,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs index 4b4c290dcc3c..f276b4b874ea 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/AuthenticationFactoryTests.cs @@ -15,10 +15,10 @@ using System.Collections.Generic; using Xunit; using System; -using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Factories; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs index 87314b849519..07d789885e56 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/ConversionUtilitiesTests.cs @@ -15,7 +15,7 @@ using System.Collections.Generic; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.WindowsAzure.Commands.Common.Test diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs index 65a7e521ebbd..d2a32c7deac5 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs index 28f542f5e29d..ecf4d84ca247 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs @@ -16,7 +16,7 @@ using System.IO; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/GetTestResource.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/GetTestResource.cs index 8653d830c435..ecdae266f54a 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/GetTestResource.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/GetTestResource.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management; using System.Management.Automation; diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs index f38950eff747..c7d4e43ddf7e 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/JsonUtilitiesTests.cs @@ -19,7 +19,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/MockSubsciptionFactory.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/MockSubsciptionFactory.cs index 300b9bef83ed..8572aec6ff4e 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/MockSubsciptionFactory.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/MockSubsciptionFactory.cs @@ -17,31 +17,32 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using System.Net.Http; using System.Net.Http.Headers; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common { public class MockSubsciptionFactory : IClientFactory { - public void AddAction(Azure.Common.Authentication.Models.IClientAction action) + public void AddAction(IClientAction action) { throw new NotImplementedException(); } - public TClient CreateClient(Azure.Common.Authentication.Models.AzureSMProfile profile, Azure.Common.Authentication.Models.AzureSubscription subscription, Azure.Common.Authentication.Models.AzureEnvironment.Endpoint endpoint) where TClient : Hyak.Common.ServiceClient + public TClient CreateClient(AzureSMProfile profile, AzureSubscription subscription, AzureEnvironment.Endpoint endpoint) where TClient : Hyak.Common.ServiceClient { throw new NotImplementedException(); } - public TClient CreateClient(Azure.Common.Authentication.Models.AzureSMProfile profile, Azure.Common.Authentication.Models.AzureEnvironment.Endpoint endpoint) where TClient : Hyak.Common.ServiceClient + public TClient CreateClient(AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : Hyak.Common.ServiceClient { throw new NotImplementedException(); } - public TClient CreateClient(Azure.Common.Authentication.Models.AzureContext context, Azure.Common.Authentication.Models.AzureEnvironment.Endpoint endpoint) where TClient : Hyak.Common.ServiceClient + public TClient CreateClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : Hyak.Common.ServiceClient { throw new NotImplementedException(); } @@ -89,7 +90,7 @@ public void AddUserAgent(string productName) public HashSet UserAgents { get; set; } - public TClient CreateArmClient(Azure.Common.Authentication.Models.AzureContext context, Azure.Common.Authentication.Models.AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient + public TClient CreateArmClient(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient { throw new NotImplementedException(); } diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/PSCmdletTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/PSCmdletTests.cs index 91b2deadd50c..ae994ce1dbed 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/PSCmdletTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/PSCmdletTests.cs @@ -17,7 +17,7 @@ using System.Linq; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.Azure.Management.Resources; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; @@ -26,7 +26,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Factories; using System.Net.Http; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/ProfileClientTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/ProfileClientTests.cs index 9b7c7051491e..d17327bd538f 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/ProfileClientTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/ProfileClientTests.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Subscriptions.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using System; @@ -21,6 +21,7 @@ using System.IO; using System.Linq; using System.Security.Cryptography.X509Certificates; +using Microsoft.Azure.ServiceManagemenet.Common; using Xunit; using CSMSubscription = Microsoft.Azure.Subscriptions.Models.Subscription; using RDFESubscription = Microsoft.WindowsAzure.Subscriptions.Models.SubscriptionListOperationResponse.Subscription; diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs index aea3d567dfd0..98cc0bd86704 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/RemoveAzurePublishSettings.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs index 7413e8fbc9d2..d41f59b839ea 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/ServicePrincipalStoreTests.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ScenarioTest; using System; using System.Runtime.InteropServices; diff --git a/src/ServiceManagement/Common/Commands.Common.Test/packages.config b/src/ServiceManagement/Common/Commands.Common.Test/packages.config index 44802be0be42..b3778c725d74 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/packages.config +++ b/src/ServiceManagement/Common/Commands.Common.Test/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs index 77a896390d9e..33669ca6cbfd 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/AutomationTests/AutomationTests.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj b/src/ServiceManagement/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj index 3165458525e8..8620540d600a 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj @@ -47,10 +47,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -88,12 +84,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -559,6 +555,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {58a78f29-8c0c-4a5e-893e-3953c0f29c8a} Commands.ServiceManagement.Test diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs index 58adba721dd6..50226602f880 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Common.Test.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest.Resources; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.Common { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs index 6690b5a08568..f9f7fb6fce85 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/ServiceManagementTestEnvironmentFactory.cs @@ -19,12 +19,10 @@ using System.Linq; using System.Security.Cryptography.X509Certificates; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.XmlSchema; +using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; using Microsoft.Azure; +using Microsoft.Azure.ServiceManagement.Common.XmlSchema; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.Common { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs index 3b221e0cab27..dd868f93b38f 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/WindowsAzurePowerShellCertificateTest.cs @@ -22,8 +22,8 @@ using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.Common { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs index 4bbe3c544681..cc51fa0365aa 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/AddAccountForArmTests.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; using Xunit.Extensions; diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs index d731e743012f..f152a946eef8 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestBase.cs @@ -16,7 +16,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.CredentialTests { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs index e934e754a4f1..8fdca9d93b27 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/CredentialTests/CredentialTestHelper.cs @@ -19,8 +19,8 @@ using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using System.IO; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.CredentialTests diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/DiagnosticsExtension/DiagnosticsExtensionTests.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/DiagnosticsExtension/DiagnosticsExtensionTests.cs index 673206220644..80e8305051db 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/DiagnosticsExtension/DiagnosticsExtensionTests.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/DiagnosticsExtension/DiagnosticsExtensionTests.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Management; diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/DscExtension/DscExtensionTests.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/DscExtension/DscExtensionTests.cs index 93edb1a08323..807f85a8d325 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/DscExtension/DscExtensionTests.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/DscExtension/DscExtensionTests.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Management.Network; using Microsoft.WindowsAzure.Management.Storage; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs index bf53f66978f2..d87e65142727 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/Scheduler/SchedulerTests.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System; namespace Microsoft.WindowsAzure.Commands.ScenarioTest diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/ServiceManagement/ServiceManagementTests.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/ServiceManagement/ServiceManagementTests.cs index 25dcb7526085..3791840ee312 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/ServiceManagement/ServiceManagementTests.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/ServiceManagement/ServiceManagementTests.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Management; using Microsoft.WindowsAzure.Management.Compute; diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs index 7e7b3faec9bd..b9a72630e9e5 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/TrafficManagerTests/TrafficManagerTests.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Test; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System; namespace Microsoft.WindowsAzure.Commands.ScenarioTest diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs index a3a67be61971..b7f97d4e5500 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/WebsitesTests/WebsitesTestsBase.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Management.WebSites; using Microsoft.Azure.Test; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.WebsitesTests { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/packages.config b/src/ServiceManagement/Common/Commands.ScenarioTest/packages.config index b2f9859a5063..1681b1079b72 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/packages.config +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/AzureSMCmdlet.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/AzureSMCmdlet.cs index d120c2259d6c..0d7b7eb29278 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/AzureSMCmdlet.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/AzureSMCmdlet.cs @@ -18,8 +18,8 @@ using System.Diagnostics; using System.IO; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Properties; @@ -27,6 +27,8 @@ using System.Threading; using System.Management.Automation.Host; using System.Globalization; +using System.Net.Http.Headers; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { @@ -52,6 +54,7 @@ private get } } + protected override AzureContext DefaultContext { get { return CurrentProfile.Context; } } static AzureSMCmdlet() @@ -126,7 +129,7 @@ protected override void InitializeQosEvent() commandAlias = this.MyInvocation.MyCommand.Name; } - QosEvent = new AzurePSQoSEvent() + _qosEvent = new AzurePSQoSEvent() { CommandName = commandAlias, ModuleName = this.GetType().Assembly.GetName().Name, @@ -138,7 +141,7 @@ protected override void InitializeQosEvent() if (this.MyInvocation != null && this.MyInvocation.BoundParameters != null) { - QosEvent.Parameters = string.Join(" ", + _qosEvent.Parameters = string.Join(" ", this.MyInvocation.BoundParameters.Keys.Select( s => string.Format(CultureInfo.InvariantCulture, "-{0} ***", s))); } @@ -147,12 +150,12 @@ protected override void InitializeQosEvent() this.DefaultContext.Account != null && this.DefaultContext.Account.Id != null) { - QosEvent.Uid = MetricHelper.GenerateSha256HashString( + _qosEvent.Uid = MetricHelper.GenerateSha256HashString( this.DefaultContext.Account.Id.ToString()); } else { - QosEvent.Uid = "defaultid"; + _qosEvent.Uid = "defaultid"; } } @@ -179,5 +182,23 @@ protected virtual void InitializeProfile() AzureSMProfileProvider.Instance.SetTokenCacheForProfile(Profile); } } + + protected override void LogCmdletStartInvocationInfo() + { + base.LogCmdletStartInvocationInfo(); + if (DefaultContext != null && DefaultContext.Account != null + && DefaultContext.Account.Id != null) + { + WriteDebugWithTimestamp(string.Format("using account id '{0}'...", + DefaultContext.Account.Id)); + } + } + + protected override void LogCmdletEndInvocationInfo() + { + base.LogCmdletEndInvocationInfo(); + string message = string.Format("{0} end processing.", this.GetType().Name); + WriteDebugWithTimestamp(message); + } } } diff --git a/src/Common/Commands.Common/AzureSubscriptionExtensions.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/AzureSubscriptionExtensions.cs similarity index 93% rename from src/Common/Commands.Common/AzureSubscriptionExtensions.cs rename to src/ServiceManagement/Common/Commands.ServiceManagement.Common/AzureSubscriptionExtensions.cs index 7be35662bc98..0bd204a52a8e 100644 --- a/src/Common/Commands.Common/AzureSubscriptionExtensions.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/AzureSubscriptionExtensions.cs @@ -13,11 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common { diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/CloudBaseCmdlet.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/CloudBaseCmdlet.cs index d72f838a5cfa..3eb42161f612 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/CloudBaseCmdlet.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/CloudBaseCmdlet.cs @@ -20,8 +20,8 @@ using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.Security; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj index c7e0d7abe39b..c9d868b43cd6 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj @@ -63,10 +63,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -83,6 +79,14 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + False ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -103,14 +107,6 @@ ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll - True - @@ -143,8 +139,14 @@ + + + + + + @@ -155,6 +157,7 @@ + @@ -169,6 +172,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpClientExtensions.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpClientExtensions.cs index 4b75ea6ed796..02cb5fa042ee 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpClientExtensions.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpClientExtensions.cs @@ -17,7 +17,7 @@ using System.Net; using System.Net.Http; using System.Net.Http.Headers; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; using Newtonsoft.Json; diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpRestMessageInspector.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpRestMessageInspector.cs index 6d042451289c..84b3b3f45932 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpRestMessageInspector.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/HttpRestMessageInspector.cs @@ -21,6 +21,7 @@ using System.ServiceModel.Dispatcher; using System.Threading; using System.Xml.Linq; +using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { @@ -92,14 +93,14 @@ public HttpRestMessageInspector(Action logger) public virtual void AfterReceiveReply(ref Message reply, object correlationState) { HttpResponseMessageProperty prop = (HttpResponseMessageProperty)reply.Properties[HttpResponseMessageProperty.Name]; - string body = GeneralUtilities.ReadMessageBody(ref reply); + string body = ServiceManagementUtilities.ReadMessageBody(ref reply); logger(GeneralUtilities.GetHttpResponseLog(prop.StatusCode.ToString(), prop.Headers, body)); } public virtual object BeforeSendRequest(ref Message request, IClientChannel channel) { HttpRequestMessageProperty prop = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name]; - string body = GeneralUtilities.ReadMessageBody(ref request); + string body = ServiceManagementUtilities.ReadMessageBody(ref request); logger(GeneralUtilities.GetHttpRequestLog(prop.Method, request.Headers.To.AbsoluteUri, prop.Headers, body)); return request; diff --git a/src/Common/Commands.Common/PSAzureAccount.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/PSAzureAccount.cs similarity index 89% rename from src/Common/Commands.Common/PSAzureAccount.cs rename to src/ServiceManagement/Common/Commands.ServiceManagement.Common/PSAzureAccount.cs index c8d3f8f7c3ce..a9d9974e83a5 100644 --- a/src/Common/Commands.Common/PSAzureAccount.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/PSAzureAccount.cs @@ -13,8 +13,9 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication.Models; -namespace Microsoft.Azure.Common.Authentication.Models +namespace Microsoft.Azure.ServiceManagemenet.Common.Models { public class PSAzureAccount { diff --git a/src/Common/Commands.Common/ProfileClient.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/ProfileClient.cs similarity index 99% rename from src/Common/Commands.Common/ProfileClient.cs rename to src/ServiceManagement/Common/Commands.ServiceManagement.Common/ProfileClient.cs index 1128d28ebb1d..42067d20c876 100644 --- a/src/Common/Commands.Common/ProfileClient.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/ProfileClient.cs @@ -20,13 +20,14 @@ using System.Security; using System.Security.Cryptography.X509Certificates; using Hyak.Common; -using Microsoft.Azure.Common.Authentication.Factories; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Properties; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Subscriptions; -namespace Microsoft.Azure.Common.Authentication +namespace Microsoft.Azure.ServiceManagemenet.Common { /// /// Convenience client for azure profile and subscriptions. @@ -653,7 +654,7 @@ public AzureSubscription SetSubscriptionAsDefault(Guid id, string accountName) { if (subscription.IsPropertySet(AzureSubscription.Property.StorageAccount)) { - GeneralUtilities.ClearCurrentStorageAccount(); + ServiceManagementUtilities.ClearCurrentStorageAccount(); } Profile.DefaultSubscription = subscription; diff --git a/src/Common/Commands.Common/ProfileClientExtensions.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/ProfileClientExtensions.cs similarity index 93% rename from src/Common/Commands.Common/ProfileClientExtensions.cs rename to src/ServiceManagement/Common/Commands.ServiceManagement.Common/ProfileClientExtensions.cs index 6a33fdcdc430..33d279a5fd02 100644 --- a/src/Common/Commands.Common/ProfileClientExtensions.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/ProfileClientExtensions.cs @@ -12,9 +12,10 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common.Models; using System; using System.Collections.Generic; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Common { diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/PublishProfile.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/PublishProfile.cs new file mode 100644 index 000000000000..0ba815bb217d --- /dev/null +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/PublishProfile.cs @@ -0,0 +1,219 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17020 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System.Xml.Serialization; + +namespace Microsoft.Azure.ServiceManagement.Common.XmlSchema +{ + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [XmlType(AnonymousType = true)] + [XmlRoot(Namespace = "", IsNullable = false)] + public partial class PublishData + { + + private PublishDataPublishProfile[] itemsField; + + /// + [XmlElement("PublishProfile", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + public PublishDataPublishProfile[] Items + { + get + { + return this.itemsField; + } + set + { + this.itemsField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [XmlType(AnonymousType = true)] + public partial class PublishDataPublishProfile + { + + private PublishDataPublishProfileSubscription[] subscriptionField; + + private string publishMethodField; + + private string urlField; + + private string managementCertificateField; + + private string SchemaVersionField; + + /// + [XmlElement("Subscription", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + public PublishDataPublishProfileSubscription[] Subscription + { + get + { + return this.subscriptionField; + } + set + { + this.subscriptionField = value; + } + } + + /// + [XmlAttribute()] + public string PublishMethod + { + get + { + return this.publishMethodField; + } + set + { + this.publishMethodField = value; + } + } + + /// + [XmlAttribute()] + public string Url + { + get + { + return this.urlField; + } + set + { + this.urlField = value; + } + } + + /// + [XmlAttribute()] + public string ManagementCertificate + { + get + { + return this.managementCertificateField; + } + set + { + this.managementCertificateField = value; + } + } + + /// + [XmlAttribute()] + public string SchemaVersion + { + get + { + return this.SchemaVersionField; + } + set + { + this.SchemaVersionField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [XmlType(AnonymousType = true)] + public partial class PublishDataPublishProfileSubscription + { + + private string idField; + + private string nameField; + + private string serviceManagementUrlField; + + private string managementCertificateField; + + /// + [XmlAttribute()] + public string Id + { + get + { + return this.idField; + } + set + { + this.idField = value; + } + } + + /// + [XmlAttribute()] + public string Name + { + get + { + return this.nameField; + } + set + { + this.nameField = value; + } + } + + /// + [XmlAttribute()] + public string ServiceManagementUrl + { + get + { + return this.serviceManagementUrlField; + } + set + { + this.serviceManagementUrlField = value; + } + } + + /// + [XmlAttribute()] + public string ManagementCertificate + { + get + { + return this.managementCertificateField; + } + set + { + this.managementCertificateField = value; + } + } + } +} \ No newline at end of file diff --git a/src/Common/Commands.Common/PublishSettingsImporter.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/PublishSettingsImporter.cs similarity index 91% rename from src/Common/Commands.Common/PublishSettingsImporter.cs rename to src/ServiceManagement/Common/Commands.ServiceManagement.Common/PublishSettingsImporter.cs index 1839624ec0c1..cd146cc1640c 100644 --- a/src/Common/Commands.Common/PublishSettingsImporter.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/PublishSettingsImporter.cs @@ -18,10 +18,11 @@ using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Xml.Serialization; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication.XmlSchema; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagement.Common.XmlSchema; -namespace Microsoft.Azure.Common.Authentication +namespace Microsoft.Azure.ServiceManagemenet.Common { /// /// Class that handles loading publishsettings files @@ -29,7 +30,8 @@ namespace Microsoft.Azure.Common.Authentication /// public static class PublishSettingsImporter { - public static IEnumerable ImportAzureSubscription(Stream stream, ProfileClient azureProfileClient, string environment) + public static IEnumerable ImportAzureSubscription(Stream stream, + ProfileClient azureProfileClient, string environment) { var publishData = DeserializePublishData(stream); PublishDataPublishProfile profile = publishData.Items.Single(); diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RPRegistrationAction.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RPRegistrationAction.cs index 89cf09d85894..142116a2c285 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RPRegistrationAction.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RPRegistrationAction.cs @@ -17,10 +17,12 @@ using System.Linq; using System.Net; using Hyak.Common; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Management.Resources; using Microsoft.WindowsAzure.Management; -namespace Microsoft.Azure.Common.Authentication.Models +namespace Microsoft.Azure.ServiceManagemenet.Common.Models { public class RPRegistrationAction : IClientAction { diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RequiredResourceLookup.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RequiredResourceLookup.cs index 3feeb78e7526..a4b12a4e27e1 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RequiredResourceLookup.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/RequiredResourceLookup.cs @@ -14,7 +14,7 @@ using System.Collections.Generic; -namespace Microsoft.Azure.Common.Authentication +namespace Microsoft.Azure.ServiceManagemenet.Common { /// /// This class handles mapping management client types diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/ServiceManagementUtilities.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/ServiceManagementUtilities.cs new file mode 100644 index 000000000000..8fb676d80c91 --- /dev/null +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/ServiceManagementUtilities.cs @@ -0,0 +1,80 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.ServiceModel.Channels; +using System.Text; +using System.Xml; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; + +namespace Microsoft.WindowsAzure.Commands.Common +{ + public static class ServiceManagementUtilities + { + public static string ReadMessageBody(ref Message originalMessage) + { + StringBuilder strBuilder = new StringBuilder(); + + using (MessageBuffer messageBuffer = originalMessage.CreateBufferedCopy(int.MaxValue)) + { + Message message = messageBuffer.CreateMessage(); + XmlWriter writer = XmlWriter.Create(strBuilder); + using (XmlDictionaryWriter dictionaryWriter = XmlDictionaryWriter.CreateDictionaryWriter(writer)) + { + message.WriteBodyContents(dictionaryWriter); + } + + originalMessage = messageBuffer.CreateMessage(); + } + + return XmlUtilities.Beautify(strBuilder.ToString()); + } + + /// + /// Ensure the default profile directory exists + /// + public static void EnsureDefaultProfileDirectoryExists() + { + if (!AzureSession.DataStore.DirectoryExists(AzureSession.ProfileDirectory)) + { + AzureSession.DataStore.CreateDirectory(AzureSession.ProfileDirectory); + } + } + + /// + /// Clear the current storage account from the context - guarantees that only one storage account will be active + /// at a time. + /// + public static void ClearCurrentStorageAccount() + { + //TODO: Move to RM + //var RMProfile = AzureRmProfileProvider.Instance.Profile; + //if (RMProfile != null && RMProfile.Context != null && + // RMProfile.Context.Subscription != null && RMProfile.Context.Subscription.IsPropertySet(AzureSubscription.Property.StorageAccount)) + //{ + // RMProfile.Context.Subscription.SetProperty(AzureSubscription.Property.StorageAccount, null); + //} + + var SMProfile = AzureSMProfileProvider.Instance.Profile; + if (SMProfile != null && SMProfile.Context != null + && SMProfile.Context.Subscription != null && + SMProfile.Context.Subscription.IsPropertySet( + AzureSubscription.Property.StorageAccount)) + { + SMProfile.Context.Subscription.SetProperty( + AzureSubscription.Property.StorageAccount, null); + } + } + } +} diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/SubscriptionCmdletBase.cs b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/SubscriptionCmdletBase.cs index 5b9549e47ea3..e4f5805b685f 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/SubscriptionCmdletBase.cs +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/SubscriptionCmdletBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.Profile diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config index 55769d13f483..223468584f83 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config @@ -4,7 +4,6 @@ - @@ -12,8 +11,8 @@ - - + + \ No newline at end of file diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj index 9a3625aa5a14..7e40c6cfa99f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj @@ -65,10 +65,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -80,6 +76,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -100,12 +97,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -237,6 +234,10 @@ {cd5aa507-f5ef-473d-855b-84b91a1abe54} Commands + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config index 3c27aff765cb..28e9aed53b56 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/packages.config @@ -3,7 +3,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj index d0b008af425a..3714cf2628ee 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj @@ -66,10 +66,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -81,6 +77,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -101,12 +98,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -132,8 +129,8 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.5.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll - False - ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.4\lib\net40\Microsoft.WindowsAzure.Management.Network.dll + False + ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.4\lib\net40\Microsoft.WindowsAzure.Management.Network.dll ..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll @@ -312,6 +309,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {cff09e81-1e31-444e-b4d4-a21e946c29e2} Commands.ServiceManagement.Common diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config index 6060297113bd..ff6af35545be 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/packages.config @@ -3,7 +3,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj index 8098de2f3561..b920dff40985 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj @@ -62,10 +62,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -81,6 +77,7 @@ ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -101,12 +98,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -613,6 +610,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs index e7b98b52ff54..da6217070bb0 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdSASUriTest.cs @@ -16,7 +16,7 @@ using System.IO; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs index c817e930b28f..120d88de3cbd 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/AddAzureVhdTest.cs @@ -16,7 +16,7 @@ using System.IO; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index 78a2e226bbd3..ba5e6a7ddf30 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -26,7 +26,7 @@ using System.Xml; using Hyak.Common; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs index 806e94a93ca4..5d87d0f02f37 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs index 8f8da078a683..90c99ef51ab5 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/SaveAzureVhdTest.cs @@ -16,7 +16,7 @@ using System.IO; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Sync.Download; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs index b0e835447589..1a4a07ad8d14 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs @@ -28,7 +28,7 @@ using System.Xml; using System.Xml.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs index 104126063e00..2e7bc01d4555 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Profile.Models; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs index d2c5285e76f9..1d040f43561f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementTest.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config index ce352f6bc6b0..35af3eec83f9 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/packages.config @@ -3,7 +3,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj index d7ed5cea149b..79e1f472d89f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj @@ -67,10 +67,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -82,6 +78,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -102,12 +99,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -542,6 +539,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Common/DiagnosticsHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Common/DiagnosticsHelper.cs index a12343621b4f..48cfad896586 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Common/DiagnosticsHelper.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Common/DiagnosticsHelper.cs @@ -19,7 +19,7 @@ using System.Text; using System.Xml; using System.Xml.Linq; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Management.Storage.Models; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs index 6046108d14ec..9fd17d352152 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs @@ -16,7 +16,7 @@ using System; using System.Management.Automation; using System.Net; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs index 4f94fad9a5a6..a5b8c13f1cea 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs @@ -15,7 +15,7 @@ using System; using System.Management.Automation; using System.Net; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs index 0ca4f5dc3a39..f53723ada255 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Disks/AddAzureDataDisk.cs @@ -19,10 +19,10 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs index 4a9e8e6a3f15..65229573528a 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs index 9333d2f6d08f..fe4f26862551 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs @@ -16,14 +16,14 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Management.Storage; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs index 19d858ccc91f..86bae5ccaec5 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/VirtualMachineCustomScriptExtensionCmdletBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/PublishAzureVMDscConfiguration.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/PublishAzureVMDscConfiguration.cs index 47c30acecd27..43bce73e944e 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/PublishAzureVMDscConfiguration.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/PublishAzureVMDscConfiguration.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Linq; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Extensions.DSC; using Microsoft.WindowsAzure.Commands.Common.Extensions.DSC.Publish; using Microsoft.WindowsAzure.Commands.Common.Storage; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/SetAzureVMDscExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/SetAzureVMDscExtension.cs index 20821caae297..5328a8dfdf71 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/SetAzureVMDscExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/SetAzureVMDscExtension.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Extensions.DSC; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions.DSC; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs index 015de4470e24..28b24efdaad3 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/SqlServer/VirtualMachineSqlServerExtensionCmdletBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs index b03d2c0b9d00..8236ab2e7158 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureQuickVM.cs @@ -15,7 +15,7 @@ using AutoMapper; using Hyak.Common; using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs index e3c6f545b823..539bc1fd17a2 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs @@ -18,7 +18,7 @@ using System.Management.Automation; using System.Net; using AutoMapper; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs index ded3f7ab2bcc..6930401266ad 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVMConfig.cs @@ -16,7 +16,7 @@ using System; using System.Collections.ObjectModel; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs index f2e51509bf9f..7f171e9f984f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/UpdateAzureVM.cs @@ -14,7 +14,7 @@ using AutoMapper; using Hyak.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs index bab5c364df06..5812bdbe675b 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/StorageServices/StorageCredentialsFactory.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; using Microsoft.WindowsAzure.Commands.Sync.Download; using Microsoft.WindowsAzure.Management.Storage; diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config b/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config index 7f2978099228..d63faada0502 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/packages.config @@ -3,7 +3,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj index efed62c183ca..8504c1d56055 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj @@ -47,10 +47,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -58,6 +54,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -66,12 +63,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -185,6 +182,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs index cd505a9e7186..91a8f87592e7 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Common; namespace Microsoft.WindowsAzure.Commands.ExpressRoute @@ -26,8 +26,8 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute using System.ComponentModel; using System.Net; using Utilities.Common; - using Microsoft.Azure.Common.Authentication.Models; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config index 9bb2498f1423..bb4379d4e649 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config @@ -2,7 +2,6 @@ - @@ -10,8 +9,8 @@ - - + + diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj index 8ea002a154e4..5d82a362bf22 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj @@ -54,10 +54,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -98,12 +94,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -286,6 +282,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3b48a77b-5956-4a62-9081-92ba04b02b27} Commands.Common.Test diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs index 5c8ec60c0f4a..c71652454e79 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/HDInsight/CommandTests/HDInsightGetCommandTests.cs @@ -18,7 +18,7 @@ using Microsoft.Hadoop.Client; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.HDInsight.CmdLetTests; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Utilities; using Microsoft.WindowsAzure.Management.HDInsight; @@ -26,8 +26,9 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.HDInsight.CommandTests { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs index 79d85f7ba448..1b7036e306d0 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulator.cs @@ -17,12 +17,13 @@ using System.Linq; using System.Security.Cryptography.X509Certificates; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Utilities; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Simulators { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs index 67360bddba58..e58f3ed5df4b 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Simulators/AzureHDInsightSubscriptionResolverSimulatorFactory.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Simulators diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs index 3a895f97f561..24b1254c751d 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/Models/Utilities/IntegrationTestBase.cs @@ -21,7 +21,7 @@ using System.Security.Cryptography.X509Certificates; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.PowerShellTestAbstraction.Concretes; using Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.PowerShellTestAbstraction.Interfaces; @@ -36,8 +36,9 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; using Microsoft.WindowsAzure.Management.HDInsight.Framework.Core; using Microsoft.WindowsAzure.Management.HDInsight.Logging; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.HDInsight.Utilities { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config index 0d4ca00308b3..94774a2e557a 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight.Test/packages.config @@ -3,7 +3,6 @@ - @@ -17,8 +16,8 @@ - - + + diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs index 43828708c916..27ec4b5a1407 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AzureHDInsightCmdlet.cs @@ -17,15 +17,16 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Logging; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; using Microsoft.WindowsAzure.Management.HDInsight.Logging; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/HDInsight.csproj b/src/ServiceManagement/HDInsight/Commands.HDInsight/HDInsight.csproj index 510ad56f0fda..334c313bb88c 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/HDInsight.csproj +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/HDInsight.csproj @@ -59,10 +59,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -96,12 +92,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -374,6 +370,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs index dee33062ee7a..dc5a3f63b508 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/AddAzureHDInsightStorageCommand.cs @@ -16,7 +16,7 @@ using System.Collections.ObjectModel; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs index fadd9e0c1190..751b2f2a7b63 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/UseAzureHDInsightClusterCommand.cs @@ -20,9 +20,10 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandImplementations { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs index b0dd4dd26e30..0cda6aaeeee6 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightClusterCommandBase.cs @@ -17,9 +17,10 @@ using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs index 9726e37ebe4c..619bf104e239 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandBase.cs @@ -16,7 +16,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Framework.Core; using Microsoft.WindowsAzure.Management.HDInsight.Logging; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs index 57a5aa69f6c6..a82360bed779 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightCommandExtensions.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Hadoop.Client; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandImplementations; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; @@ -22,6 +22,7 @@ using System.Diagnostics; using System.IO; using System.Reflection; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs index d320eea45129..383a5bf46d10 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightJobCommandExecutorBase.cs @@ -18,12 +18,13 @@ using System.Threading; using Microsoft.Hadoop.Client; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs index 2901c5d98d7b..644fe7d5e73e 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolver.cs @@ -14,7 +14,7 @@ using System; using System.Linq; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs index 6031d9168a1f..5fe602fa8f7d 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/AzureHDInsightSubscriptionResolverFactory.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs index 7b12055982fe..9ee13ba97f94 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightCommandBase.cs @@ -14,7 +14,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs index 661b4edd8940..06ba6c176d0e 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolver.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs index ebdcb5df9829..6dc2f1aea8b4 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/BaseInterfaces/IAzureHDInsightSubscriptionResolverFactory.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.BaseInterfaces { diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs index 0060f31435cc..fd38d798914f 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/IInvokeAzureHDInsightJobCommand.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Logging; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs index 2edb165cc22c..6b7f4d539a30 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Model/GetAzureHDInsightClusters/InvokeAzureHDInsightJobCommandBase.cs @@ -21,7 +21,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Hadoop.Client; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.BaseCommandInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config b/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config index 02bbcf5f3c5c..b577b8ff3daf 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/packages.config @@ -3,8 +3,8 @@ - + @@ -15,13 +15,12 @@ - - + + - diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj index caf2aed61978..396980ac0ea0 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj @@ -47,10 +47,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -81,12 +77,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -193,6 +189,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3b48a77b-5956-4a62-9081-92ba04b02b27} Commands.Common.Test diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs index 0e6f3d151d71..235d3935895b 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTestsBase.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Management.ManagedCache; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.ScenarioTest; diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config index 3536371b2b3a..5cea8b9a4219 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj index 008c06034333..91f30b150ff5 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj @@ -47,10 +47,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -58,6 +54,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -75,12 +72,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -162,6 +159,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {cff09e81-1e31-444e-b4d4-a21e946c29e2} Commands.ServiceManagement.Common diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs index 40631eb70709..51b390b88881 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs @@ -24,9 +24,9 @@ using Microsoft.Azure.Management.ManagedCache.Models; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; namespace Microsoft.Azure.Commands.ManagedCache diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config index 2cd3c72b84c0..7cb1d4035e23 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj b/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj index 8fa868866d7b..7e6777f5cb62 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj +++ b/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj @@ -47,10 +47,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -81,12 +77,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -217,6 +213,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/IPForwarding/IPForwardingScenarioTests.cs b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/IPForwarding/IPForwardingScenarioTests.cs index 75ce849363c3..f65fd46c8f84 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/IPForwarding/IPForwardingScenarioTests.cs +++ b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/IPForwarding/IPForwardingScenarioTests.cs @@ -14,7 +14,7 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests { - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Management; diff --git a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/MultiVip/MultiVip.cs b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/MultiVip/MultiVip.cs index bc889943dc0d..44970d77cfb3 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/MultiVip/MultiVip.cs +++ b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/MultiVip/MultiVip.cs @@ -15,7 +15,7 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests { - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Management; diff --git a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs index 0afffc8becfd..0ab3a1539b29 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs +++ b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkSecurityGroup/NSGScenarioTests.cs @@ -23,7 +23,7 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.Scenari using Microsoft.WindowsAzure.Commands.Utilities.Common; using Xunit; using Microsoft.WindowsAzure.Management; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using System; diff --git a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs index 63232ed03158..d06d73aa982b 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs +++ b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/NetworkTestsBase.cs @@ -18,7 +18,7 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests { - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using WindowsAzure.Management.Network; public abstract class NetworkTestsBase diff --git a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/ReservedIPs/ReservedIP.cs b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/ReservedIPs/ReservedIP.cs index 2556c1dcad61..1b7aa65a4947 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/ReservedIPs/ReservedIP.cs +++ b/src/ServiceManagement/Network/Commands.Network.Test/ScenarioTests/ReservedIPs/ReservedIP.cs @@ -17,7 +17,7 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests { - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.WindowsAzure.Commands.ScenarioTest; diff --git a/src/ServiceManagement/Network/Commands.Network.Test/packages.config b/src/ServiceManagement/Network/Commands.Network.Test/packages.config index 7b478089d4b7..a273365da0e4 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/packages.config +++ b/src/ServiceManagement/Network/Commands.Network.Test/packages.config @@ -2,7 +2,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj b/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj index d1b2404a9038..637109986038 100644 --- a/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj +++ b/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj @@ -55,10 +55,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -70,6 +66,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -90,12 +87,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -106,8 +103,8 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.5.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll - False - ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.4\lib\net40\Microsoft.WindowsAzure.Management.Network.dll + False + ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.4\lib\net40\Microsoft.WindowsAzure.Management.Network.dll False @@ -271,6 +268,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {cff09e81-1e31-444e-b4d4-a21e946c29e2} Commands.ServiceManagement.Common diff --git a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs index c16a19dc94fd..aa59e8b29dba 100644 --- a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs +++ b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs @@ -18,8 +18,8 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network { using Gateway.Model; using Hyak.Common; - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Management.Compute; using NetworkSecurityGroup.Model; diff --git a/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs b/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs index c4329cb893a2..b0dee05727fb 100644 --- a/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs +++ b/src/ServiceManagement/Network/Commands.Network/NetworkCmdletBase.cs @@ -14,8 +14,8 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network { - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; using WindowsAzure.Commands.Common; using WindowsAzure.Commands.Utilities.Common; using WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Network/Commands.Network/packages.config b/src/ServiceManagement/Network/Commands.Network/packages.config index df4fa5de8bd8..e0a184aeec41 100644 --- a/src/ServiceManagement/Network/Commands.Network/packages.config +++ b/src/ServiceManagement/Network/Commands.Network/packages.config @@ -3,7 +3,6 @@ - @@ -15,8 +14,8 @@ - - + + diff --git a/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs b/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs index ca8d08d1e60e..af42a390e83f 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Account/AddAzureAccount.cs @@ -15,7 +15,7 @@ using System.Management.Automation; using System.Security; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Account/GetAzureAccount.cs b/src/ServiceManagement/Profile/Commands.Profile/Account/GetAzureAccount.cs index d088ebddc317..632fe666638d 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Account/GetAzureAccount.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Account/GetAzureAccount.cs @@ -15,9 +15,10 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using System.Collections.Generic; +using Microsoft.Azure.ServiceManagemenet.Common.Models; namespace Microsoft.WindowsAzure.Commands.Profile { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Account/RemoveAzureAccount.cs b/src/ServiceManagement/Profile/Commands.Profile/Account/RemoveAzureAccount.cs index 7cf8484c336e..ce0436a09986 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Account/RemoveAzureAccount.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Account/RemoveAzureAccount.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Commands.Profile.csproj b/src/ServiceManagement/Profile/Commands.Profile/Commands.Profile.csproj index 04f5979568a7..a2b4573d1c4b 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Commands.Profile.csproj +++ b/src/ServiceManagement/Profile/Commands.Profile/Commands.Profile.csproj @@ -53,10 +53,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -66,6 +62,7 @@ + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll True @@ -86,12 +83,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -197,6 +194,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ServiceManagement/Profile/Commands.Profile/Environment/AddAzureEnvironment.cs b/src/ServiceManagement/Profile/Commands.Profile/Environment/AddAzureEnvironment.cs index 670cc6769963..9c1f0e805cc4 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Environment/AddAzureEnvironment.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Environment/AddAzureEnvironment.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using System.Collections.Generic; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Environment/GetAzureEnvironment.cs b/src/ServiceManagement/Profile/Commands.Profile/Environment/GetAzureEnvironment.cs index 9b1319fd6122..7607c7219e15 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Environment/GetAzureEnvironment.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Environment/GetAzureEnvironment.cs @@ -16,7 +16,7 @@ using System.Linq; using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using System; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Environment/RemoveAzureEnvironment.cs b/src/ServiceManagement/Profile/Commands.Profile/Environment/RemoveAzureEnvironment.cs index cb373c1b9053..00255417cc41 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Environment/RemoveAzureEnvironment.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Environment/RemoveAzureEnvironment.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Environment/SetAzureEnvironment.cs b/src/ServiceManagement/Profile/Commands.Profile/Environment/SetAzureEnvironment.cs index f62934e23d0a..5ff4222d3e72 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Environment/SetAzureEnvironment.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Environment/SetAzureEnvironment.cs @@ -16,7 +16,7 @@ using System.Globalization; using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Models/AzureProfileSettings.cs b/src/ServiceManagement/Profile/Commands.Profile/Models/AzureProfileSettings.cs index b68ad11e27a2..4c4077ec46f8 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Models/AzureProfileSettings.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Models/AzureProfileSettings.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Profile.Models { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Models/PSAzureEnvironment.cs b/src/ServiceManagement/Profile/Commands.Profile/Models/PSAzureEnvironment.cs index c885cced63d5..820b68da1460 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Models/PSAzureEnvironment.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Models/PSAzureEnvironment.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Profile.Models { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs b/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs index e0db30a7512a..611bc6108178 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs @@ -16,8 +16,8 @@ using System.Collections.Generic; using System.Linq; using System.ServiceModel.Description; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Profile.Models { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscriptionExtended.cs b/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscriptionExtended.cs index 3352e274c7b9..46abfa944368 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscriptionExtended.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscriptionExtended.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Profile.Models { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Profile/ClearAzureProfile.cs b/src/ServiceManagement/Profile/Commands.Profile/Profile/ClearAzureProfile.cs index b18f14738768..7c7bf0fcdbc9 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Profile/ClearAzureProfile.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Profile/ClearAzureProfile.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs b/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs index de1dbb193d82..51559228d245 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Profile/NewAzureProfile.cs @@ -18,14 +18,15 @@ using System.Linq; using System.Security; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System.Management.Automation; using System.Security.Permissions; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Profile { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Profile/SelectAzureProfile.cs b/src/ServiceManagement/Profile/Commands.Profile/Profile/SelectAzureProfile.cs index 5a552a3e8777..b67a6af6b994 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Profile/SelectAzureProfile.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Profile/SelectAzureProfile.cs @@ -18,8 +18,8 @@ using System.Linq; using System.Security; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs b/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs index 92540f3a0340..41d5a7dbc248 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzurePublishSettingsFile.cs @@ -14,7 +14,7 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzureSubscription.cs b/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzureSubscription.cs index ecb2f8b6fc5c..bec7662cc883 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzureSubscription.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Subscription/GetAzureSubscription.cs @@ -17,13 +17,13 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using Microsoft.WindowsAzure.Management; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Profile { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Subscription/ImportAzurePublishSettings.cs b/src/ServiceManagement/Profile/Commands.Profile/Subscription/ImportAzurePublishSettings.cs index 8b47e0c1832b..46c6cd7c8d07 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Subscription/ImportAzurePublishSettings.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Subscription/ImportAzurePublishSettings.cs @@ -17,13 +17,13 @@ using System.Linq; using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Profile; using Microsoft.WindowsAzure.Commands.Common; using System.Diagnostics; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Profile { diff --git a/src/ServiceManagement/Profile/Commands.Profile/Subscription/RemoveAzureSubscription.cs b/src/ServiceManagement/Profile/Commands.Profile/Subscription/RemoveAzureSubscription.cs index fb4b83cd8729..33efa96125c6 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Subscription/RemoveAzureSubscription.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Subscription/RemoveAzureSubscription.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; diff --git a/src/ServiceManagement/Profile/Commands.Profile/Subscription/SelectAzureSubscription.cs b/src/ServiceManagement/Profile/Commands.Profile/Subscription/SelectAzureSubscription.cs index 8e0d3ed0136a..e9ea418afe3a 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Subscription/SelectAzureSubscription.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Subscription/SelectAzureSubscription.cs @@ -16,10 +16,10 @@ using System.Linq; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Profile; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Profile.Models; namespace Microsoft.WindowsAzure.Commands.Profile diff --git a/src/ServiceManagement/Profile/Commands.Profile/Subscription/SetAzureSubscription.cs b/src/ServiceManagement/Profile/Commands.Profile/Subscription/SetAzureSubscription.cs index dfb47f472d71..9c8ba0551dcb 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Subscription/SetAzureSubscription.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Subscription/SetAzureSubscription.cs @@ -16,8 +16,9 @@ using System.Linq; using System.Management.Automation; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -163,7 +164,7 @@ public override void ExecuteCmdlet() if (Profile.Context != null && Profile.Context.Subscription != null && Profile.Context.Subscription.Id == subscription.Id) { - GeneralUtilities.ClearCurrentStorageAccount(); + ServiceManagementUtilities.ClearCurrentStorageAccount(); } var context = new AzureContext(subscription, ProfileClient.GetAccount(subscription.Account), ProfileClient.GetEnvironmentOrDefault(subscription.Environment)); if (Context != null) diff --git a/src/ServiceManagement/Profile/Commands.Profile/packages.config b/src/ServiceManagement/Profile/Commands.Profile/packages.config index 3da3900e31e7..2c602f38b9d4 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/packages.config +++ b/src/ServiceManagement/Profile/Commands.Profile/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj index 7d125a47c65f..a6afc45f1896 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj @@ -38,10 +38,6 @@ false - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -69,12 +65,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -200,6 +196,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs index 309711d9e1f9..78c7d7aa26f7 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs @@ -27,8 +27,8 @@ using Microsoft.WindowsAzure.Management.SiteRecovery; using Microsoft.Azure.Test; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.Azure.Commands.RecoveryServices.Test.ScenarioTests { diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config index 846cfa003038..580714a7e956 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServicesRdfe.csproj b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServicesRdfe.csproj index 0c369bc536a5..3484717996b9 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServicesRdfe.csproj +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServicesRdfe.csproj @@ -53,10 +53,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -72,12 +68,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -212,6 +208,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common @@ -246,4 +246,4 @@ - + \ No newline at end of file diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs index e7eaa3a1a84f..4fde69310b0a 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClient.cs @@ -25,8 +25,8 @@ using System.Xml; using Microsoft.Azure.Portal.RecoveryServices.Models.Common; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.RecoveryServices; using Microsoft.WindowsAzure.Management.RecoveryServices.Models; diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClientHelper.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClientHelper.cs index 90ff63493832..d3e05a79f273 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClientHelper.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClientHelper.cs @@ -14,8 +14,8 @@ using System; using System.Collections.Generic; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Management.SiteRecovery; using Microsoft.WindowsAzure.Management.SiteRecovery.Models; diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs index 5f57b571ee33..707694d806bd 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs @@ -13,12 +13,9 @@ // ---------------------------------------------------------------------------------- using System; -using System.Diagnostics; using System.Management.Automation; -using System.Threading; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.RecoveryServices.SiteRecovery; -using Microsoft.Azure.Common.Authentication; -using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.SiteRecovery.Models; namespace Microsoft.Azure.Commands.RecoveryServices diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/GetAzureSiteRecoveryVaultSettingsFile.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/GetAzureSiteRecoveryVaultSettingsFile.cs index 8a7b53e2fcfc..c903553d4393 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/GetAzureSiteRecoveryVaultSettingsFile.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/GetAzureSiteRecoveryVaultSettingsFile.cs @@ -16,9 +16,8 @@ using System.Linq; using System.Management.Automation; using System.Security.Cryptography.X509Certificates; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.RecoveryServices.SiteRecovery; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Portal.RecoveryServices.Models.Common; using Microsoft.WindowsAzure.Management.RecoveryServices.Models; using Microsoft.WindowsAzure.Management.SiteRecovery.Models; diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSObjects.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSObjects.cs index 989e7863aa3e..e60bed7710dc 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSObjects.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSObjects.cs @@ -16,7 +16,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Portal.RecoveryServices.Models.Common; using Microsoft.WindowsAzure.Management.RecoveryServices.Models; using Microsoft.WindowsAzure.Management.SiteRecovery.Models; diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config index 82d832420fda..1ef51d82a8b5 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/packages.config @@ -3,7 +3,6 @@ - @@ -12,8 +11,8 @@ - - + + diff --git a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/Commands.RemoteAppScenarioTest.csproj b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/Commands.RemoteAppScenarioTest.csproj index 171d004d74ac..3f4cc09d502a 100644 --- a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/Commands.RemoteAppScenarioTest.csproj +++ b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/Commands.RemoteAppScenarioTest.csproj @@ -40,10 +40,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -132,6 +128,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {c1bda476-a5cc-4394-914d-48b0ec31a710} Commands.ScenarioTests.Common diff --git a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/CreateCloudCollection.cs b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/CreateCloudCollection.cs index 2a5116eb3cb1..af69e670b300 100644 --- a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/CreateCloudCollection.cs +++ b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/CreateCloudCollection.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Commands.RemoteApp.Test.csproj b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Commands.RemoteApp.Test.csproj index ed9ac76b5623..51e7d4eacc78 100644 --- a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Commands.RemoteApp.Test.csproj +++ b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Commands.RemoteApp.Test.csproj @@ -61,6 +61,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3b48a77b-5956-4a62-9081-92ba04b02b27} Commands.Common.Test @@ -102,10 +106,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -114,6 +114,7 @@ ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True @@ -122,12 +123,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -170,9 +171,8 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll - - ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True + + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True ..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll diff --git a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/packages.config b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/packages.config index d2151893bd25..29f478b8ac67 100644 --- a/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/packages.config +++ b/src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/packages.config @@ -2,7 +2,6 @@ - @@ -10,8 +9,8 @@ - - + + diff --git a/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.csproj b/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.csproj index 19f47e0794fc..5bc5dda1d1ab 100644 --- a/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.csproj +++ b/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.csproj @@ -61,10 +61,6 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -89,12 +85,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -163,6 +159,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Common/RdsCmdlet.cs b/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Common/RdsCmdlet.cs index 7228087b73b1..4b86c0d629c0 100644 --- a/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Common/RdsCmdlet.cs +++ b/src/ServiceManagement/RemoteApp/Commands.RemoteApp/Common/RdsCmdlet.cs @@ -14,8 +14,8 @@ using Hyak.Common; using Microsoft.WindowsAzure.Commands.RemoteApp; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.RemoteApp; using Microsoft.WindowsAzure.Management.RemoteApp.Models; diff --git a/src/ServiceManagement/RemoteApp/Commands.RemoteApp/packages.config b/src/ServiceManagement/RemoteApp/Commands.RemoteApp/packages.config index 09e21c0de9c9..05258c2cd16a 100644 --- a/src/ServiceManagement/RemoteApp/Commands.RemoteApp/packages.config +++ b/src/ServiceManagement/RemoteApp/Commands.RemoteApp/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ServiceManagement/ServiceManagement.sln b/src/ServiceManagement/ServiceManagement.sln index ed51ed30b1ea..d5b991f3cb76 100644 --- a/src/ServiceManagement/ServiceManagement.sln +++ b/src/ServiceManagement/ServiceManagement.sln @@ -108,6 +108,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RemoteAppScenarioTest", "RemoteApp\Commands.RemoteApp.ScenarioTest\Commands.RemoteAppScenarioTest.csproj", "{C2FA83A2-8668-49DD-A1A0-0359653571CA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -286,6 +288,10 @@ Global {C2FA83A2-8668-49DD-A1A0-0359653571CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {C2FA83A2-8668-49DD-A1A0-0359653571CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {C2FA83A2-8668-49DD-A1A0-0359653571CA}.Release|Any CPU.Build.0 = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3804B64-C0D3-48F8-82EC-1F632F833C9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj b/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj index ce17c70498e7..bd4667090c11 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Commands.Test.Utilities.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -70,12 +66,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -171,6 +167,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3b48a77b-5956-4a62-9081-92ba04b02b27} Commands.Common.Test diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs index 6668883aee64..abcbc0a2b81d 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs @@ -26,7 +26,7 @@ namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { using ConfigConfigurationSetting = Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema.ConfigurationSetting; using DefinitionConfigurationSetting = Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema.ConfigurationSetting; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; public static class AzureAssert { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs index d34b9e36618e..0c1e40c568ac 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessToken.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using System; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs index 58db55c928f1..5cee4eeba399 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FakeAccessTokenProvider.cs @@ -13,9 +13,9 @@ // ---------------------------------------------------------------------------------- using System.Security; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs index a6bacf471860..ac7717b172b2 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs @@ -18,8 +18,9 @@ using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs index 4b3790e784fc..acf0a25c41b8 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Websites/WebsitesTestBase.cs @@ -17,9 +17,9 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using System; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config b/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config index 03b487c9cdc3..68cef66e23a2 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/packages.config @@ -2,7 +2,6 @@ - @@ -10,8 +9,8 @@ - - + + diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs index fa26a2a2dea0..ef3465d223d4 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs @@ -24,7 +24,7 @@ using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs index d4d4b7674f85..280821e377ed 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs @@ -27,7 +27,7 @@ using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs index 7802f1b702df..71f42bcf3e63 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs @@ -25,7 +25,7 @@ using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs index efe34f84501d..1348ced88b69 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs @@ -27,7 +27,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs index 64ee165d9b13..e319afaa57b3 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/CloudServiceClientTests.cs @@ -19,7 +19,7 @@ using System.Threading; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; @@ -32,7 +32,7 @@ using Moq; using MockStorageService = Microsoft.WindowsAzure.Commands.Test.Utilities.Common.MockStorageService; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs index b1933af02838..763cd4ef1a6c 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/GeneralTests.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs index cdb277b2467e..d7630e3219fd 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/PublishContextTests.cs @@ -24,8 +24,9 @@ using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs index 584eb9d23ed5..595db8a66973 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj index 94ea0e3f7330..b6610e924a25 100644 --- a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj +++ b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj @@ -56,10 +56,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -78,6 +74,7 @@ False ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -97,12 +94,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -415,6 +412,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs index 7f660fba9fe9..ac69c0d38649 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/AddAzureEnvironmentTests.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Profile.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; @@ -22,7 +22,8 @@ using Moq; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Environment { diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs index d765f579993f..9feae1c92b7e 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/GetAzureEnvironmentTests.cs @@ -15,7 +15,7 @@ using System.Collections.Generic; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Profile.Models; @@ -24,7 +24,7 @@ using Moq; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Environment { diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs index ce42c1b2a47f..de9fece9a699 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/RemoveAzureEnvironmentTests.cs @@ -16,7 +16,7 @@ using System.Collections.Generic; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; @@ -24,8 +24,9 @@ using Moq; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Environment { diff --git a/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs b/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs index d7db9e0e9164..b7f5ecebc899 100644 --- a/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Environment/SetAzureEnvironmentTests.cs @@ -20,14 +20,15 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Environment { diff --git a/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs b/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs index 7291975b37f7..40c0d7c1843c 100644 --- a/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/MediaServices/GetAzureMediaServicesTests.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.MediaServices; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; @@ -27,7 +27,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.MediaServices.Services.Entities; using Microsoft.WindowsAzure.Management.MediaServices.Models; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.MediaServices { diff --git a/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs b/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs index 91650d2abc38..9c3c790341a3 100644 --- a/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/MediaServices/MediaServicesClientTests.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.MediaServices; using Microsoft.WindowsAzure.Management.MediaServices; using Microsoft.WindowsAzure.Management.MediaServices.Models; diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs b/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs index 4be2b624267f..40a8c22bdceb 100644 --- a/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Profile/GetAzurePublishSettingsFileTests.cs @@ -20,9 +20,10 @@ using Microsoft.WindowsAzure.Commands.Profile; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Moq; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Test.Profile { diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.cs b/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.cs index d064a4493ab7..fd618ad6da57 100644 --- a/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Profile/NewAzureProfileTests.cs @@ -16,8 +16,8 @@ using System.Collections.Generic; using System.Management.Automation.Language; using Microsoft.Azure.Commands.Test.Profile; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/ProfileCmdltsTests.cs b/src/ServiceManagement/Services/Commands.Test/Profile/ProfileCmdltsTests.cs index 5c3a535b3404..e2f2d70e9e02 100644 --- a/src/ServiceManagement/Services/Commands.Test/Profile/ProfileCmdltsTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Profile/ProfileCmdltsTests.cs @@ -16,8 +16,8 @@ using System.Security; using System.Text; using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.ServiceBus.Management; using Microsoft.WindowsAzure.Commands.Common; @@ -32,7 +32,8 @@ using System.Management.Automation; using System.Reflection; using System.Security.Cryptography.X509Certificates; -using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; diff --git a/src/ServiceManagement/Services/Commands.Test/Profile/ProfileTestController.cs b/src/ServiceManagement/Services/Commands.Test/Profile/ProfileTestController.cs index ec340f55d636..77f10a41736d 100644 --- a/src/ServiceManagement/Services/Commands.Test/Profile/ProfileTestController.cs +++ b/src/ServiceManagement/Services/Commands.Test/Profile/ProfileTestController.cs @@ -12,9 +12,9 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Factories; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; diff --git a/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs b/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs index 716011486e47..6d68fe6c6239 100644 --- a/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/ServiceBus/GetAzureSBNamespaceTest.cs @@ -24,7 +24,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Utilities.ServiceBus; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.ServiceBus { diff --git a/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs b/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs index c8f609449b0b..4649a76e22a0 100644 --- a/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/WAPackIaaS/WebClient/GetAbsoluteUriTests.cs @@ -16,7 +16,7 @@ using System.Text; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.WAPackIaaS.WebClient; namespace Microsoft.WindowsAzure.Commands.Test.WAPackIaaS.WebClient diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs index 2b4178923e77..aa6d840cf1c8 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/DisableAzureWebsiteDiagnosticTests.cs @@ -14,14 +14,14 @@ using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System; namespace Microsoft.WindowsAzure.Commands.Test.Websites diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs index b475ddf723ad..56fed11d1b4f 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/EnableAzureWebsiteDiagnosticTests.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites; diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs index 6627be21591c..e92c5be5cdfe 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteMetricsTests.cs @@ -18,14 +18,14 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs index de0003087a0a..886a07e03043 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebSiteTests.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs index 255142049878..5784996a373c 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/GetAzureWebsiteDeploymentTests.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; @@ -26,7 +26,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs index 46ead60572e3..bbca1f6c3674 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/NewAzureWebSiteTests.cs @@ -16,7 +16,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -25,7 +25,7 @@ using Microsoft.WindowsAzure.Commands.Websites; using Microsoft.WindowsAzure.Management.WebSites.Models; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs index 156ff740cd4b..a77ee122014a 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/RemoveAzureWebSiteTests.cs @@ -16,7 +16,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; @@ -24,7 +24,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs index 24740ec0e296..381ec474abac 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/RestartAzureWebsiteTests.cs @@ -16,13 +16,13 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs index d9e1bdb2cb2d..56a9f0c28884 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/RestoreAzureWebsiteDeploymentTests.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; @@ -26,7 +26,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs index 0808b3530815..3c05974886b6 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/SaveAzureWebsiteLogTests.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -27,7 +27,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs index 4643b0f1c3de..06ad79499d9f 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/SetAzureWebSiteTests.cs @@ -18,14 +18,14 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs index b4e5ec5419a7..940f66a0ecb7 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzurePortalTests.cs @@ -17,7 +17,7 @@ using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Websites; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs index dc4c674747dd..72098228a709 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/ShowAzureWebsiteTests.cs @@ -16,14 +16,14 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs index a76fe37ad9b7..8d092a36547d 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/StartAzureWebSiteTests.cs @@ -16,13 +16,13 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs index c8fc45718f5f..c794009fa3f9 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/StopAzureWebSiteTests.cs @@ -16,13 +16,13 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs index 5d9e4abf8c92..e4299c83fa20 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/SwitchAzureWebSiteSlotTests.cs @@ -17,14 +17,14 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs index d199fcdba6f5..0c5c8cf3efff 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/UpdateAzureWebsiteRepositoryTests.cs @@ -17,14 +17,14 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites { diff --git a/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs b/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs index fec870eff1ea..f90eba99c487 100644 --- a/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/Websites/WebHostingPlans/GetAzureWebHostingPlanTests.cs @@ -19,14 +19,14 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Websites.WebHostingPlan; using Moq; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Test.Websites.WebHostingPlans { diff --git a/src/ServiceManagement/Services/Commands.Test/packages.config b/src/ServiceManagement/Services/Commands.Test/packages.config index 15aee3e85afe..8a94988f22d1 100644 --- a/src/ServiceManagement/Services/Commands.Test/packages.config +++ b/src/ServiceManagement/Services/Commands.Test/packages.config @@ -2,7 +2,6 @@ - @@ -16,8 +15,8 @@ - - + + diff --git a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs index 1f734ed34575..785b52642c48 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs @@ -22,7 +22,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.CloudService.AzureTools; using Microsoft.WindowsAzure.Commands.Utilities.CloudService.Model; @@ -41,8 +41,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { using ConfigCertificate = Common.XmlSchema.ServiceConfigurationSchema.Certificate; using ConfigConfigurationSetting = Common.XmlSchema.ServiceConfigurationSchema.ConfigurationSetting; - using Microsoft.Azure.Common.Authentication.Models; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; public class CloudServiceClient : ICloudServiceClient diff --git a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj index 71d6ec0ce294..93f53d386664 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj +++ b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj @@ -62,10 +62,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -99,12 +95,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -686,6 +682,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs index bcf3a6d82c1d..a29e5814c4bb 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs @@ -23,7 +23,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.AzureTools { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ClientProvider.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ClientProvider.cs index 922d8f7700f1..2b2c10c4d6a4 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ClientProvider.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ClientProvider.cs @@ -14,8 +14,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Common { - using Microsoft.Azure.Common.Authentication; - using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management; using Microsoft.WindowsAzure.Management.Compute; using Microsoft.WindowsAzure.Management.Network; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs index 2f40429eed26..047c327bc644 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServicePathInfo.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs index b97756d67221..6b04764a3e8f 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/CloudServiceProject.cs @@ -27,7 +27,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Utilities; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs index 01db3dc0ff4a..68a5120c45c4 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs @@ -17,7 +17,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs index 3692c859ff31..939ffce5b94a 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs @@ -18,7 +18,7 @@ using System.Web.Script.Serialization; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs index 807c8c0847df..1b11d0540e6f 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/PublishContext.cs @@ -17,9 +17,10 @@ using System.Linq; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs index e4182bd5e552..ce877caae88d 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/RoleInfo.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs index 23c0b7bf79d9..3ccb143a96b6 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/NodeRules.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs index e85f53d8689d..59ffb85ef048 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/PHPRules.cs @@ -17,7 +17,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs index b15f56c7f452..5e01dde1ffc7 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs @@ -20,7 +20,7 @@ using System.Xml.Linq; using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs index 558b7cfe530c..9592303cafe6 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceComponents.cs @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema; using Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs index 7f035445b3d9..5eb0d78a0a8b 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceManagementBaseCmdlet.cs @@ -15,8 +15,8 @@ using AutoMapper; using Hyak.Common; using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Properties; diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs index dc96bb1723ec..84f694dcfb2e 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/ServiceSettings.cs @@ -21,7 +21,7 @@ using Microsoft.WindowsAzure.Commands.Common.Properties; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs b/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs index d29515514f21..2c4f5c9a0238 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/MediaServices/MediaServicesClient.cs @@ -22,7 +22,7 @@ using System.Xml; using System.Xml.Serialization; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services; using Microsoft.WindowsAzure.Management.MediaServices; @@ -30,7 +30,7 @@ using Microsoft.WindowsAzure.Management.Storage; using Microsoft.WindowsAzure.Management.Storage.Models; using Newtonsoft.Json; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure; namespace Microsoft.WindowsAzure.Commands.Utilities.MediaServices diff --git a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs index ae9ab3488172..7ad751eb8259 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.CreateJobs.cs @@ -20,7 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Scheduler.Model; using Microsoft.WindowsAzure.Scheduler; using Microsoft.WindowsAzure.Scheduler.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Scheduler { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs index fe0d5e459ba4..9f05d00c3095 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Scheduler/SchedulerMgmntClient.cs @@ -16,7 +16,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Scheduler.Common; using Microsoft.WindowsAzure.Commands.Utilities.Scheduler.Model; @@ -24,7 +24,7 @@ using Microsoft.WindowsAzure.Management.Scheduler.Models; using Microsoft.WindowsAzure.Scheduler; using Microsoft.WindowsAzure.Scheduler.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure; namespace Microsoft.WindowsAzure.Commands.Utilities.Scheduler diff --git a/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs b/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs index c7b077f6964d..3dff594460e5 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs @@ -22,7 +22,7 @@ using Microsoft.ServiceBus.Messaging; using Microsoft.ServiceBus.Notifications; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Management.ServiceBus; using Microsoft.WindowsAzure.Management.ServiceBus.Models; @@ -30,8 +30,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.ServiceBus { using ServiceBusNamespaceDescription = Management.ServiceBus.Models.NamespaceDescription; - using Microsoft.Azure.Common.Authentication.Models; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; public class ServiceBusClientExtensions diff --git a/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusHelper.cs b/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusHelper.cs index 93358c9d1d76..fd2167e52516 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusHelper.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusHelper.cs @@ -23,6 +23,7 @@ using System.Xml; using System.Xml.Linq; using System.Xml.Serialization; +using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.ServiceBus @@ -62,7 +63,7 @@ public ServiceBusFormatter(IClientMessageFormatter originalFormatter) public object DeserializeReply(Message message, object[] parameters) { - XDocument response = XDocument.Parse(GeneralUtilities.ReadMessageBody(ref message)); + XDocument response = XDocument.Parse(ServiceManagementUtilities.ReadMessageBody(ref message)); List results = new List(); IEnumerable contents = response.Descendants(XName.Get("content", ServiceBusConstants.AtomNamespaceName)); XmlSerializer serializer = new XmlSerializer(typeof(T)); diff --git a/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs b/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs index 542bea6df62d..2dd0a1cf393b 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Store/StoreClient.cs @@ -19,7 +19,7 @@ using System.Security.Cryptography; using System.Text; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.MarketplaceServiceReference; using Microsoft.WindowsAzure.Commands.Utilities.Properties; @@ -32,8 +32,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Store { using Resource = Management.Store.Models.CloudServiceListResponse.CloudService.AddOnResource; - using Microsoft.Azure.Common.Authentication.Models; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; public class StoreClient { diff --git a/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs b/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs index 6a05f58f7823..123f9b29c4b8 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/WAPackIaaS/WebClient/Subscription.cs @@ -17,10 +17,11 @@ using System.Security; using System.Security.Cryptography.X509Certificates; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.Utilities.WAPackIaaS.WebClient { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs index 6f723e751952..95f19ed91ca2 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/KuduRemoteClientBase.cs @@ -17,8 +17,8 @@ using System.Net.Http; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs index 11fe3c14f9ce..70a343b0e0b4 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites.Services { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs index 082caae89f5b..a48d717d336b 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs @@ -17,7 +17,7 @@ using System.Linq; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites.Services { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs index 1b57725a4ad6..8c52917741c4 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs @@ -27,7 +27,7 @@ using Microsoft.Build.Logging; using Microsoft.Web.Deployment; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -47,8 +47,8 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Websites { using Utilities = Services.WebEntities; - using Microsoft.Azure.Common.Authentication.Models; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication.Models; + using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; public class WebsitesClient : IWebsitesClient diff --git a/src/ServiceManagement/Services/Commands.Utilities/packages.config b/src/ServiceManagement/Services/Commands.Utilities/packages.config index 4535f53bd8d4..e9ea81c4f76a 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/packages.config +++ b/src/ServiceManagement/Services/Commands.Utilities/packages.config @@ -3,7 +3,6 @@ - @@ -15,8 +14,9 @@ - - + + + @@ -28,7 +28,6 @@ - diff --git a/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs b/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs index b44a732bfd84..05076d4dc2f8 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/Development/EnableAzureRemoteDesktop.cs @@ -30,7 +30,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Certificate = Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema.Certificate; using ConfigurationSetting = Microsoft.WindowsAzure.Commands.Utilities.Common.XmlSchema.ServiceConfigurationSchema.ConfigurationSetting; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs b/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs index aa9eb97d4ec4..51f94deaa8b0 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs @@ -19,7 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.CloudService.Development.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs b/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs index 4e0683915567..69d6adf97b1b 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs @@ -14,12 +14,12 @@ using System.IO; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.CloudService; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.ServiceBus; using Microsoft.WindowsAzure.Commands.Utilities.Websites; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.Reflection; namespace Microsoft.WindowsAzure.Commands.CloudService diff --git a/src/ServiceManagement/Services/Commands/Commands.csproj b/src/ServiceManagement/Services/Commands/Commands.csproj index 34b84ad088e0..8e0bee982eb8 100644 --- a/src/ServiceManagement/Services/Commands/Commands.csproj +++ b/src/ServiceManagement/Services/Commands/Commands.csproj @@ -60,10 +60,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -73,6 +69,7 @@ + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -90,12 +87,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -342,6 +339,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {cff09e81-1e31-444e-b4d4-a21e946c29e2} Commands.ServiceManagement.Common diff --git a/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs b/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs index cfc340794498..07befa06eaac 100644 --- a/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs +++ b/src/ServiceManagement/Services/Commands/MediaServices/AzureMediaServicesHttpClientCommandBase.cs @@ -14,7 +14,7 @@ using System; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.MediaServices { diff --git a/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs b/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs index e09993e1d257..a586590986eb 100644 --- a/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs +++ b/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs @@ -14,7 +14,7 @@ using System.Collections.Generic; using System.Management.Automation; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Common; diff --git a/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs b/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs index 72d5a0f81b8c..c8be5e56704c 100644 --- a/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs +++ b/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs @@ -32,7 +32,7 @@ namespace Microsoft.WindowsAzure.Commands.Websites { using GitClass = Utilities.Websites.Services.Git; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; /// diff --git a/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs b/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs index 3ed7ec203a2b..20691987bd95 100644 --- a/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs +++ b/src/ServiceManagement/Services/Commands/Websites/ShowAzurePortal.cs @@ -14,10 +14,10 @@ using System.Management.Automation; using System.Security.Permissions; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Utilities.Properties; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.Websites { diff --git a/src/ServiceManagement/Services/Commands/packages.config b/src/ServiceManagement/Services/Commands/packages.config index c476087614db..aa07b5965a5c 100644 --- a/src/ServiceManagement/Services/Commands/packages.config +++ b/src/ServiceManagement/Services/Commands/packages.config @@ -2,7 +2,6 @@ - @@ -13,8 +12,8 @@ - - + + diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj index 28d1a34588aa..a0506d65b2ae 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Commands.SqlDatabase.Test.csproj @@ -57,10 +57,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -72,6 +68,7 @@ ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll True + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -89,12 +86,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -248,6 +245,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3b48a77b-5956-4a62-9081-92ba04b02b27} Commands.Common.Test diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs index 5aaa9d924df7..78c2118c2d03 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs @@ -16,7 +16,7 @@ using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Test.FunctionalTests { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs index 3a0ac4923f46..9c0f35b2f923 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs @@ -19,7 +19,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs index 607e52f6aa6a..2a791c8a3097 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs @@ -18,7 +18,7 @@ using System.Management.Automation; using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Model; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs index 98c4131aa5a3..fbf720c1d08c 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/GetRestorableDroppedDatabaseCertAuthTests.cs @@ -19,7 +19,7 @@ using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Common; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs index 9983601efe9b..f5cb4323393f 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportCmdletTests.cs @@ -18,7 +18,7 @@ using System.Text.RegularExpressions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.Utilities; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportv12Tests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportv12Tests.cs index 9f53af708281..0c8e24df64ae 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportv12Tests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/ImportExportv12Tests.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs index 1ed1b6027751..b42bce33a817 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs @@ -18,8 +18,8 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs index 008469dabe8c..2ed4ce24ce42 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Firewall/Cmdlet/FirewallCmdletTests.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Model; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Server.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs index 8848b51ed678..c370341333c8 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/MockServer/MockHttpServer.cs @@ -22,12 +22,13 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Test.Common; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Factories; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Factories; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs index d58fb822031a..22f506578704 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Server/Cmdlet/ServerCmdletTests.cs @@ -17,7 +17,7 @@ using System.Linq; using System.Management.Automation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Model; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.Database.Cmdlet; diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs index bdafb5a7d878..b27cb8edfd06 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs @@ -23,9 +23,10 @@ using System.Security.Cryptography.X509Certificates; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests.MockServer; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.ServiceManagemenet.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Test.UnitTests diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config index d0a434619f6c..cc47eed15a2d 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj index 033f873abc00..55d26324fff9 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj @@ -57,10 +57,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -72,6 +68,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -92,12 +89,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -238,6 +235,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} Commands.Common.Storage diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs index edcebb15b016..2be2d57d0371 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabase.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs index 1ca4ee3b7a11..0d41f694cf80 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseCopy.cs @@ -22,7 +22,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { using DatabaseCopyModel = Model.DatabaseCopy; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; /// /// Retrieves a list of all ongoing Microsoft Azure SQL Database copy operations in the given diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs index e5b126b3a8bf..34b3274de0a4 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseImportExportStatus.cs @@ -19,8 +19,8 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.ImportExport; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs index 076fc338b2cf..f8318e42ff6d 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseOperation.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs index 82853da110bd..f6d2164b6c28 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseServiceObjective.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseUsages.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseUsages.cs index c40aee65fa04..2e0d84a784b2 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseUsages.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/GetAzureSqlDatabaseUsages.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs index c50544e421f2..6361e097780b 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabase.cs @@ -15,12 +15,12 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs index 5fb003911bc0..a4a22f9197f5 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/NewAzureSqlDatabaseServerContext.cs @@ -18,13 +18,14 @@ using System.Management.Automation; using System.Xml.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using System.IO; +using Microsoft.Azure.ServiceManagemenet.Common; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs index ae5021cee098..c84639064580 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/RemoveAzureSqlDatabase.cs @@ -16,12 +16,12 @@ using System.Globalization; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs index 778b2d67fce3..57dced83d18d 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/SetAzureSqlDatabase.cs @@ -16,12 +16,12 @@ using System.Globalization; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs index 88aefe3417e2..03f3c96bc0b9 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseCopy.cs @@ -24,7 +24,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { using DatabaseCopyModel = Model.DatabaseCopy; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; /// /// Start a copy operation for a Microsoft Azure SQL Database in the given server context. diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs index bae48d9dd668..38f1914b8c27 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseExport.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.ImportExport; @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs index 207bd7187d6f..fe297507a764 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseImport.cs @@ -14,7 +14,7 @@ using System; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.ImportExport; @@ -22,7 +22,7 @@ using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs index e8817db818b5..a4883bb3a16c 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StartAzureSqlDatabaseRestore.cs @@ -18,7 +18,7 @@ using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs index 84ab30a32745..a99387488916 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Database/Cmdlet/StopAzureSqlDatabaseCopy.cs @@ -25,7 +25,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet { using DatabaseCopyModel = Model.DatabaseCopy; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; /// /// Stop an ongoing copy operation for a Microsoft Azure SQL Database in the given server context. diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs index 2f509738b6ac..bf7d48d96ae2 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs @@ -17,7 +17,7 @@ using System.Globalization; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties; using Microsoft.WindowsAzure.Management.Sql; using Microsoft.WindowsAzure.Management.Sql.Models; @@ -26,7 +26,7 @@ namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server { using DatabaseCopyModel = Model.DatabaseCopy; using WamlDatabaseCopy = Management.Sql.Models.DatabaseCopy; - using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure; /// diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs index e757c083fc0a..3ec6681b3815 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/SqlDatabaseCmdletBase.cs @@ -15,12 +15,12 @@ using System; using System.Globalization; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services; using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.Sql; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; namespace Microsoft.WindowsAzure.Commands.SqlDatabase { diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config b/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config index 7cc892366a4e..79f2faaa2f17 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj index d12410545b2e..93f783cdea34 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj @@ -41,10 +41,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -66,12 +62,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -143,6 +139,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs index f411f0a23b9c..e1d51ac24857 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/StorSimpleTestBase.cs @@ -19,7 +19,7 @@ using System.Net.Security; using System.Reflection; using Microsoft.Azure; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Test; using Microsoft.Azure.Test.HttpRecorder; using Microsoft.WindowsAzure.Commands.ScenarioTest; diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config index 0db1bc8bcd95..1709a07b07d8 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config @@ -2,7 +2,6 @@ - @@ -11,8 +10,8 @@ - - + + diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj b/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj index a380d7a54685..1342c034b71a 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj @@ -49,10 +49,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -68,12 +64,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -205,6 +201,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs index 4ac014c3f544..5860090c2e3e 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleClient.cs @@ -20,8 +20,8 @@ using System.Net.Security; using System.Runtime.Caching; using Hyak.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Management.Scheduler; using Microsoft.WindowsAzure.Management.StorSimple; using Microsoft.WindowsAzure.Management.StorSimple.Models; diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config b/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config index 3acdf6bffa9f..b71d746d0019 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/packages.config @@ -2,7 +2,6 @@ - @@ -10,8 +9,8 @@ - - + + diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj index ca3bafd62060..4cae989400ac 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/Commands.TrafficManager.Test.csproj @@ -44,10 +44,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - False - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -76,12 +72,12 @@ False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -179,6 +175,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {3b48a77b-5956-4a62-9081-92ba04b02b27} Commands.Common.Test diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config index 807570e7d2cc..ffef8e3829c5 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager.Test/packages.config @@ -2,7 +2,6 @@ - @@ -14,8 +13,8 @@ - - + + diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj index f9defd8bf7b8..b8372978560d 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj @@ -51,10 +51,6 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - True - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll @@ -79,12 +75,12 @@ ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True - - ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True @@ -166,6 +162,10 @@ + + {d3804b64-c0d3-48f8-82ec-1f632f833c9e} + Commands.Common.Authentication + {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs index d6afbc7a29af..e30c0ccfa1ef 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/TestAzureTrafficManagerDomainName.cs @@ -16,8 +16,8 @@ using Microsoft.WindowsAzure.Commands.TrafficManager.Utilities; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; -using Microsoft.Azure.Common.Authentication; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Models; namespace Microsoft.WindowsAzure.Commands.TrafficManager { diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs index a5d272ed7c86..0a90501fa852 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Utilities/TrafficManagerClient.cs @@ -16,11 +16,11 @@ using System.Collections.Generic; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; -using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.WindowsAzure.Commands.TrafficManager.Models; using Microsoft.WindowsAzure.Management.TrafficManager; using Microsoft.WindowsAzure.Management.TrafficManager.Models; -using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure; using Hyak.Common; diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config index 4d2752df101a..cbb8ee954a8e 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/packages.config @@ -1,8 +1,7 @@  - - + @@ -13,8 +12,8 @@ - - + +